HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Seeking Trigger Help

06-30-2006, 09:09 PM#1
Karawasa
Hey Guys,

I am working with a lot of JASS triggers on one of my projects. Unfortunatly, nothing has been done with the code to stop leaks.

Thus, I am seeking someone who is good with JASS to go through the triggers and remove the leaks. (Something that happens every once in awhile or once I don't care about, its the every 10 sec for each player etc. that I care about).

Credit will be given to whoever helps me out.

Much thanks in advance.
06-30-2006, 09:46 PM#2
Rising_Dusk
This seems more like a team or jasser request, and probably should go here.

Anyways, if you need random trigger cleaning, you can PM me functions and I can clean them. I've done it for a few other people who randomly PM'd me for help, and I'm usually pretty prompt about it too.

And if you do act on this and PM me, be forewarned that I refuse being credited in maps.
I'm only here to help, not take credit in others' maps for some quick stuff I did.
06-30-2006, 09:54 PM#3
shadow1500
Search for tutorials on memory leaks. Its really simple to remove them.
06-30-2006, 10:03 PM#4
Karawasa
Er I know how to do it well in GUI but in JASS is something else. I can read JASS but can't write it worth shit.
06-30-2006, 10:04 PM#5
shadow1500
The tutorials tell you how to do it even if you dont know jass.
You can also use WEU it has the destructor functions built into the GUI.
06-30-2006, 11:47 PM#6
emjlr3
Kara has this whole no learning JASS clause...duno y

my reccomndation, rewrite all the triggers from scratch, where it be in GUI or JASS

you say you know what they do, so just write your own
07-01-2006, 12:02 AM#7
Karawasa
Well the basic ones yes I could rewrite. There are some though that I have absolutly no fucking clue on. There aren't that many that need fixing, only 9-10 that leak like mad. That, and I dunno how to optimize the code since JASS>GUI.
07-01-2006, 12:21 AM#8
Karawasa
This is for Rising_Dusk:

Please tell me the variables you will use to fix the leaks. I would think that Temp_Group and Player_Group for the unit/player group leaks and Temp_Point for the point leaks if any.

Random Bosses:

Collapse JASS:
function Trig_Random_Bosses_Func001001001 takes nothing returns boolean
 return ( GetPlayerState(GetFilterPlayer(), PLAYER_STATE_RESOURCE_LUMBER) > 0 )
endfunction
function Trig_Random_Bosses_Func001Func001Func001C takes nothing returns boolean
 if ( not ( udg_Level < 14 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func001C takes nothing returns boolean
 if ( not ( GetPlayerTechCountSimple(udg_Element_Upgrade[udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]], GetEnumPlayer()) == 3 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func003Func002001 takes nothing returns boolean
 return ( GetPlayerTechCountSimple(udg_Element_Upgrade[udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]], GetEnumPlayer()) == 1 )
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func003Func002002 takes nothing returns boolean
 return ( udg_Level >= 20 )
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func003Func003001 takes nothing returns boolean
 return ( GetPlayerTechCountSimple(udg_Element_Upgrade[udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]], GetEnumPlayer()) == 2 )
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func003Func003002 takes nothing returns boolean
 return ( udg_Level >= 30 )
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001Func003C takes nothing returns boolean
 if ( ( GetPlayerTechCountSimple(udg_Element_Upgrade[udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]], GetEnumPlayer()) == 0 ) ) then
 return true
 endif
 if ( GetBooleanAnd( Trig_Random_Bosses_Func001Func001Func002Func001Func003Func002001(), Trig_Random_Bosses_Func001Func001Func002Func001Func003Func002002() ) ) then
 return true
 endif
 if ( GetBooleanAnd( Trig_Random_Bosses_Func001Func001Func002Func001Func003Func003001(), Trig_Random_Bosses_Func001Func001Func002Func001Func003Func003002() ) ) then
 return true
 endif
 return false
endfunction
function Trig_Random_Bosses_Func001Func001Func002Func001C takes nothing returns boolean
 if ( not Trig_Random_Bosses_Func001Func001Func002Func001Func003C() ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001Func001Func002C takes nothing returns boolean
 if ( not ( udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] == -1 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001Func001Func003C takes nothing returns boolean
 if ( not ( GetPlayerState(GetEnumPlayer(), PLAYER_STATE_RESOURCE_LUMBER) >= 1 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001Func001C takes nothing returns boolean
 if ( not ( udg_Random_Element[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Random_Bosses_Func001A takes nothing returns nothing
 if ( Trig_Random_Bosses_Func001Func001C() ) then
 if ( Trig_Random_Bosses_Func001Func001Func001C() ) then
 set udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] = GetRandomInt(0, 5)
 else
 set udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] = GetRandomInt(-1, 5)
 endif
 if ( Trig_Random_Bosses_Func001Func001Func002C() ) then
 call IssueUpgradeOrderByIdBJ( GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(), 'h00S')), 'R00C' )
 else
 if ( Trig_Random_Bosses_Func001Func001Func002Func001C() ) then
 call IssueTrainOrderByIdBJ( GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(), 'h00S')), udg_Boss_Creeps[( ( GetPlayerTechCountSimple(udg_Element_Upgrade[udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]], GetEnumPlayer()) * 6 ) + udg_Random_Elemental[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] )] )
 else
 if ( Trig_Random_Bosses_Func001Func001Func002Func001Func001C() ) then
 call IssueUpgradeOrderByIdBJ( GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(GetEnumPlayer(), 'h00S')), 'R00E' )
 else
 endif
 endif
 endif
 if ( Trig_Random_Bosses_Func001Func001Func003C() ) then
 call TriggerExecute( GetTriggeringTrigger() )
 else
 endif
 else
 endif
endfunction
function Trig_Random_Bosses_Actions takes nothing returns nothing
 call ForForce( GetPlayersMatching(Condition(function Trig_Random_Bosses_Func001001001)), function Trig_Random_Bosses_Func001A )
endfunction
function InitTrig_Random_Bosses takes nothing returns nothing
 set gg_trg_Random_Bosses = CreateTrigger( )
 call TriggerAddAction( gg_trg_Random_Bosses, function Trig_Random_Bosses_Actions )
endfunction

Kills boss:

