• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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 64
Joined
Jan 18, 2005
Messages
27,217
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