Heya.
Once again I'm in trouble.
I got a respawn system that worked perfect, but since I added some changes to it it doesn't work anymore.
Here's a loop that runs in the system on map init. It indexes every unit so that it can be respawned. During this indexing it saves the unit owner. But since I want to use Player(13) units (Neutral Victim), I have to use a trick.
That's why I wanted to put a check inside the loop to see if the unit type of the picked unit is one of the units i want to become neutral victim. If it is that type it should change its owner to Player(13) right before I save his owner for the indexing.
The thing that is not working atm:
It doesn't respawn units anymore while I only added changes in this init part of the system. It correctly changes the owners of the units ingame to Player(13), but for some reason no single unit gets revived anymore, not even the ones I didn't change the owner of.
This is how it looked like before the change:
This is how it looks like now: (BeastType[...] are the id's of the unit types that should change. LastBeast is the amount of beasts I added to BeastType[...].
Once again I'm in trouble.
I got a respawn system that worked perfect, but since I added some changes to it it doesn't work anymore.
Here's a loop that runs in the system on map init. It indexes every unit so that it can be respawned. During this indexing it saves the unit owner. But since I want to use Player(13) units (Neutral Victim), I have to use a trick.
That's why I wanted to put a check inside the loop to see if the unit type of the picked unit is one of the units i want to become neutral victim. If it is that type it should change its owner to Player(13) right before I save his owner for the indexing.
The thing that is not working atm:
It doesn't respawn units anymore while I only added changes in this init part of the system. It correctly changes the owners of the units ingame to Player(13), but for some reason no single unit gets revived anymore, not even the ones I didn't change the owner of.
This is how it looked like before the change:
JASS:
call GroupEnumUnitsInRect(G,GetWorldBounds(),Filter(function Filt))
loop
set u = FirstOfGroup(G)
exitwhen u == null
call GroupRemoveUnit(G,u)
call RegisterUnitIndex(u)
call CreateUnitProperties(u)
set RespawnX[u:Id] = GetUnitX(u)
set RespawnY[u:Id] = GetUnitY(u)
set RespawnUnitType[u:Id] = GetUnitTypeId(u)
set RespawnAngle[u:Id] = GetUnitFacing(u)
set RespawnP[u:Id] = GetOwningPlayer(u)
endloop
call GroupClear(G)
This is how it looks like now: (BeastType[...] are the id's of the unit types that should change. LastBeast is the amount of beasts I added to BeastType[...].
JASS:
call GroupEnumUnitsInRect(G,GetWorldBounds(),Filter(function Filt))
loop
set u = FirstOfGroup(G)
exitwhen u == null
call GroupRemoveUnit(G,u)
call RegisterUnitIndex(u)
call CreateUnitProperties(u)
set RespawnX[u:Id] = GetUnitX(u)
set RespawnY[u:Id] = GetUnitY(u)
set RespawnUnitType[u:Id] = GetUnitTypeId(u)
set RespawnAngle[u:Id] = GetUnitFacing(u)
set i = 0
loop
if RespawnUnitType[u:Id] == BeastType[i] then
call SetUnitOwner(u, Player(13), false)
endif
exitwhen LastBeast == i or RespawnUnitType[u:Id] == BeastType[i]
set i = i + 1
endloop
set RespawnP[u:Id] = GetOwningPlayer(u)
endloop
call GroupClear(G)