Ok, hey everyone again. After i keep changing my map to attempt to fix desyncs and leaks, they keep appearing. So, i assume this usually happens with repeating triggers and I do not see any leaks here. I have narrowed it down to these few repeating triggers, however i still do not see any sources of leaks. Could someone take a qquick look at point out leaks?
I'm pretty sure this is leak free and doesn't cause desyncs but im not to sure about the filter and create group(t) part.
basically just runs the above function with an alternate event. Again, i do not see any sources of leaks
These are the only triggers that happen quite often and I do not believe any of them leak. I noticed that leaks seem to happen faster with more players. I would be super greatful for anyone to help me stop these leaks, I've been having troulbe with this for the last few weeks
JASS:
function TrueFilter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) != 'eC06' //Jail unit
endfunction
function RunnerFilter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'uC01' //runner
endfunction
function PlayerFilter takes player whichPlayer returns group
local group g = CreateGroup()
call GroupEnumUnitsOfPlayer(g, whichPlayer, Filter(function RunnerFilter))
return g
endfunction
function kodoattacktarget takes nothing returns nothing
local group g = CreateGroup()
local group g2 = CreateGroup()
local integer i
local unit u
local unit r
local group t
call GroupEnumUnitsOfPlayer(g,Player(10),Filter(function TrueFilter))
loop
set u = FirstOfGroup(g)
exitwhen u == null
loop
set i = GetRandomInt(0,9)
set t = PlayerFilter(Player(i))
if CountUnitsInGroup(t) == 1 then
//repeats loop until player has an active runner, avoid having kodos attack a player with no units
exitwhen IsPlayerSlotState(Player(i),PLAYER_SLOT_STATE_PLAYING)
else
endif
endloop
call GroupEnumUnitsOfPlayer(g2,Player(i),Filter(function TrueFilter))
set r = GroupPickRandomUnit(g2)
call IssuePointOrder(u,"attack",GetUnitX(r),GetUnitY(r))
// call PingMinimap(GetUnitX(r),GetUnitY(r),1)
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
call DestroyGroup(g2)
set r = null
set g = null
set g2 = null
endfunction
function InitTrig_attacktrig takes nothing returns nothing
set gg_trg_attacktrig = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_attacktrig, 21.00 )
call TriggerAddAction( gg_trg_attacktrig, function kodoattacktarget )
endfunction
JASS:
function checkifunit takes nothing returns boolean
return IsUnitOwnedByPlayer (GetEnteringUnit() , Player(10) )
endfunction
function InitTrig_removejail takes nothing returns nothing
set gg_trg_removejail = CreateTrigger()
call TriggerRegisterEnterRectSimple( gg_trg_removejail, Rect(-1200.00, -800.00, 700.00, 700.00) )
call TriggerAddCondition(gg_trg_removejail, Condition(function checkifunit))
call TriggerAddAction(gg_trg_removejail, function kodoattacktargetwithtimer)
endfunction
-
unitdiesremove
-
Events
- Unit - A unit Dies
- Conditions
-
Actions
- Wait 0.75 seconds
- Unit - Remove (Dying unit) from the game
-
Events
-
Rescue
-
Events
- Unit - A unit enters Jail <gen>
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Runner
- (Number of units in (Units of type Flag)) Not equal to 0
-
Actions
- Trigger - Turn off (This trigger)
- Player - Set (Owner of (Triggering unit)) Current gold to (((Owner of (Triggering unit)) Current gold) + (50 x (Number of units in (Units of type Flag))))
- Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) + ((( received + ((String(((Number of units in (Units of type Flag)) x 50))) + gold for rescuing )) + (String((Number of units in (Units of type Flag))))) + player(s) from jail!!!))
- Set playercreate = (All players matching ((Number of units in (Units owned by (Matching player) of type Flag)) Equal to 1))
-
Player Group - Pick every player in playercreate and do (Actions)
-
Loop - Actions
- Set rescuepoint = (Random point in Runners Start <gen>)
- Unit - Create 1 Runner for (Picked player) at rescuepoint facing Default building facing degrees
- Camera - Pan camera for (Picked player) to rescuepoint over 0.00 seconds
- Custom script: call RemoveLocation (udg_rescuepoint)
-
Loop - Actions
- Custom script: call DestroyForce (udg_playercreate)
- Set flaggroup = (Units of type Flag)
- Unit Group - Pick every unit in flaggroup and do (Unit - Remove (Picked unit) from the game)
- Custom script: call DestroyGroup (udg_flaggroup)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- lastperson Equal to True
-
Then - Actions
- Trigger - Turn off last one left <gen>
- Sound - Stop Doom <gen> After fading
- Sound - Play music <gen>
- Set lastperson = False
- Else - Actions
-
If - Conditions
- Sound - Play escape <gen>
- Trigger - Turn on (This trigger)
-
Events
These are the only triggers that happen quite often and I do not believe any of them leak. I noticed that leaks seem to happen faster with more players. I would be super greatful for anyone to help me stop these leaks, I've been having troulbe with this for the last few weeks