- Joined
- Jun 16, 2008
- Messages
- 333
So i am trying to remove every unit of Demon Hunter(Edem) of player slot that is unused. I know this can easily be done in the gui trigger but I am trying to learn LUA.
I get all the print and group number/id, whatever it is. However, non of the units gets removed.
Lua:
function HelloWorld()
CheckPlayers3()
CheckPlayers()
print("Hello World")
end
function CheckPlayers3()
print("checking3")
end
function CheckPlayers()
print("checking...")
local playerUnit = GetUnitsOfTypeIdAll("Edem")
local playerSlot = GetPlayerSlotState(GetOwningPlayer(GetEnumUnit()))
print(playerUnit)
ForGroupBJ(playerUnit, HeroKill(playerUnit))
end
function HeroKill(x)
if playerSlot == FASLE then
print("var var 2")
print(x)
RemoveUnit(x)
end
end
Last edited: