guiismiti
Well-Known Member
- Joined
- May 19, 2014
- Messages
- 315
- Solutions
- 3
- Reaction score
- 68
Hello,
I noticed that the onKill creature script for the killing in the name of ... quest may run multiple times when more than one player has killed the monster. This will add a kill for every player who runs the script, and I want to change that.
The parameters of this function are player and target.
target is a user data and I am able to print target.uid
I would like the script to run once only, so I tried to set target.uid to 0 in the end of the script.
In the beginning of the script I'm testing if target.uid is 0, and if it is, it means the kill has been added to another player already, and the function ends (I know that it may have added the kill to the lowest damage dealing player, but I'm gonna check the target's damage map and fix that later).
The problem is, when I try to set target.uid to 0, I get this error:
If I can change this value, how do I do it? I need a persistent flag so the script knows the kill for this monster has already been counted.
Thanks in advance.
I noticed that the onKill creature script for the killing in the name of ... quest may run multiple times when more than one player has killed the monster. This will add a kill for every player who runs the script, and I want to change that.
The parameters of this function are player and target.
target is a user data and I am able to print target.uid
I would like the script to run once only, so I tried to set target.uid to 0 in the end of the script.
In the beginning of the script I'm testing if target.uid is 0, and if it is, it means the kill has been added to another player already, and the function ends (I know that it may have added the kill to the lowest damage dealing player, but I'm gonna check the target's damage map and fix that later).
The problem is, when I try to set target.uid to 0, I get this error:
Code:
attempt to index local 'target' (a userdata value)
If I can change this value, how do I do it? I need a persistent flag so the script knows the kill for this monster has already been counted.
Thanks in advance.