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
attacker question
Author Message
XuN
Sphere Developer
*****

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



Post: #2
RE: attacker question
Depends on the situation, if you are going to prevent npcs to joining this list or if you want to remove an specific uid in certain cases...

When you are looping on something you are going to decrease it's better to do a reversed loop because if you remove 2 attackers in the loop when you reach 2 last cycles it will throw error:

Code:
for x <eval <attacker>-1> 0
IF (<attacker.<dLOCAL.X>.isnpc>)
  attacker.<dLOCAL.X>.remove
endif
endfor

You can alternatively remove an uid with some previous check: attacker.delete <uid>

Code:
ON=@HitTry
if (<src.npc>)
attacker.delete <src>
return 1
endif

Or you can alternatively just block it's inserction on the list:

Code:
ON=@CombatAdd // this will force npc (if you are using the trigger on an npc to try to add it again in the next tick)
if (<src.npc>)
return 1
endif

Altought I don't know what do you want ... if you just want NPCs to not be attacked the very best method is to ignore them so Sphere won't try to add them each time it should, hence less code will be run:

Code:
ON=@CombatAdd
if (<src.npc>)
argn2=1
endif
05-21-2015 06:03 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
attacker question - Rizz - 05-21-2015, 10:18 AM
RE: attacker question - XuN - 05-21-2015 06:03 PM
RE: attacker question - Rizz - 05-21-2015, 07:53 PM
RE: attacker question - XuN - 05-21-2015, 08:26 PM
RE: attacker question - Rizz - 05-22-2015, 06:18 PM

Forum Jump:


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