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
Faction or Race Guards
Author Message
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #1
Faction or Race Guards
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!
08-11-2015 09:28 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #2
RE: Faction or Race Guards
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
08-11-2015 10:13 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes azmanomer's post
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #3
RE: Faction or Race Guards
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!
08-12-2015 03:17 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #4
RE: Faction or Race Guards
You can force anything to attack using attack <uid_of_enemy>
08-12-2015 05:19 AM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #5
RE: Faction or Race Guards
So I'll write something like:

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

(sorry for the noobishness ~^)
08-12-2015 07:00 AM
Find all posts by this user Like Post Quote this message in a reply
richm
Journeyman
*

Posts: 58
Likes Given: 4
Likes Received: 4 in 3 posts
Joined: Aug 2014
Reputation: 0



Post: #6
RE: Faction or Race Guards
attack <SRC>
08-12-2015 08:39 AM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #7
RE: Faction or Race Guards
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?
08-12-2015 10:16 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #8
RE: Faction or Race Guards
08-12-2015 11:10 AM
Find all posts by this user Like Post Quote this message in a reply
gergecoelho
Apprentice
*

Posts: 31
Likes Given: 7
Likes Received: 3 in 3 posts
Joined: Jul 2015
Reputation: 0



Post: #9
RE: Faction or Race Guards
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
08-13-2015 02:23 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #10
RE: Faction or Race Guards
you need to share other lines also who is src? which trigger u use give more information
08-13-2015 02:29 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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