Hey all,
i have a problem with my following triggers:
The global variables are already created.
Anyone knows why the ExplorationRewardGroup gets changed?
i have a problem with my following triggers:
The global variables are already created.
Lua:
function Trig_SetExplorationReward_Filter4()
return GetOwningPlayer(GetFilterUnit()) == GetOwningPlayer(FlagUnit) and UnitAlive(GetFilterUnit()) == true and IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true
end
function CheckHeroesNearFlagTimer()
TimerStart(NewTimer(5), 0.50, true, function()
--////////////////////////// When i create one Flag it displays 1 in the first run. After that it removes the unit from the flag and a 0 is printed, but the unit never gets removed from this group
DisplayTextToForce( GetPlayersAll(), I2S( CountUnitsInGroup(ExplorationRewardGroup) ))
if FirstOfGroup(ExplorationRewardGroup) ~= nil then
local ii1
local locu
-- here i use a second group so i wont change the initial group
CopyGroup = ExplorationRewardGroup
local ExplorationRewardGroupcount = CountUnitsInGroup(CopyGroup)
for count = ExplorationRewardGroupcount, 1, -1 do
FlagUnit = FirstOfGroup(CopyGroup)
locu = GetUnitLoc(FlagUnit)
UnitsAroundFlagsGroup = GetUnitsInRangeOfLocMatching(400, locu, Condition(Trig_SetExplorationReward_Filter4))
-- this if Block is false and doesnt get excecuted which is correct
if FirstOfGroup(UnitsAroundFlagsGroup) ~= nil then
ii1 = GetUnitUserData(FlagUnit)
PlaySoundAtPointBJ(udg_ErrorSound, 100, locu, 2.275)
--/////////////////////////////////////////////////////////
ExplorationReward = LoadInteger(udg_BountyHash, 2, ii1)
--/////////////////////////////////////////////////////////
--//this isnt even called So nowhere in the trigger the unit gets removed from the group
GroupRemoveUnit(ExplorationRewardGroup, FlagUnit)
RemoveUnit(FlagUnit)
end
--////////when i comment this line out
GroupRemoveUnit(CopyGroup, FlagUnit)
end
GroupClear(UnitsAroundFlagsGroup)
--////////and comment this out too. it counts 1 all the time right. but i never remove a unit from ExplorationRewardGroup
GroupClear(CopyGroup)
end
end)
end
Anyone knows why the ExplorationRewardGroup gets changed?
Last edited: