SphereCommunity
Faction or Race Guards - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Faction or Race Guards (/Thread-Faction-or-Race-Guards)

Pages: 1 2


Faction or Race Guards - gergecoelho - 08-11-2015 09:28 AM

Hello everyone!

I want to make Faction (custom) guards attack people of the opposite faction. I found this following script on the Sphere guards:

Quote:IF <src.flags>=& statf_criminal
ATTACK

But I didn't manage to force them to attack players so far.

How would I make them ATTACK? (using either tag.faction or tag.race)

Additionally, I want aggressive animals to ignore elven characters (tag.race 02), how can I make them NOT ATTACK?

Thanks in advance!


RE: Faction or Race Guards - azmanomer - 08-11-2015 10:13 AM

http://wiki.sphere.torfo.org/index.php/@CallGuards
for example
on @callguards
if <src.tag.faction>
argn3 1
endif

http://wiki.sphere.torfo.org/index.php/@NPCSeeNewPlayer
for example
on @NPCSeeNewPlayer
if <tag.race>==2
return 1
endif


RE: Faction or Race Guards - gergecoelho - 08-12-2015 03:17 AM

Hey there!

I'm using spawned guards instead of @callguards.

Seems to work properly, I'll test it through tonight, 'cause there seems to be a slight delay before the NPC attacks. Tested it like this:

Wolf 1 (negative karma, brain_animal): Attacked both humans and elves;
Wolf 2 (zero karma, brain_animal): Attacked humans after a delay, didn't attack elves;
Wolf 3 (negative karma, brain_monster): Attacked both humans and elves;
Wolf 4 (zero karma, brain_monster): Attacked humans after a delay, didn't attack elves.

Karma seems to interfere with the attacking/not. Shock

Don't know if the delay has something to do with the summoning fact, 'cause when summoning regular monsters, they attack right away, but the delay might be a overlookable problem.

Thanks, by the way!


RE: Faction or Race Guards - XuN - 08-12-2015 05:19 AM

You can force anything to attack using attack <uid_of_enemy>


RE: Faction or Race Guards - gergecoelho - 08-12-2015 07:00 AM

So I'll write something like:

if (<tag.race> == 2)
attack <SRC.???>
endif

(sorry for the noobishness ~^)


RE: Faction or Race Guards - richm - 08-12-2015 08:39 AM

attack <SRC>


RE: Faction or Race Guards - gergecoelho - 08-12-2015 10:16 AM

Okay! Got it running.

Now I tried to make spawned guards attack monsters who wander too near town borders, with the following:

Quote:ON=@NPCSEENEWPLAYER
IF <src.flags>=& statf_criminal
ATTACK
ELSE
IF (<SRC.NPC> == brain_monster)
ATTACK <SRC>
ENDIF
ENDIF

It didn't work, and I realized the event is called @NPCSeeNewPlayer (duh!). Is there a NPCSeeNewNPC or something? How could I do that?


RE: Faction or Race Guards - azmanomer - 08-12-2015 11:10 AM

try this;
http://wiki.sphere.torfo.org/index.php/@NPCLookAtChar


RE: Faction or Race Guards - gergecoelho - 08-13-2015 02:23 AM

Cool! It's working fine now, thanks a lot!

But I'm constantly getting this error on the console: " 13:22:ERROR:(human_guard.scp,63)Undefined symbol '' "

And this " IF <src.flags>=& statf_criminal " is line 63. Any way to remove this? Seems to be working fine otherwise. Shock


RE: Faction or Race Guards - azmanomer - 08-13-2015 02:29 AM

you need to share other lines also who is src? which trigger u use give more information