Hello guys, my name is SC_player, I'm working on a defense map currently. I'm wondering how to fix the trigger and triggeraction leaks in this spell.
Trigger:
Here is an explanation of the map, thanks to anyone who can offer insight to what is causing the problem.
http://www.hiveworkshop.com/forums/introductions-360/hey-guys-266475/
Trigger:
JASS:
function income takes nothing returns nothing
local group g = CreateGroup()
local integer i =0
local integer count = 0
local unit first
set playerInc=0
loop
exitwhen i==10
set tmpInt = incBuildings[i]
set count=0
call GroupEnumUnitsOfPlayer(g, Player(0), Filter(function GenFilter))
loop
set first=FirstOfGroup(g)
exitwhen first==null
set count=count+1
call GroupRemoveUnit(g,first)
endloop
set playerInc=playerInc+count*incAmountPer[i]
set i=i+1
call LeaderboardSetItemValue(P_Income, LeaderboardGetPlayerIndex(P_Income, Player(0)), playerInc)
endloop
call SetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)+playerInc)
call DestroyGroup(g)
set g = null
set first=null
endfunction
function Order takes unit u returns nothing
if GetUnitCurrentOrder(u) != OrderId("attack") and GetUnitCurrentOrder(u) != OrderId("firebolt") then
call IssuePointOrder(u, "attack", GetRandomReal(-5200, 3275), GetRandomReal(-1400, 1400))
endif
endfunction
function spawnFilter takes nothing returns boolean
local integer id=GetUnitTypeId(GetFilterUnit())
if id == 'o000' or id == 'o001' or id == 'o002' or id == 'o004' or id == 'o00O' or id == 'o00E' or id == 'o00P' or id == 'o00Q' or id == 'o00B' or id == 'o00R' or id == 'o00A' then
return true
endif
return false
endfunction
function spawn takes unit spawner returns nothing
local unit u
local integer chance=GetRandomInt(0, spawnDiff)
if chance>3 then
if chance >=47 then
set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if chance >=37 and chance <47 then
set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if chance >=27 and chance <37 then
set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if chance>=17 and chance <27 then
set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if chance<17 then
set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
endif
set u = null
endfunction
function spawnPlus takes unit spawner returns nothing
local unit u
if spawnDiff==55 then
set u = CreateUnit(Player(10), 'o00R', GetUnitX(spawner), GetUnitY(spawner), 0)
// set HealWave_boss = u
// call HealWave_init()
endif
if spawnDiff==45 then
set u = CreateUnit(Player(10), 'o00Q', GetUnitX(spawner), GetUnitY(spawner), 0)
endif
if spawnDiff==35 then
set u = CreateUnit(Player(10), 'o00P', GetUnitX(spawner), GetUnitY(spawner), 0)
endif
if spawnDiff==25 then
set u = CreateUnit(Player(10), 'o00E', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff == 15 then
set u = CreateUnit(Player(10), 'o00O', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff >=50 then
set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
set u = CreateUnit(Player(10), 'o00B', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff >=40 and spawnDiff < 50 then
set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
set u = CreateUnit(Player(10), 'o004', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff >=30 and spawnDiff < 40 then
set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
set u = CreateUnit(Player(10), 'o002', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff >=20 and spawnDiff < 30 then
set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
set u = CreateUnit(Player(10), 'o001', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
if spawnDiff >=3 and spawnDiff<20 then
set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
set u = CreateUnit(Player(10), 'o000', GetUnitX(spawner), GetUnitY(spawner), bj_UNIT_FACING)
endif
set u = null
endfunction
function Trig_Gametime_Actions takes nothing returns nothing
local integer i = 0
local integer a = 0
local unit first
local group g = CreateGroup()
if(counter==0) then
call TimerDialogDisplay(GameTime, true)
set P_Income=CreateLeaderboard()
call PlayerSetLeaderboard(Player(0), P_Income)
call LeaderboardAddItem(P_Income, GetPlayerName(Player(0)), 0, Player(0))
call LeaderboardSetLabel(P_Income, "Income")
call LeaderboardSetSizeByItemCount(P_Income, LeaderboardGetItemCount(P_Income))
call LeaderboardDisplay(P_Income, true)
endif
call TimerStart(gameTimer, counter, false, null)
call PauseTimer(gameTimer)
call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function spawnFilter))
loop
set first=FirstOfGroup(g)
exitwhen first==null
call Order(first)
call GroupRemoveUnit(g,first)
endloop
if counter==5 then
call DisplayTextToPlayer(Player(0), 0, 0, "Defend from the endless waves...")
endif
if counter==10 then
call DisplayTextToPlayer(Player(0), 0, 0, "The horde arrives at 4:00.")
endif
if counter==240 then
set spawnDiff=3
endif
if counter==270 then
set spawnDiff=4
endif
if counter==300 then
set spawnDiff=5
endif
if counter==330 then
set spawnDiff=6
endif
if counter==360 then
set spawnDiff=7
endif
if counter==390 then
set spawnDiff=8
endif
if counter==420 then
set spawnDiff=9
endif
if counter==450 then
set spawnDiff=10
endif
if counter==480 then
set spawnDiff=11
endif
if counter==510 then
set spawnDiff=12
endif
if counter==540 then
set spawnDiff=13
endif
if counter==570 then
set spawnDiff=14
endif
if counter==600 then
set spawnDiff=15
endif
if counter==620 then
set spawnDiff=16
endif
if counter==660 then
set spawnDiff=17
endif
if counter==690 then
set spawnDiff=18
endif
if counter==720 then
set spawnDiff=19
endif
if counter==750 then
set spawnDiff=20
endif
if counter==780 then
set spawnDiff=21
endif
if counter==810 then
set spawnDiff=22
endif
if counter==840 then
set spawnDiff=23
endif
if counter==870 then
set spawnDiff=24
endif
if counter==900 then
set spawnDiff=25
endif
if counter==920 then
set spawnDiff=26
endif
if counter==960 then
set spawnDiff=27
endif
if counter==990 then
set spawnDiff=28
endif
if counter==1020 then
set spawnDiff=29
endif
if counter==1050 then
set spawnDiff=30
endif
if counter==1080 then
set spawnDiff=31
endif
if counter==1110 then
set spawnDiff=32
endif
if counter==1140 then
set spawnDiff=33
endif
if counter==1170 then
set spawnDiff=34
endif
if counter==1200 then
set spawnDiff=35
endif
if counter==1220 then
set spawnDiff=36
endif
if counter==1260 then
set spawnDiff=37
endif
if counter==1290 then
set spawnDiff=38
endif
if counter==1320 then
set spawnDiff=39
endif
if counter==1350 then
set spawnDiff=40
endif
if counter==1380 then
set spawnDiff=41
endif
if counter==1410 then
set spawnDiff=42
endif
if counter==1440 then
set spawnDiff=43
endif
if counter==1470 then
set spawnDiff=44
endif
if counter==1500 then
set spawnDiff=45
endif
if counter==1520 then
set spawnDiff=46
endif
if counter==1560 then
set spawnDiff=47
endif
if counter==1590 then
set spawnDiff=48
endif
if counter==1620 then
set spawnDiff=49
endif
if counter==1650 then
set spawnDiff=50
endif
if counter==1680 then
set spawnDiff=51
endif
if counter==1710 then
set spawnDiff=52
endif
if counter==1740 then
set spawnDiff=53
endif
if counter==1770 then
set spawnDiff=54
endif
if counter==1800 then
set spawnDiff=55
endif
if counter==1820 then
set spawnDiff=56
endif
if counter==1860 then
set spawnDiff=57
endif
if counter==1890 then
set spawnDiff=58
endif
if counter==1920 then
set spawnDiff=59
endif
if counter==1950 then
set spawnDiff=60
endif
if counter==1980 then
set spawnDiff=61
endif
if counter==2010 then
set spawnDiff=62
endif
if counter==2040 then
set spawnDiff=63
endif
if counter==2070 then
set spawnDiff=64
endif
if counter==2100 then
set spawnDiff=65
endif
if counter == 2120 then
set spawnDiff=66
endif
if counter-(counter/5)*5==0 then
call income()
endif
if counter-(counter/20)*20==0 then
set tmpInt= 'h01Y'
call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function GenFilter))
loop
set first=FirstOfGroup(g)
exitwhen first==null
call spawn(first)
call GroupRemoveUnit(g,first)
endloop
set tmpInt= 'h01L'
call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function GenFilter))
loop
set first=FirstOfGroup(g)
exitwhen first==null
call spawnPlus(first)
call GroupRemoveUnit(g,first)
endloop
endif
call GroupEnumUnitsOfPlayer(g, Player(10), Filter(function spawnFilter))
loop
set first=FirstOfGroup(g)
exitwhen first==null
call Order(first)
call GroupRemoveUnit(g,first)
endloop
call RemoveAllGuardPositions(Player(10))
set counter=counter+1
call DestroyGroup(g)
set g=null
set first=null
endfunction
//===========================================================================
function InitTrig_Gametime takes nothing returns nothing
set gg_trg_Gametime = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Gametime, 1.00, true )
call TriggerAddAction( gg_trg_Gametime, function Trig_Gametime_Actions )
endfunction
http://www.hiveworkshop.com/forums/introductions-360/hey-guys-266475/
Attachments
Last edited: