- Joined
- Jun 16, 2008
- Messages
- 333
I am trying to have an array of units that I made manually but it doesn't work. You guys are my last hope!
I tried nextCirc = {"gg_unit_gcop_0039", "gg_unit_gcop_0042", "gg_unit_gcop_0044", "gg_unit_gcop_0049"}
and that without ""
I tried to create the the array "nextCirc" without the quotes around the units and ran it without the _g[string.format and it didn't work.
Edit: I added GetRectCenter() infront of GetUnitLoc() but it sends me way offset
I tried nextCirc = {"gg_unit_gcop_0039", "gg_unit_gcop_0042", "gg_unit_gcop_0044", "gg_unit_gcop_0049"}
and that without ""
Lua:
function HeroTele()
playerTele = {}
nextCirc = {"gg_unit_gcop_0039", "gg_unit_gcop_0042", "gg_unit_gcop_0044", "gg_unit_gcop_0049"}
for i=1,15 do
playerTele[i] = 0
end
local coP = GetUnitsOfPlayerAndTypeId(Player(PLAYER_NEUTRAL_PASSIVE), FourCC("bcop"))
ForGroup(coP, CircleofPower)
DestroyGroup(coP)
end
function CircleofPower()
local EnumcoP = GetEnumUnit()
local coPCollision = CreateTrigger()
TriggerRegisterUnitInRangeSimple(coPCollision, 86, EnumcoP)
TriggerAddAction(coPCollision, function() coPTele(EnumcoP) end)
end
function coPTele(a)
local trigUnit =GetOwningPlayer(GetTriggerUnit())
local playerId = GetPlayerId(trigUnit) + 1
if trigUnit ~= Player(15) then
SetUnitOwner(a, trigUnit, TRUE)
local checkCircs = GetUnitsOfPlayerAndTypeId(trigUnit, FourCC("bcop"))
if BlzGroupGetSize(checkCircs) >= 2 then
ForGroup(checkCircs, copOwnerChange)
DestroyGroup(checkCircs)
if playerTele[playerId] == 0 then
SetUnitPositionLocFacingBJ(GetTriggerUnit(), GetRectCenter(GetUnitLoc(_G[string.format(nextCirc[playerId])]), 75))
end
end
end
end
function copOwnerChange()
SetUnitOwner(GetEnumUnit(), Player(PLAYER_NEUTRAL_PASSIVE), TRUE)
end
I tried to create the the array "nextCirc" without the quotes around the units and ran it without the _g[string.format and it didn't work.
Edit: I added GetRectCenter() infront of GetUnitLoc() but it sends me way offset
Last edited: