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
|
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 |
|
|
Messages In This Thread |
RE: attacker question - XuN - 05-21-2015 06:03 PM
|
User(s) browsing this thread: 2 Guest(s)