SphereCommunity
Command to force a NPC to attack a given target - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Expired/Outdated Versions (/Forum-Expired-Outdated-Versions)
+--- Forum: Sphere 51a Help (/Forum-Sphere-51a-Help)
+--- Thread: Command to force a NPC to attack a given target (/Thread-Command-to-force-a-NPC-to-attack-a-given-target)

Pages: 1 2


RE: Command to force a NPC to attack a given target - Nachtmusique - 05-01-2012 07:55 AM

No script is needed to do what he is asking. There in no command function for it, but since all npcs act as pets to GMs, you can just say "all attack" or "bob attack".


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

(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



RE: Command to force a NPC to attack a given target - Khaos - 05-01-2012 11:36 AM

Trying using 'link' in your targeting maybe? Have 1st target attack the linked second target and vice versa? I am not familiar with 51a coding. I can just offer coding advice as I remember it from the pre 56b era... ie 55r and 55i...

@Nachtmusique
If he is not trying to do this as a GM but as a provocation or some other effect, that will not help one bit Smile


RE: Command to force a NPC to attack a given target - evening - 01-11-2013 04:18 PM

on=@attack
or
ON=@SeeNewPlayer
if (<var.ack> == 0) && (<src.hits> > 0)
var.ack=<src.serial>
else
var.ack=
endif
acttack <var.ack>


RE: Command to force a NPC to attack a given target - Mordaunt - 01-11-2013 11:47 PM

This thread was last active in April.. Please pay attention to dates of posts to save bringing up old threads.


RE: Command to force a NPC to attack a given target - jdchixin - 02-23-2013 08:48 PM

51a has no function. no @attact

if you want attact s b. you must know his uid.

attact <uid>