SwedishChef
New Member
- Reaction score
- 32
Okey so I have a map which I will release today. Thing is that the preload system took 28 seconds (a bit too long). Could some friendly soul turn it into good and effective jass for me? I have the gui trigger and the converted trigger so it will be easier for you to edit. Thanks!
Trigger:
- Preload Items3
- Events
- Time - Elapsed game time is 0.01 seconds
- Conditions
- Actions
- If (PreloadCount Equal to 0) then do (Game - Display to (All players) the text: |cffff0000Preloadin...) else do (Do nothing)
- Set PreloadCount = (PreloadCount + 1)
- Set MyLocation = (Center of (Playable map area))
- Unit - Create 1 Paladin for Neutral Extra at MyLocation facing Default building facing degrees
- Hero - Give (Random item in Item Region <gen> matching ((Item-class of (Matching item)) Equal to Permanent)) to (Last created unit)
- Hero - Give (Random item in Item Region <gen> matching ((Item-class of (Matching item)) Equal to Permanent)) to (Last created unit)
- Hero - Give (Random item in Item Region <gen> matching ((Item-class of (Matching item)) Equal to Permanent)) to (Last created unit)
- Hero - Give (Random item in Item Region <gen> matching ((Item-class of (Matching item)) Equal to Charged)) to (Last created unit)
- Unit - Remove (Last created unit) from the game
- Custom script: call RemoveLocation(udg_MyLocation)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- PreloadCount Equal to 27
- Then - Actions
- Trigger - Run Game Mode Create <gen> (checking conditions)
- Else - Actions
- Trigger - Run Preload Items3 <gen> (checking conditions)
- If - Conditions
- Events
JASS:
function Trig_Preload_Items3_Copy_Func001001 takes nothing returns boolean
return ( udg_PreloadCount == 0 )
endfunction
function Trig_Preload_Items3_Copy_Func006001002 takes nothing returns boolean
return ( GetItemType(GetFilterItem()) == ITEM_TYPE_PERMANENT )
endfunction
function Trig_Preload_Items3_Copy_Func007001002 takes nothing returns boolean
return ( GetItemType(GetFilterItem()) == ITEM_TYPE_PERMANENT )
endfunction
function Trig_Preload_Items3_Copy_Func008001002 takes nothing returns boolean
return ( GetItemType(GetFilterItem()) == ITEM_TYPE_PERMANENT )
endfunction
function Trig_Preload_Items3_Copy_Func009001002 takes nothing returns boolean
return ( GetItemType(GetFilterItem()) == ITEM_TYPE_CHARGED )
endfunction
function Trig_Preload_Items3_Copy_Func012C takes nothing returns boolean
if ( not ( udg_PreloadCount == 27 ) ) then
return false
endif
return true
endfunction
function Trig_Preload_Items3_Copy_Actions takes nothing returns nothing
if ( Trig_Preload_Items3_Copy_Func001001() ) then
call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_2781" )
else
call DoNothing( )
endif
set udg_PreloadCount = ( udg_PreloadCount + 1 )
set udg_MyLocation = GetRectCenter(GetPlayableMapRect())
call CreateNUnitsAtLoc( 1, 039;Hpal039;, Player(bj_PLAYER_NEUTRAL_EXTRA), udg_MyLocation, bj_UNIT_FACING )
call UnitAddItemSwapped( RandomItemInRectBJ(gg_rct_Item_Region, Condition(function Trig_Preload_Items3_Copy_Func006001002)), GetLastCreatedUnit() )
call UnitAddItemSwapped( RandomItemInRectBJ(gg_rct_Item_Region, Condition(function Trig_Preload_Items3_Copy_Func007001002)), GetLastCreatedUnit() )
call UnitAddItemSwapped( RandomItemInRectBJ(gg_rct_Item_Region, Condition(function Trig_Preload_Items3_Copy_Func008001002)), GetLastCreatedUnit() )
call UnitAddItemSwapped( RandomItemInRectBJ(gg_rct_Item_Region, Condition(function Trig_Preload_Items3_Copy_Func009001002)), GetLastCreatedUnit() )
call RemoveUnit( GetLastCreatedUnit() )
call RemoveLocation(udg_MyLocation)
if ( Trig_Preload_Items3_Copy_Func012C() ) then
call ConditionalTriggerExecute( gg_trg_Game_Mode_Create )
else
call ConditionalTriggerExecute( gg_trg_Preload_Items3 )
endif
endfunction
//===========================================================================
function InitTrig_Preload_Items takes nothing returns nothing
set gg_trg_Preload_Items = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Preload_Items, 0.01 )
call TriggerAddAction( gg_trg_Preload_Items, function Trig_Preload_Items3_Copy_Actions )
endfunction