scope Test initializer Init
globals
private integer light = 1
private trigger t = CreateTrigger( )
endglobals
// lgh takes nothing returns boolean
// if light == 1 And GetTimeOfDay() >= 6.00 And GetTimeOfDay() <= 18.00 then
// return false
// else
// return true
// endif
//
//endfunction
//function lgh2 takes nothing returns boolean
// if light == 2 And GetTimeOfDay() >= 6.00 And GetTimeOfDay() <= 18.00 then
// return false
// else
// return true
// endif
//
//endfunction
//function lgh3 takes nothing returns boolean
// if light == 2 And GetTimeOfDay() <= 6.00 And GetTimeOfDay() >= 18.00 then
// return false
// else
// return true
// endif
//
//endfunction
function uc takes nothing returns nothing
local player r = Player(0)
local integer foot = 'hfoo'
local integer rife = 'hrif'
local unit re = CreateUnit( r, rife, 1, 655, 288)
local unit f = CreateUnit( r, foot, -1, -655, -288)
local lightning li
// call AddLightningLoc( "SPLK", GetUnitLoc(re), GetUnitLoc(f) )
// Creates a unit for the red player.
// hfoo is the reference footman
// call CreateUnit(r, 'hfoo', 0, 0, 0).....the original create unit. 0,0,0 are coordinates.
// call f..... not needed creates the unit when you declare it
// Don't need to null player types
set f = null
if light == 1 and GetTimeOfDay() >= 6.00 and GetTimeOfDay() <= 18.00 then
// call CreateNUnitsAtLocFacingLocBJ( 1, 'hrif', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) )
call AddLightningLoc( "SPLK", GetUnitLoc(re), GetUnitLoc(f) )
Set li = GetLastCreatedLightningBJ()
// call DestroyLightningBJ( GetLastCreatedLightningBJ() )
call SetLightningColorBJ( GetLastCreatedLightningBJ(), 0.00, 255.00, 0.00, 1 )
set light = 2
else
call DoNothing( )
endif
if light == 2 and GetTimeOfDay() >= 6.00 and GetTimeOfDay() <= 18.00 then
// call CreateNUnitsAtLocFacingLocBJ( 1, 'hrif', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) )
// call AddLightningLoc( "SPLK", GetUnitLoc(GetTriggerUnit()), GetRectCenter(GetPlayableMapRect()) )
// call DestroyLightningBJ( GetLastCreatedLightningBJ() )
// call SetLightningColorBJ( GetLastCreatedLightningBJ(), 0.00, 255.00, 0.00, 1 )
call MoveLightningLoc( li , GetUnitLoc(re), GetUnitLoc(f) )
// set light = 2
else
call DoNothing( )
endif
if light == 2 and GetTimeOfDay() <= 6.00 and GetTimeOfDay() >= 18.00 then
// call CreateNUnitsAtLocFacingLocBJ( 1, 'hrif', Player(0), GetRectCenter(GetPlayableMapRect()), GetUnitLoc(GetTriggerUnit()) )
// call AddLightningLoc( "SPLK", GetUnitLoc(GetTriggerUnit()), GetRectCenter(GetPlayableMapRect()) )
call DestroyLightningBJ( li )
set li = null
// call SetLightningColorBJ( GetLastCreatedLightningBJ(), 0.00, 255.00, 0.00, 1 )
// call MoveLightningLoc( li , GetUnitLoc(re), GetUnitLoc(f) )
// set light = 2
else
call DoNothing( )
endif
endfunction
//===========================================================================
function Init takes nothing returns nothing
set gg_trg_Test_2 = CreateTrigger( )
call TriggerAddAction( gg_trg_Test_2 , function uc )
call TriggerAddAction( gg_trg_Test_2 , function lgh )
endfunction
endscope