• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
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.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
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.
Top