Collapse JASS:
function Trig_Kills_Boss_Conditions takes nothing returns boolean
 if ( not ( GetUnitTypeId(GetDyingUnit()) != 'n00I' ) ) then
 return false
 endif
 if ( not ( GetOwningPlayer(GetDyingUnit()) == Player(11) ) ) then
 return false
 endif
 if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_ANCIENT) == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func009C takes nothing returns boolean
 if ( not ( udg_Boss_Loop >= 6 ) ) then
 return false
 endif
 if ( not ( udg_Boss_Loop <= 11 ) ) then
 return false
 endif
 if ( not ( udg_Hero_Mode_On == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func010001002 takes nothing returns boolean
 return ( GetUnitTypeId(GetFilterUnit()) == 'h00S' )
endfunction
function Trig_Kills_Boss_Func005Func001Func010Func001C takes nothing returns boolean
 if ( not ( udg_Boss_Loop <= 11 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func010A takes nothing returns nothing
 if ( Trig_Kills_Boss_Func005Func001Func010Func001C() ) then
 call AddUnitToStockBJ( udg_Boss_Creeps[( udg_Boss_Loop + 6 )], GetEnumUnit(), 1, 1 )
 else
 call UnitRemoveAbilityBJ( 'A00S', GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(ConvertedPlayer(GetUnitUserData(GetDyingUnit())), 'h00S')) )
 call SetPlayerTechMaxAllowedSwap( 'R00E', 8, ConvertedPlayer(GetUnitUserData(GetDyingUnit())) )
 endif
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func001C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func002C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 1 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func003C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 2 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func004C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 3 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func005C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 4 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011Func006C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Boss_Loop, 6) == 5 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Func005Func001Func011A takes nothing returns nothing
 if ( Trig_Kills_Boss_Func005Func001Func011Func001C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Other\\HowlOfTerror\\HowlCaster.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
 if ( Trig_Kills_Boss_Func005Func001Func011Func002C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
 if ( Trig_Kills_Boss_Func005Func001Func011Func003C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
 if ( Trig_Kills_Boss_Func005Func001Func011Func004C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Objects\\Spawnmodels\\NightElf\\NECancelDeath\\NECancelDeath.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
 if ( Trig_Kills_Boss_Func005Func001Func011Func005C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
 if ( Trig_Kills_Boss_Func005Func001Func011Func006C() ) then
 call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
endfunction
function Trig_Kills_Boss_Func005Func001C takes nothing returns boolean
 if ( not ( GetUnitTypeId(GetDyingUnit()) == udg_Boss_Creeps[udg_Boss_Loop] ) ) then
 return false
 endif
 return true
endfunction
function Trig_Kills_Boss_Actions takes nothing returns nothing
 call AdjustPlayerStateBJ( IMaxBJ(0, R2I(( Pow(udg_Bounty_Base, ( I2R(udg_Level) - 1.00 )) * ( ( ( I2R(GetUnitAbilityLevelSwapped('A00J', GetKillingUnitBJ())) * 0.33 ) + 1.00 ) * 5.00 ) ))), ConvertedPlayer(GetUnitUserData(GetDyingUnit())), PLAYER_STATE_RESOURCE_GOLD )
 set udg_Boss_Loop = 0
 loop
 exitwhen udg_Boss_Loop > 17
 if ( Trig_Kills_Boss_Func005Func001C() ) then
 call SetPlayerTechResearchedSwap( udg_Element_Upgrade[ModuloInteger(udg_Boss_Loop, 6)], ( ( udg_Boss_Loop / 6 ) + 1 ), ConvertedPlayer(GetUnitUserData(GetDyingUnit())) )
 call UnitRemoveAbilityBJ( 'A011', GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(ConvertedPlayer(GetUnitUserData(GetDyingUnit())), 'h00S')) )
 call TriggerExecute( gg_trg_Refresh_Boss_Availability )
 call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetDyingUnit()), ConvertedPlayer(GetUnitUserData(GetDyingUnit())), OffsetLocation(GetPlayerStartLocationLoc(ConvertedPlayer(GetUnitUserData(GetDyingUnit()))), ( 775.00 + ( I2R(udg_elemental_count[( GetUnitUserData(GetDyingUnit()) - 1 )]) * 75.00 ) ), 880.00), 270.00 )
 call SetUnitScalePercent( GetLastCreatedUnit(), ( I2R(GetUnitPointValue(GetLastCreatedUnit())) * 0.50 ), ( I2R(GetUnitPointValue(GetLastCreatedUnit())) * 0.50 ), ( I2R(GetUnitPointValue(GetLastCreatedUnit())) * 0.50 ) )
 call SetUnitInvulnerable( GetLastCreatedUnit(), true )
 set udg_elemental_count[( GetUnitUserData(GetDyingUnit()) - 1 )] = ( udg_elemental_count[( GetUnitUserData(GetDyingUnit()) - 1 )] + 1 )
 call PauseUnitBJ( true, GetLastCreatedUnit() )
 if ( Trig_Kills_Boss_Func005Func001Func009C() ) then
 call CreateNUnitsAtLoc( 1, udg_Elemental_Hero[( udg_Boss_Loop - 6 )], ConvertedPlayer(GetUnitUserData(GetDyingUnit())), GetUnitLoc(GetDyingUnit()), GetUnitFacing(GetDyingUnit()) )
 else
 endif
 call ForGroupBJ( GetUnitsOfPlayerMatching(ConvertedPlayer(GetUnitUserData(GetDyingUnit())), Condition(function Trig_Kills_Boss_Func005Func001Func010001002)), function Trig_Kills_Boss_Func005Func001Func010A )
 call ForGroupBJ( GetUnitsInRectOfPlayer(GetPlayableMapRect(), ConvertedPlayer(GetUnitUserData(GetDyingUnit()))), function Trig_Kills_Boss_Func005Func001Func011A )
 else
 endif
 set udg_Boss_Loop = udg_Boss_Loop + 1
 endloop
endfunction
function InitTrig_Kills_Boss takes nothing returns nothing
 set gg_trg_Kills_Boss = CreateTrigger( )
 call TriggerRegisterAnyUnitEventBJ( gg_trg_Kills_Boss, EVENT_PLAYER_UNIT_DEATH )
 call TriggerAddCondition( gg_trg_Kills_Boss, Condition( function Trig_Kills_Boss_Conditions ) )
 call TriggerAddAction( gg_trg_Kills_Boss, function Trig_Kills_Boss_Actions )
endfunction

Interest:

Collapse JASS:
function Trig_Interest_Func001Func003Func001001002001 takes nothing returns boolean
 return ( GetUnitTypeId(GetFilterUnit()) == 'u000' )
endfunction
function Trig_Interest_Func001Func003Func001001002002 takes nothing returns boolean
 return ( GetUnitTypeId(GetFilterUnit()) == 'u005' )
endfunction
function Trig_Interest_Func001Func003Func001001002 takes nothing returns boolean
 return GetBooleanOr( Trig_Interest_Func001Func003Func001001002001(), Trig_Interest_Func001Func003Func001001002002() )
endfunction
function Trig_Interest_Func001Func003Func001A takes nothing returns nothing
 call CreateTextTagUnitBJ( ( "+" + I2S(udg_temp_int) ), GetEnumUnit(), 20.00, 10, 100, 100, 20.00, 0 )
 call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
 call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 32.00, 90 )
 call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
 call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
 call AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "UI\\Feedback\\GoldCredit\\GoldCredit.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Interest_Func001Func003C takes nothing returns boolean
 if ( not ( udg_temp_int > 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Interest_Actions takes nothing returns nothing
 set udg_Interest_Loop = 0
 loop
 exitwhen udg_Interest_Loop > 7
 set udg_temp_int = R2I(( ( udg_Interest_Rate[udg_Interest_Loop] / 100.00 ) * I2R(GetPlayerState(ConvertedPlayer(( udg_Interest_Loop + 1 )), PLAYER_STATE_RESOURCE_GOLD)) ))
 call AdjustPlayerStateBJ( udg_temp_int, ConvertedPlayer(( udg_Interest_Loop + 1 )), PLAYER_STATE_RESOURCE_GOLD )
 if ( Trig_Interest_Func001Func003C() ) then
 call ForGroupBJ( GetUnitsOfPlayerMatching(ConvertedPlayer(( udg_Interest_Loop + 1 )), Condition(function Trig_Interest_Func001Func003Func001001002)), function Trig_Interest_Func001Func003Func001A )
 else
 endif
 set udg_Interest_Loop = udg_Interest_Loop + 1
 endloop
endfunction
function InitTrig_Interest takes nothing returns nothing
 set gg_trg_Interest = CreateTrigger( )
 call TriggerRegisterTimerEventPeriodic( gg_trg_Interest, 15.00 )
 call TriggerAddAction( gg_trg_Interest, function Trig_Interest_Actions )
endfunction

Start Timer:

Collapse JASS:
function Trig_Start_Timer_Func001Func002Func001Func001Func001Func004Func002C takes nothing returns boolean
 if ( not ( udg_Random_Element[( GetForLoopIndexA() - 1 )] == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001Func001Func001Func004C takes nothing returns boolean
 if ( not ( udg_Difficulty[( GetForLoopIndexA() - 1 )] < 5 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001Func001Func001C takes nothing returns boolean
 if ( not ( udg_Elim_Mode_On == false ) ) then
 return false
 endif
 if ( not ( udg_Winning_Player == 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001Func001Func004Func002C takes nothing returns boolean
 if ( not ( udg_Random_Element[( GetForLoopIndexA() - 1 )] == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001Func001Func004C takes nothing returns boolean
 if ( not ( udg_Difficulty[( GetForLoopIndexA() - 1 )] < 5 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001Func001C takes nothing returns boolean
 if ( not ( udg_Living_Players == 1 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func002Func001C takes nothing returns boolean
 if ( not ( udg_Creeps_Left[( GetForLoopIndexA() - 1 )] == 0 ) ) then
 return false
 endif
 if ( not ( udg_Player_Lives[( GetForLoopIndexA() - 1 )] > 0 ) ) then
 return false
 endif
 if ( not ( udg_Game_Over == false ) ) then
 return false
 endif
 if ( not ( udg_Elimination_Mode == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func003Func001Func001C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Level, 10) == 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func003Func001Func008001001 takes nothing returns boolean
 return ( udg_Player_Lives[( GetConvertedPlayerId(GetFilterPlayer()) - 1 )] > 0 )
endfunction
function Trig_Start_Timer_Func001Func003Func001Func008A takes nothing returns nothing
 call DisplayTextToForce( GetForceOfPlayer(GetEnumPlayer()), "TRIGSTR_611" )
 call AdjustPlayerStateBJ( 1, GetEnumPlayer(), PLAYER_STATE_RESOURCE_LUMBER )
endfunction
function Trig_Start_Timer_Func001Func003Func001C takes nothing returns boolean
 if ( not ( ModuloInteger(udg_Level, 5) == 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func003Func002Func001001001 takes nothing returns boolean
 return ( udg_Player_Lives[( GetConvertedPlayerId(GetFilterPlayer()) - 1 )] > 0 )
endfunction
function Trig_Start_Timer_Func001Func003Func002Func001A takes nothing returns nothing
 call DisplayTextToForce( GetForceOfPlayer(GetEnumPlayer()), "TRIGSTR_1112" )
 call CreateNUnitsAtLoc( 1, 'u00A', GetEnumPlayer(), OffsetLocation(GetPlayerStartLocationLoc(GetEnumPlayer()), ( 775.00 + ( I2R(udg_elemental_count[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]) * 75.00 ) ), 880.00), 270.00 )
 call SetUnitInvulnerable( GetLastCreatedUnit(), true )
 call PauseUnitBJ( true, GetLastCreatedUnit() )
 set udg_elemental_count[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] = ( udg_elemental_count[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] + 1 )
endfunction
function Trig_Start_Timer_Func001Func003Func002Func002C takes nothing returns boolean
 if ( ( udg_Level == 51 ) ) then
 return true
 endif
 if ( ( udg_Level == 56 ) ) then
 return true
 endif
 return false
endfunction
function Trig_Start_Timer_Func001Func003Func002C takes nothing returns boolean
 if ( not Trig_Start_Timer_Func001Func003Func002Func002C() ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func003C takes nothing returns boolean
 if ( not ( udg_Level == 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Func001Func007001002 takes nothing returns boolean
 return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true )
endfunction
function Trig_Start_Timer_Func001Func007A takes nothing returns nothing
 call SetUnitLifeBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetEnumUnit()) + 50.00 ) )
endfunction
function Trig_Start_Timer_Func001C takes nothing returns boolean
 if ( not ( udg_Level != 60 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Timer_Actions takes nothing returns nothing
 if ( Trig_Start_Timer_Func001C() ) then
 if ( Trig_Start_Timer_Func001Func003C() ) then
 call StartTimerBJ( udg_Generic_Timer, false, 25.00 )
 else
 if ( Trig_Start_Timer_Func001Func003Func001C() ) then
 if ( Trig_Start_Timer_Func001Func003Func001Func001C() ) then
 call TriggerExecute( gg_trg_Adjust_Difficulty )
 else
 endif
 call DisableTrigger( gg_trg_Random )
 call EnableTrigger( gg_trg_Random_After_Lv_5 )
 call StartTimerBJ( udg_Generic_Timer, false, 20.00 )
 call SetPlayerTechResearchedSwap( 'R009', ( ( udg_Level - 1 ) / 5 ), Player(11) )
 call ForForce( GetPlayersMatching(Condition(function Trig_Start_Timer_Func001Func003Func001Func008001001)), function Trig_Start_Timer_Func001Func003Func001Func008A )
 call TriggerExecute( gg_trg_Random_Bosses )
 else
 call StartTimerBJ( udg_Generic_Timer, false, udg_Start_Timer_Modifier )
 set udg_Start_Timer_Modifier = 8.00
 endif
 if ( Trig_Start_Timer_Func001Func003Func002C() ) then
 call ForForce( GetPlayersMatching(Condition(function Trig_Start_Timer_Func001Func003Func002Func001001001)), function Trig_Start_Timer_Func001Func003Func002Func001A )
 else
 endif
 endif
 call CreateTimerDialogBJ( udg_Generic_Timer, ( "Level " + ( I2S(( udg_Level + 1 )) + " in: " ) ) )
 call TimerDialogDisplayBJ( true, GetLastCreatedTimerDialogBJ() )
 set udg_Between_Levels = true
 call ForGroupBJ( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Start_Timer_Func001Func007001002)), function Trig_Start_Timer_Func001Func007A )
 else
 
 set bj_forLoopAIndex = 1
 set bj_forLoopAIndexEnd = 8
 loop
 exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
 if ( Trig_Start_Timer_Func001Func002Func001C() ) then
 if ( Trig_Start_Timer_Func001Func002Func001Func001C() ) then
 call DisplayTextToForce( GetPlayersAll(), ( "Congradulations " + GetPlayerName(ConvertedPlayer(GetForLoopIndexA())) ) )
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_612" )
 if ( Trig_Start_Timer_Func001Func002Func001Func001Func004C() ) then
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1496" )
 else
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1497" )
 if ( Trig_Start_Timer_Func001Func002Func001Func001Func004Func002C() ) then
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1499" )
 else
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1498" )
 endif
 endif
 set udg_Game_Over = true
 call StartTimerBJ( udg_End_Game_Timer, false, 30.00 )
 call CreateTimerDialogBJ( udg_End_Game_Timer, "TRIGSTR_1500" )
 call TimerDialogDisplayBJ( true, GetLastCreatedTimerDialogBJ() )
 call DisableTrigger( GetTriggeringTrigger() )
 else
 if ( Trig_Start_Timer_Func001Func002Func001Func001Func001C() ) then
 set udg_Winning_Player = GetConvertedPlayerId(ConvertedPlayer(GetForLoopIndexA()))
 call DisplayTextToForce( GetPlayersAll(), ( "Congradulations " + GetPlayerName(ConvertedPlayer(GetForLoopIndexA())) ) )
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1715" )
 if ( Trig_Start_Timer_Func001Func002Func001Func001Func001Func004C() ) then
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1719" )
 else
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1716" )
 if ( Trig_Start_Timer_Func001Func002Func001Func001Func001Func004Func002C() ) then
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1718" )
 else
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1717" )
 endif
 endif
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1720" )
 call DisableTrigger( GetTriggeringTrigger() )
 else
 endif
 endif
 else
 endif
 set bj_forLoopAIndex = bj_forLoopAIndex + 1
 endloop
 endif
endfunction
function InitTrig_Start_Timer takes nothing returns nothing
 set gg_trg_Start_Timer = CreateTrigger( )
 call TriggerAddAction( gg_trg_Start_Timer, function Trig_Start_Timer_Actions )
endfunction

Start Level:

Collapse JASS:
function Trig_Start_Level_Func008001001 takes nothing returns boolean
 return ( udg_Player_Lives[( GetConvertedPlayerId(GetFilterPlayer()) - 1 )] > 0 )
endfunction
function Trig_Start_Level_Func008Func002002001002001 takes nothing returns boolean
 return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Start_Level_Func008Func002002001002002001 takes nothing returns boolean
 return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_ANCIENT) == false )
endfunction
function Trig_Start_Level_Func008Func002002001002002002 takes nothing returns boolean
 return ( GetUnitUserData(GetFilterUnit()) == GetConvertedPlayerId(GetEnumPlayer()) )
endfunction
function Trig_Start_Level_Func008Func002002001002002 takes nothing returns boolean
 return GetBooleanAnd( Trig_Start_Level_Func008Func002002001002002001(), Trig_Start_Level_Func008Func002002001002002002() )
endfunction
function Trig_Start_Level_Func008Func002002001002 takes nothing returns boolean
 return GetBooleanAnd( Trig_Start_Level_Func008Func002002001002001(), Trig_Start_Level_Func008Func002002001002002() )
endfunction
function Trig_Start_Level_Func008A takes nothing returns nothing
 call DisplayTimedTextToForce( GetForceOfPlayer(GetEnumPlayer()), 5.00, ( "Level " + ( I2S(udg_Level) + ( ": " + ( GetUnitName(GroupPickRandomUnit(GetUnitsOfTypeIdAll(udg_Spawns[( udg_Level - 1 )]))) + ( " " + ( udg_Extra + ( " - " + ( I2S(( 15 + ( ( udg_Difficulty[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] + 0 ) * 3 ) )) + " spawns" ) ) ) ) ) ) ) ) )
 set udg_Creeps_Left[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] = CountUnitsInGroup(GetUnitsOfPlayerMatching(Player(11), Condition(function Trig_Start_Level_Func008Func002002001002)))
 set udg_Creeps_Left[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] = ( udg_Creeps_Left[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] + ( 15 + ( udg_Difficulty[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] * 3 ) ) )
endfunction
function Trig_Start_Level_Func009Func002001001 takes nothing returns boolean
 return ( udg_Player_Lives[( GetConvertedPlayerId(GetFilterPlayer()) - 1 )] > 0 )
endfunction
function Trig_Start_Level_Func009Func002Func001C takes nothing returns boolean
 if ( not ( udg_Spawn_Loop <= ( 15 + ( udg_Difficulty[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] * 3 ) ) ) ) then
 return false
 endif
 return true
endfunction
function Trig_Start_Level_Func009Func002A takes nothing returns nothing
 if ( Trig_Start_Level_Func009Func002Func001C() ) then
 call CreateNUnitsAtLoc( 1, udg_Spawns[( udg_Level - 1 )], Player(11), GetRectCenter(udg_Region_Spawn[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]), 270.00 )
 call SetUnitUserData( GetLastCreatedUnit(), GetConvertedPlayerId(GetEnumPlayer()) )
 call SetUnitLifePercentBJ( GetLastCreatedUnit(), ( 50.00 + ( I2R(( udg_Difficulty[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] - 1 )) * 12.50 ) ) )
 call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetRectCenter(udg_Region_Leak[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]) )
 else
 endif
endfunction
function Trig_Start_Level_Actions takes nothing returns nothing
 set udg_Between_Levels = false
 call DestroyTimerDialogBJ( GetLastCreatedTimerDialogBJ() )
 set udg_Level = ( udg_Level + 1 )
 call LeaderboardSetLabelBJ( udg_Scoreboard, ( "Level " + I2S(udg_Level) ) )
 set udg_Extra = ( "(" + ( udg_Level_Desc[( udg_Level - 1 )] + ")" ) )
 call CreateNUnitsAtLoc( 1, udg_Spawns[( udg_Level - 1 )], Player(11), GetPlayerStartLocationLoc(Player(11)), 270.00 )
 call RemoveUnit( GetLastCreatedUnit() )
 call ForForce( GetPlayersMatching(Condition(function Trig_Start_Level_Func008001001)), function Trig_Start_Level_Func008A )
 set udg_Spawn_Loop = 1
 loop
 exitwhen udg_Spawn_Loop > 30
 call TriggerSleepAction( 0.30 )
 call ForForce( GetPlayersMatching(Condition(function Trig_Start_Level_Func009Func002001001)), function Trig_Start_Level_Func009Func002A )
 set udg_Spawn_Loop = udg_Spawn_Loop + 1
 endloop
endfunction
function InitTrig_Start_Level takes nothing returns nothing
 set gg_trg_Start_Level = CreateTrigger( )
 call TriggerRegisterTimerExpireEventBJ( gg_trg_Start_Level, udg_Generic_Timer )
 call TriggerAddAction( gg_trg_Start_Level, function Trig_Start_Level_Actions )
endfunction

Leak:

Collapse JASS:
function Trig_Leak_Conditions takes nothing returns boolean
 if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(11) ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Func001Func001Func007C takes nothing returns boolean
 if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_ANCIENT) == true ) ) then
 return false
 endif
 if ( not ( GetUnitTypeId(GetTriggerUnit()) != 'n00I' ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Func001Func001Func011Func005001002 takes nothing returns boolean
 return ( GetUnitUserData(GetFilterUnit()) == ( udg_Leak_Loop + 1 ) )
endfunction
function Trig_Leak_Func001Func001Func011Func005Func001C takes nothing returns boolean
 if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_ANCIENT) == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Func001Func001Func011Func005A takes nothing returns nothing
 if ( Trig_Leak_Func001Func001Func011Func005Func001C() ) then
 call RemoveUnit( GetEnumUnit() )
 else
 call ExplodeUnitBJ( GetEnumUnit() )
 endif
endfunction
function Trig_Leak_Func001Func001Func011Func006Func001C takes nothing returns boolean
 if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_ANCIENT) == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Func001Func001Func011Func006A takes nothing returns nothing
 if ( Trig_Leak_Func001Func001Func011Func006Func001C() ) then
 call RemoveUnit( GetEnumUnit() )
 else
 call ExplodeUnitBJ( GetEnumUnit() )
 endif
endfunction
function Trig_Leak_Func001Func001Func011C takes nothing returns boolean
 if ( not ( udg_Player_Lives[udg_Leak_Loop] == 0 ) ) then
 return false
 endif
 if ( not ( udg_Player_Status[udg_Leak_Loop] == GetPlayerName(ConvertedPlayer(( udg_Leak_Loop + 1 ))) ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Func001Func001C takes nothing returns boolean
 if ( not ( RectContainsUnit(udg_Region_Leak[udg_Leak_Loop], GetTriggerUnit()) == true ) ) then
 return false
 endif
 return true
endfunction
function Trig_Leak_Actions takes nothing returns nothing
 set udg_Leak_Loop = 0
 loop
 exitwhen udg_Leak_Loop > 7
 if ( Trig_Leak_Func001Func001C() ) then
 call CreateNUnitsAtLoc( 1, GetUnitTypeId(GetTriggerUnit()), Player(11), GetRectCenter(udg_Region_Spawn[udg_Leak_Loop]), 270.00 )
 call SetUnitLifeBJ( GetLastCreatedUnit(), GetUnitStateSwap(UNIT_STATE_LIFE, GetTriggerUnit()) )
 call SetUnitUserData( GetLastCreatedUnit(), GetUnitUserData(GetTriggerUnit()) )
 call RemoveUnit( GetTriggerUnit() )
 set udg_Player_Lives[udg_Leak_Loop] = IMaxBJ(0, ( udg_Player_Lives[udg_Leak_Loop] - 1 ))
 set udg_Lost_Lives_Count[udg_Leak_Loop] = ( udg_Lost_Lives_Count[udg_Leak_Loop] + 1 )
 if ( Trig_Leak_Func001Func001Func007C() ) then
 set udg_Player_Lives[udg_Leak_Loop] = IMaxBJ(0, ( udg_Player_Lives[udg_Leak_Loop] - 2 ))
 set udg_Lost_Lives_Count[udg_Leak_Loop] = ( udg_Lost_Lives_Count[udg_Leak_Loop] + 2 )
 else
 endif
 call LeaderboardSetPlayerItemValueBJ( ConvertedPlayer(( udg_Leak_Loop + 1 )), GetLastCreatedLeaderboard(), udg_Player_Lives[udg_Leak_Loop] )
 call LeaderboardSortItemsBJ( GetLastCreatedLeaderboard(), bj_SORTTYPE_SORTBYPLAYER, false )
 call LeaderboardSortItemsBJ( GetLastCreatedLeaderboard(), bj_SORTTYPE_SORTBYVALUE, false )
 if ( Trig_Leak_Func001Func001Func011C() ) then
 set udg_Player_Status[udg_Leak_Loop] = "Schooled"
 call SetPlayerStateBJ( ConvertedPlayer(( udg_Leak_Loop + 1 )), PLAYER_STATE_RESOURCE_GOLD, 0 )
 call SetPlayerStateBJ( ConvertedPlayer(( udg_Leak_Loop + 1 )), PLAYER_STATE_RESOURCE_LUMBER, 0 )
 call LeaderboardSetPlayerItemLabelBJ( ConvertedPlayer(( udg_Leak_Loop + 1 )), GetLastCreatedLeaderboard(), udg_Player_Status[udg_Leak_Loop] )
 call ForGroupBJ( GetUnitsOfPlayerMatching(Player(11), Condition(function Trig_Leak_Func001Func001Func011Func005001002)), function Trig_Leak_Func001Func001Func011Func005A )
 call ForGroupBJ( GetUnitsOfPlayerAll(ConvertedPlayer(( udg_Leak_Loop + 1 ))), function Trig_Leak_Func001Func001Func011Func006A )
 call TriggerExecute( gg_trg_Count_Living_Players )
 call ConditionalTriggerExecute( gg_trg_Check_Last_Survivor )
 else
 endif
 else
 endif
 set udg_Leak_Loop = udg_Leak_Loop + 1
 endloop
endfunction
function InitTrig_Leak takes nothing returns nothing
 set gg_trg_Leak = CreateTrigger( )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Red )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Blue )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Green )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Orange )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Pink )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Purple )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Teal )
 call TriggerRegisterEnterRectSimple( gg_trg_Leak, gg_rct_Leak_Yellow )
 call TriggerAddCondition( gg_trg_Leak, Condition( function Trig_Leak_Conditions ) )
 call TriggerAddAction( gg_trg_Leak, function Trig_Leak_Actions )
endfunction

Spawn Ronald:

Collapse JASS:
function Trig_Spawn_Ronald_Conditions takes nothing returns boolean
 if ( not ( udg_Game_Over == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Spawn_Ronald_Func001Func002C takes nothing returns boolean
 if ( not ( udg_Ronald_Ticker == 20 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Spawn_Ronald_Func001Func003001001 takes nothing returns boolean
 return ( udg_Player_Lives[( GetConvertedPlayerId(GetFilterPlayer()) - 1 )] > 0 )
endfunction
function Trig_Spawn_Ronald_Func001Func003A takes nothing returns nothing
 call CreateNUnitsAtLoc( 1, udg_Ronald[GetRandomInt(0, 6)], Player(11), GetRectCenter(udg_Region_Spawn[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]), 270.00 )
 call SetUnitUserData( GetLastCreatedUnit(), GetConvertedPlayerId(GetEnumPlayer()) )
 call SetUnitLifePercentBJ( GetLastCreatedUnit(), ( 50.00 + ( I2R(( udg_Difficulty[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )] - 1 )) * 12.50 ) ) )
 call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetRectCenter(udg_Region_Leak[( GetConvertedPlayerId(GetEnumPlayer()) - 1 )]) )
endfunction
function Trig_Spawn_Ronald_Func001C takes nothing returns boolean
 if ( not ( udg_Game_Over == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Spawn_Ronald_Actions takes nothing returns nothing
 if ( Trig_Spawn_Ronald_Func001C() ) then
 set udg_Ronald_Ticker = ( udg_Ronald_Ticker + 1 )
 if ( Trig_Spawn_Ronald_Func001Func002C() ) then
 call SetPlayerTechResearchedSwap( 'R00B', ( GetPlayerTechCountSimple('R00B', Player(11)) + 1 ), Player(11) )
 call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_1613" )
 set udg_Ronald_Ticker = 0
 else
 endif
 call ForForce( GetPlayersMatching(Condition(function Trig_Spawn_Ronald_Func001Func003001001)), function Trig_Spawn_Ronald_Func001Func003A )
 else
 endif
endfunction
function InitTrig_Spawn_Ronald takes nothing returns nothing
 set gg_trg_Spawn_Ronald = CreateTrigger( )
 call TriggerRegisterTimerExpireEventBJ( gg_trg_Spawn_Ronald, udg_Spawn_Ronald )
 call TriggerAddCondition( gg_trg_Spawn_Ronald, Condition( function Trig_Spawn_Ronald_Conditions ) )
 call TriggerAddAction( gg_trg_Spawn_Ronald, function Trig_Spawn_Ronald_Actions )
endfunction

Summoning Tower:

Collapse JASS:
function Trig_Summoning_Tower_Func001Func001C takes nothing returns boolean
 if ( not ( GetUnitLifePercent(GetEnumUnit()) == 100.00 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Summoning_Tower_Func001A takes nothing returns nothing
 if ( Trig_Summoning_Tower_Func001Func001C() ) then
 call CreateNUnitsAtLoc( 1, 'nndk', GetOwningPlayer(GetEnumUnit()), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
 call UnitApplyTimedLifeBJ( 60.00, 'BTLF', GetLastCreatedUnit() )
 call AddSpecialEffectTargetUnitBJ( "chest", GetLastCreatedUnit(), "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
endfunction
function Trig_Summoning_Tower_Func002Func001C takes nothing returns boolean
 if ( not ( GetUnitLifePercent(GetEnumUnit()) == 100.00 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Summoning_Tower_Func002A takes nothing returns nothing
 if ( Trig_Summoning_Tower_Func002Func001C() ) then
 call CreateNUnitsAtLoc( 1, 'nndr', GetOwningPlayer(GetEnumUnit()), GetUnitLoc(GetEnumUnit()), bj_UNIT_FACING )
 call UnitApplyTimedLifeBJ( 60.00, 'BTLF', GetLastCreatedUnit() )
 call AddSpecialEffectTargetUnitBJ( "chest", GetLastCreatedUnit(), "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl" )
 call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 else
 endif
endfunction
function Trig_Summoning_Tower_Actions takes nothing returns nothing
 call ForGroupBJ( GetUnitsOfTypeIdAll('h013'), function Trig_Summoning_Tower_Func001A )
 call ForGroupBJ( GetUnitsOfTypeIdAll('h02D'), function Trig_Summoning_Tower_Func002A )
endfunction
function InitTrig_Summoning_Tower takes nothing returns nothing
 set gg_trg_Summoning_Tower = CreateTrigger( )
 call TriggerRegisterTimerEventPeriodic( gg_trg_Summoning_Tower, 10.00 )
 call TriggerAddAction( gg_trg_Summoning_Tower, function Trig_Summoning_Tower_Actions )
endfunction

Flesh Golem:

Collapse JASS:
function Trig_Flesh_Golem_Tower_Kill_Func005001001003 takes nothing returns boolean
 return ( GetUnitAbilityLevelSwapped('A00N', GetFilterUnit()) > 0 )
endfunction
function Trig_Flesh_Golem_Tower_Kill_Conditions takes nothing returns boolean
 if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_UNDEAD) == false ) ) then
 return false
 endif
 if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_MECHANICAL) == false ) ) then
 return false
 endif
 if ( not ( CountUnitsInGroup(GetUnitsInRangeOfLocMatching(udg_Flesh_Golem_XP_radius, GetUnitLoc(GetDyingUnit()), Condition(function Trig_Flesh_Golem_Tower_Kill_Func005001001003))) > 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Flesh_Golem_Tower_Kill_Func001002003001001003 takes nothing returns boolean
 return ( GetUnitAbilityLevelSwapped('A00N', GetFilterUnit()) > 0 )
endfunction
function Trig_Flesh_Golem_Tower_Kill_Func002001003 takes nothing returns boolean
 return ( GetUnitAbilityLevelSwapped('A00N', GetFilterUnit()) > 0 )
endfunction
function Trig_Flesh_Golem_Tower_Kill_Func002Func002C takes nothing returns boolean
 if ( not ( GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit()) >= 75.00 ) ) then
 return false
 endif
 if ( not ( GetUnitAbilityLevelSwapped('A00N', GetEnumUnit()) < 31 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Flesh_Golem_Tower_Kill_Func002A takes nothing returns nothing
 call SetUnitManaPercentBJ( GetEnumUnit(), ( GetUnitManaPercent(GetEnumUnit()) + ( ( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetDyingUnit()) * udg_flesh_xp_share ) / ( udg_Flesh_Golem_Base_XP * Pow(1.20, ( I2R(GetUnitAbilityLevelSwapped('A00N', GetEnumUnit())) - 1 )) ) ) ) )
 if ( Trig_Flesh_Golem_Tower_Kill_Func002Func002C() ) then
 call SetUnitAbilityLevelSwapped( 'A00N', GetEnumUnit(), IMinBJ(31, ( GetUnitAbilityLevelSwapped('A00N', GetEnumUnit()) + 1 )) )
 call SetUnitManaPercentBJ( GetEnumUnit(), 0.00 )
 set udg_temp_int = ( 45 + ( GetUnitAbilityLevelSwapped('A00N', GetEnumUnit()) * 5 ) )
 call SetUnitScalePercent( GetEnumUnit(), I2R(udg_temp_int), I2R(udg_temp_int), I2R(udg_temp_int) )
 else
 endif
endfunction
function Trig_Flesh_Golem_Tower_Kill_Actions takes nothing returns nothing
 set udg_flesh_xp_share = ( 1.00 / I2R(CountUnitsInGroup(GetUnitsInRangeOfLocMatching(udg_Flesh_Golem_XP_radius, GetUnitLoc(GetDyingUnit()), Condition(function Trig_Flesh_Golem_Tower_Kill_Func001002003001001003)))) )
 call ForGroupBJ( GetUnitsInRangeOfLocMatching(udg_Flesh_Golem_XP_radius, GetUnitLoc(GetDyingUnit()), Condition(function Trig_Flesh_Golem_Tower_Kill_Func002001003)), function Trig_Flesh_Golem_Tower_Kill_Func002A )
endfunction
function InitTrig_Flesh_Golem_Tower_Kill takes nothing returns nothing
 set gg_trg_Flesh_Golem_Tower_Kill = CreateTrigger( )
 call TriggerRegisterAnyUnitEventBJ( gg_trg_Flesh_Golem_Tower_Kill, EVENT_PLAYER_UNIT_DEATH )
 call TriggerAddCondition( gg_trg_Flesh_Golem_Tower_Kill, Condition( function Trig_Flesh_Golem_Tower_Kill_Conditions ) )
 call TriggerAddAction( gg_trg_Flesh_Golem_Tower_Kill, function Trig_Flesh_Golem_Tower_Kill_Actions )
endfunction

Element Query:

Collapse JASS:
function Trig_Element_Query_Conditions takes nothing returns boolean
 if ( not ( GetSpellAbilityId() == 'A012' ) ) then
 return false
 endif
 return true
endfunction
function Trig_Element_Query_Func010001002 takes nothing returns boolean
 return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == true )
endfunction
function Trig_Element_Query_Func010Func001Func001Func002C takes nothing returns boolean
 if ( not ( udg_Random_Element[( GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit())) - 1 )] == true ) ) then
 return false
 endif
 if ( not ( GetUnitAbilityLevelSwapped('A001', GetEnumUnit()) != 0 ) ) then
 return false
 endif
 return true
endfunction
function Trig_Element_Query_Func010Func001Func001C takes nothing returns boolean
 if ( ( GetUnitAbilityLevelSwapped('A00T', GetEnumUnit()) != 0 ) ) then
 return true
 endif
 if ( Trig_Element_Query_Func010Func001Func001Func002C() ) then
 return true
 endif
 return false
endfunction
function Trig_Element_Query_Func010Func001C takes nothing returns boolean
 if ( not Trig_Element_Query_Func010Func001Func001C() ) then
 return false
 endif
 return true
endfunction
function Trig_Element_Query_Func010Func002C takes nothing returns boolean
 if ( not ( GetUnitAbilityLevelSwapped('A001', GetEnumUnit()) != 0 ) ) then
 return false
 endif
 if ( not ( udg_Random_Element[( GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit())) - 1 )] == false ) ) then
 return false
 endif
 return true
endfunction
function Trig_Element_Query_Func010A takes nothing returns nothing
 if ( Trig_Element_Query_Func010Func001C() ) then
 set udg_temp_int = ( udg_temp_int + R2I(GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetEnumUnit())) )
 else
 endif
 if ( Trig_Element_Query_Func010Func002C() ) then
 set udg_temp_int = ( udg_temp_int + R2I(( GetUnitStateSwap(UNIT_STATE_MAX_LIFE, GetEnumUnit()) * 0.75 )) )
 else
 endif
endfunction
function Trig_Element_Query_Actions takes nothing returns nothing
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, "TRIGSTR_723" )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cff660077Darkness : Level " + ( I2S(GetPlayerTechCountSimple('R001', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cffdB9513Earth : Level " + ( I2S(GetPlayerTechCountSimple('R002', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cffff0000Fire : Level " + ( I2S(GetPlayerTechCountSimple('R003', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cffffffaaLight : Level " + ( I2S(GetPlayerTechCountSimple('R004', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cdd00dd00Nature : Level " + ( I2S(GetPlayerTechCountSimple('R005', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cff5555ffWater : Level " + ( I2S(GetPlayerTechCountSimple('R000', GetOwningPlayer(GetSpellAbilityUnit()))) + "|r" ) ) )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cffffff00Current Interest Rate: " + ( R2SW(udg_Interest_Rate[( GetConvertedPlayerId(GetTriggerPlayer()) - 1 )], 1, 1) + "%|r" ) ) )
 set udg_temp_int = GetPlayerState(GetOwningPlayer(GetSpellAbilityUnit()), PLAYER_STATE_RESOURCE_GOLD)
 call ForGroupBJ( GetUnitsOfPlayerMatching(GetOwningPlayer(GetSpellAbilityUnit()), Condition(function Trig_Element_Query_Func010001002)), function Trig_Element_Query_Func010A )
 call DisplayTimedTextToForce( GetForceOfPlayer(GetOwningPlayer(GetSpellAbilityUnit())), 10.00, ( "|cffffff00Current Net Worth: " + ( I2S(udg_temp_int) + " gold.|r" ) ) )
endfunction
function InitTrig_Element_Query takes nothing returns nothing
 set gg_trg_Element_Query = CreateTrigger( )
 call TriggerRegisterAnyUnitEventBJ( gg_trg_Element_Query, EVENT_PLAYER_UNIT_SPELL_CAST )
 call TriggerAddCondition( gg_trg_Element_Query, Condition( function Trig_Element_Query_Conditions ) )
 call TriggerAddAction( gg_trg_Element_Query, function Trig_Element_Query_Actions )
endfunction
07-01-2006, 12:25 AM#9
Rising_Dusk
Holy crap.
Not only are they not indented at all, they're straight converted from GUI with bunches of conditionals...
Not to mention there are like 1000 lines of code there...
I may as well be coding the map for you. *Cough*

Anyways, I did the Random Bosses one.
I in no way know this works, I just compiled it the best I could, wouldn't surprise me if I made a typo somewhere.

I've still got my bloody JESP spell to update to get it approved, so I've got quite a bit to do. :/

Random Bosses
Collapse JASS:
//******************************************************************************     
//******************************************************************************
function Random_Bosses_ForceStuff takes nothing returns nothing
    local player ep = GetEnumPlayer()
    local integer epn = GetPlayerId(ep)
    local integer tech = GetPlayerTechCount(ep, udg_Element_Upgrade[udg_Random_Elemental[epn]], true)
    
    if udg_Random_Element[epn] then
        if udg_Level < 14 then
            set udg_Random_Elemental[epn] = GetRandomInt(0, 5)
        else
            set udg_Random_Elemental[epn] = GetRandomInt(-1, 5)
        endif
        if udg_Random_Elemental[epn] == -1 then
            call IssueImmediateOrderById(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(ep, 'h00S')), 'R00C')
        else
            if tech == 0 or (tech == 1 and udg_Level >= 20) or (tech == 2 and udg_Level >= 30) then
                call IssueImmediateOrderById(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(ep, 'h00S')), udg_Boss_Creeps[(tech * 6) + udg_Random_Elemental[epn]])
            else
                if tech == 3 then
                    call IssueImmediateOrderById(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(ep, 'h00S')), 'R00E')
                endif
            endif
        endif
        if GetPlayerState(ep, PLAYER_STATE_RESOURCE_LUMBER) >= 1 then
            call TriggerExecute(GetTriggeringTrigger())
        endif
     endif
endfunction

function Random_Bosses_Actions takes nothing returns nothing
    local force f = CreateForce()
    local integer index = 0
    
    loop
        exitwhen index > 11
        if GetPlayerState(Player(index), PLAYER_STATE_RESOURCE_LUMBER) > 0 then
            call ForceAddPlayer(f, Player(index))
        endif
        set index = index + 1
    endloop
    call ForForce(f, function Random_Bosses_ForceStuff)
    
    call ForceClear(f)
    call DestroyForce(f)
    set f = null
endfunction

function InitTrig_Random_Bosses takes nothing returns nothing
    set gg_trg_Random_Bosses = CreateTrigger()
    call TriggerAddAction(gg_trg_Random_Bosses, function Random_Bosses_Actions)
endfunction

Just to let you know.
Some of these are so miserably GUI-Screwed up that there is no way in hell I can save them.
Sorry, but I don't jass for a living. :P

And one last note...
Because this was done in GUI, I'm not cleaning anything about these functions.
They're being totally optimized. Kar, you should know what you're asking of people before asking it.
Here I was thinking at first all you needed was a few DestroyGroup()s or RemoveLocation()s, but you were asking for a total recode of the entire triggers.
*Sigh*
07-01-2006, 01:27 AM#10
emjlr3
case it point why starting fresh is better then not starting fresh
07-01-2006, 01:29 AM#11
Rising_Dusk
I totally agree.
Just recode the triggers entirely, dont even try to convert them from gui to jass, it's too much work.

One of the ones you posted is 200 lines of gui to jass.
I don't want to go to sleep with Func008Func002002001002002002's dancing in my head.
07-01-2006, 02:50 AM#12
Karawasa
Er actually all I am asknig for is DestroyGroup()s or RemoveLocation()s etc. Just the memory leaks caused by using unit and player groups without setting them to a variable and then destroying. Thats all I need. It can stay in its shitty GUI format for all I care.
07-01-2006, 02:57 AM#13
StealthFox
All you have to do is destroy any groups or points either created through a function (some of Blizzard's functions create *temporary* locations) or that you have created yourself. It really isn't that complicated if you do it from the start. All it takes is:

Custom script: call RemoveLocation(<point variable>)

or

Custom script: call DestroyGroup(<group variable>)

Edit: JASS shouldn't be abused by people who just want to look like they know what they're doing. I'd rather use GUI anyday than JASS if I had to because it's easier to read and most of the time it's easier to change. I'd only use JASS on EXTREMELY complicated programming involving many nested-if statements, loops, or functions that GUI isn't capable of doing.
07-01-2006, 03:03 AM#14
Karawasa
Er I know how to destroy the variables once created. The problem with the 10 triggers is that there is no GUI version of them. In them, unit groups and player groups are used without properly setting them to a variable in the first place. That needs to be done before custom script can do anything.
07-01-2006, 03:16 AM#15
Rising_Dusk
Quote:
I'd only use JASS on EXTREMELY complicated programming involving many nested-if statements, loops, or functions that GUI isn't capable of doing.

I use jass on everything, because if you know what you're doing it makes everything easier.
Not to mention run smoother, cleaner, and make it easier to manipulate.

And Kar, how can there be no gui version of them?
They're clearly not written in jass from the start. I don't think anyone's even capable of writing those Function names that poorly without making an error. :P

Point being, those functions were 100% poorly written in any case.
No indentation, no comments, no spacing, no locals, all BJs, no cleanup.
You can't really just go through and destroy stuff if you have no idea what is going on.