I have a problem where a summoned unit's timer runs out and credit for the "kill" is given to player 1 (red). Here's the sample code:
This action alone will set PlayerNumber to 1, which is the converted player number of Red. After doing some tests (using pings to find the location of the killing unit), I've noticed that when a summoned unit's timer expires, the killing unit is a non-existant unit at origin (0,0) owned by Red.
Here's what I'm trying to do: I want to have players be able to take credit for summoned unit kills, but I don't want anyone taking credit if they simply expire. How would I do that?
EDIT: nm, GetKillingUnit() is null. What through me off is that either GetOwningPlayer(null) returns Red, or GetConvertedPlayerId(null) returns 1. In any case, problem solved.
-
Events
- Unit - A unit Dies
JASS:
local integer PlayerNumber = GetConvertedPlayerId(GetOwningPlayer(GetKillingUnit()))
This action alone will set PlayerNumber to 1, which is the converted player number of Red. After doing some tests (using pings to find the location of the killing unit), I've noticed that when a summoned unit's timer expires, the killing unit is a non-existant unit at origin (0,0) owned by Red.
Here's what I'm trying to do: I want to have players be able to take credit for summoned unit kills, but I don't want anyone taking credit if they simply expire. How would I do that?
EDIT: nm, GetKillingUnit() is null. What through me off is that either GetOwningPlayer(null) returns Red, or GetConvertedPlayerId(null) returns 1. In any case, problem solved.
Last edited: