[Trigger] Player 1 Problem

Status
Not open for further replies.
Level 13
Joined
Mar 19, 2010
Messages
870
hi hivers,

what could be the reason for the following problem?

I create a lot of units for player "bj_PLAYER_NEUTRAL_EXTRA" and every time a unit dies the Player 0 (red) is the Killer.

For example:

I create a unit for player "bj_PLAYER_NEUTRAL_EXTRA" and i give the unit a life time for 10s. After this 10s the unit die and player 0 is the killer :) - What could be the reason for this behavior?

Best Reg
 
I suspect it defaults to returning Player(0) because many of the natives crash if passed a null player.

There should be no "killing" unit in response to the event (return null). Getting the owner of null returns Player(0) as a safety. TriggeringPlayer likely also returns Player(0) because it is probably not defined in response to that event.

To test for suicides check the killing unit. Suicides will either have a null killing unit or the killing unit will be the same as the dying unit.
 
I assume the problem is you are trying to get killing player's number, which returns 0, because if there was a serious problem like in post2 it should have been known.

You have to check if the killing unit is null or not, as written in above post.
 
Status
Not open for further replies.
Back
Top