The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Command to force a NPC to attack a given target
Author Message
Boydon
Apprentice
*

Posts: 5
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #12
RE: Command to force a NPC to attack a given target
(05-01-2012 03:54 AM)khaos Wrote:  Just script the function using targeting code.

Some advice on targeting code in sphere 51a? Cause the ATTACK function seems to have the same behavior also script side (the NPC is attacking me and not the desired target).

I've tried many ways also forcing the ACT of the NPC supposed to attack and giving the desired target'UID as argument of the ATTACK function, but with no luck...

This is what I have so far:
Code:
[7020]
//Wand of attack
NAME=Wand of attack
ID=0df2
COLOR=GOLDEN_ARMOR_COLOR
TYPE=13
HITPOINTS=101-115
REQSTR=0
WEIGHT=1
ATTR=04

CATEGORY=Custom
SUBSECTION=Boydon
DESCRIPTION=Wand of Attack

ONTRIGGER=DCLICK
    IF (<SRC.ACCOUNT.PLEVEL> >= 2)
        SRC.SYSMESSAGE Please select target of attack
        TARGET
        RETURN 0
    ELSE
        SRC.SYSMESSAGE I'm a lamer and I will go to jail for using this!
        SRC.JAIL
        REMOVE
        RETURN 1        
    ENDIF
    
ONTRIGGER=TARGON_ITEM
    SRC.SYSMESSAGE You have to target a player or an NPC...
    RETURN 1

ONTRIGGER=TARGON_CHAR
    SRC.NEWITEM 7021
    SRC.ACT.MORE1=<SRC.TARG.UID>
    SRC.ACT.EQUIP
    SRC.ACT.DCLICK
    RETURN 1

[7021]
ID=1EA7
NAME=Wand of Attack memory
TYPE=13
ATTR=96

ONTRIGGER=DCLICK
    SRC.SYSMESSAGE Please select the soruce of the attack...
    RETURN 0

ONTRIGGER=TARGON_CHAR
    SRC.TARG.ACT=<MORE1>
    SRC.TARG.UPDATE
    SRC.TARG.ATTACK <MORE1>
    REMOVE
    RETURN 1

ONTRIGGER=TARGON_ITEM
    SRC.MESSAGE You have to target a player or an NPC, please try again...
    REMOVE
    RETURN 1
(This post was last modified: 05-01-2012 11:08 AM by Boydon.)
05-01-2012 11:03 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Command to force a NPC to attack a given target - Boydon - 05-01-2012 11:03 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)