function Print takes string str returns nothing
call DisplayTextToForce( GetPlayersAll(), str )
set str = null
endfunction
function PushPullCon takes nothing returns gamecache
return InitGameCacheBJ( "PushNPull.w3v" )
endfunction
function SetReal takes real val, string x, string y, gamecache gc returns nothing
call StoreRealBJ( val, y, x,gc)
endfunction
function SetBool takes boolean val, string x, string y, gamecache gc returns nothing
call StoreBooleanBJ( val, y, x,gc)
endfunction
function GetReal takes string x, string y, gamecache gc returns real
return GetStoredRealBJ(y, x, gc)
endfunction
function GetBool takes string x, string y, gamecache gc returns boolean
return GetStoredBooleanBJ(y, x, gc)
endfunction
function SetReal2 takes real val, string x, string y, gamecache gc returns nothing
local gamecache gc = PushPullCon()
call StoreRealBJ( val, y, x,gc)
call SetBool(true,"DirBool",x,gc)
endfunction
function ClearControls2 takes nothing returns nothing
local gamecache gc = PushPullCon()
local integer i = 0
local unit whichUnit = null
if GetBool("GLOBAL","CINEMATIC",gc) == false then
call SetBool(true,"GLOBAL","CINEMATIC",gc)
call Print("DEBUG::LOCKED")
else
call SetBool(false,"GLOBAL","CINEMATIC",gc)
call Print("DEBUG::UNLOCKED")
endif
loop
exitwhen i > 4
set whichUnit = udg_Ship[i]
call IssueImmediateOrderBJ( whichUnit, "stop" )
call SetUnitFacingTimed( whichUnit, 90, 0 )
set i = i + 1
endloop
set whichUnit = null
endfunction
function Done takes nothing returns nothing
local integer i = 0
call DestroyMultiboard(udg_mult)
call ClearTextMessagesBJ( GetPlayersAll() )
call DisplayTextToForce( GetPlayersAll(), ( "|cffffcc00VICTORY|r") )
call DisplayTextToForce( GetPlayersAll(), ( "Thanks for playing StarforceMA version: |cffffcc00" + udg_version + "|r") )
call DisplayTextToForce( GetPlayersAll(), ( "Game ends in 10 seconds") )
call TriggerSleepAction( 10.00 )
loop
exitwhen i > 4
call CustomVictoryBJ( Player(i), false, true )
set i = i + 1
endloop
endfunction
function DeathReset takes nothing returns boolean
local integer i = 0
loop
exitwhen i > udg_pCount
if udg_Lifes[i] > -1 and udg_isPlaying[i+1] then
return false
endif
set i = i + 1
endloop
return true
endfunction
function KillN takes nothing returns nothing
if 'e000' != GetUnitTypeId(GetEnumUnit()) then
call KillUnit( GetEnumUnit() )
endif
endfunction
function FooBar takes nothing returns nothing
local group g = GetUnitsOfPlayerAll(Player(8))
call ForGroupBJ( g, function KillN )
call DestroyGroup(g)
set g = null
endfunction
function NewRound takes nothing returns nothing
call DisableTrigger( gg_trg_EnemyAi )
set udg_WaveCount = udg_WaveCount + 1
call DisplayTextToForce( GetPlayersAll(), ( "Round: |cffffcc00" + I2S(udg_WaveCount) + "|r complete") )
set udg_SZ = udg_EnemySz[udg_WaveCount]
call FooBar()
call TriggerSleepAction( 1 )
call EnableTrigger( gg_trg_EnemyAi )
endfunction
function SetInt takes integer val, string x, string y, gamecache gc returns nothing
call StoreIntegerBJ( val, x, y,gc)
endfunction
function GetInt takes string x, string y, gamecache gc returns integer
return GetStoredIntegerBJ(x, y, gc)
endfunction
function I2T takes integer i returns timer
return i
return null
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function H2I takes handle h returns integer
return h
return 0
endfunction
function SnakeRect takes nothing returns rect
return gg_rct_Circulate
endfunction
function SnakeType takes nothing returns integer
return 'e001'
endfunction
function SnakeCon takes nothing returns gamecache
return InitGameCacheBJ( "Snake.w3v" )
endfunction
function Explode takes nothing returns nothing
call ExplodeUnitBJ( GetEnumUnit() )
endfunction
function I2G takes integer i returns group
return i
return null
endfunction
function I2P takes integer i returns player
return i
return null
endfunction
function SnakeMove takes nothing returns nothing
local gamecache gc = SnakeCon()
local timer this = GetExpiredTimer()
local integer Id = GetInt(I2S(H2I(this)),"SnakeMove",gc)
local unit whichUnit = I2U(GetInt(I2S(Id),"SnakeId",gc))
local group g = I2G(GetInt(I2S(Id),"SnakeGroup",gc))
local group g2 = I2G(GetInt(I2S(Id),"SnakeGroup2",gc))
local location l = null
local location l2 = null
local integer i = 0
local integer max = CountUnitsInGroup(g)
local real fac = GetUnitFacing(whichUnit) + 180.00
local unit tmp = null
call GroupClear( g2 )
call GroupAddGroup( g, g2)
loop
exitwhen i > max
set tmp = FirstOfGroup(g2)
set l = GetUnitLoc(whichUnit)
set l2 = PolarProjectionBJ(l, 40, fac )
call SetUnitPositionLoc( tmp,l2)
call GroupRemoveUnitSimple( tmp, g2 )
call RemoveLocation(l)
call RemoveLocation(l2)
set whichUnit = tmp
set i = i + 1
endloop
call RemoveLocation(l)
call RemoveLocation(l2)
set l = null
set l2 = null
endfunction
function SnakeActions takes nothing returns nothing
local gamecache gc = SnakeCon()
local timer this = GetExpiredTimer()
local integer thisId = H2I(this)
local unit whichUnit = I2U(GetInt(I2S(thisId),"SnakeId",gc))
local group g = I2G(GetInt(I2S(thisId),"SnakeGroup",gc))
local player p = I2P(GetInt(I2S(thisId),"SnakePlayer",gc))
local integer sz = GetInt(I2S(thisId),"SnakeSz",gc)
local location l = null
local location l2 = null
local integer max = CountUnitsInGroup(g)
local unit tmp = null
if max < sz then
set l = GetUnitLoc(whichUnit)
set l2 = PolarProjectionBJ(l, 10, GetUnitFacing(whichUnit) + 180.00 )
set tmp = CreateUnitAtLocSaveLast(p, 'e002', l2, 0.00)
call GroupAddUnitSimple( tmp, g )
call UnitAddAbilityBJ( 'Aloc', tmp )
call UnitAddAbilityBJ( 'A001', tmp )
call RemoveLocation(l)
call RemoveLocation(l2)
endif
set l = GetRandomLocInRect(SnakeRect())
call IssuePointOrderLocBJ( whichUnit, "move", l )
call RemoveLocation(l)
endfunction
function SnakeDestroy takes nothing returns nothing
local gamecache gc = SnakeCon()
local unit this = GetTriggerUnit()
local integer HeadId = H2I(this)
local integer T2Id = GetInt(I2S(HeadId),"SnakeMove",gc)
local integer Id = GetInt(I2S(HeadId),"SnakeHead",gc)
local integer GId = GetInt(I2S(Id),"SnakeGroup",gc)
local timer whichTimer = I2T(Id)
local timer whichTimer2 = I2T(T2Id)
local string SID = I2S(Id)
local group g = I2G(GId)
if whichTimer != null then
call ExplodeUnitBJ( this )
call IssueImmediateOrderBJ( this, "stop" )
call ForGroupBJ( g, function Explode )
call DestroyTimer(whichTimer)
call DestroyTimer(whichTimer2)
call DestroyGroup(g)
set g = null
set whichTimer = null
set whichTimer2 = null
call FlushStoredInteger(gc,"SnakeSz",SID)
call FlushStoredInteger(gc,"SnakePlayer",SID)
call FlushStoredInteger(gc,"SnakeGroup",SID)
call FlushStoredInteger(gc,"SnakeId",SID)
call FlushStoredInteger(gc,"SnakeHead",I2S(HeadId))
call FlushStoredInteger(gc,"SnakeMove",I2S(HeadId))
endif
endfunction
function SnakeCreate takes player whichPlayer, location loc, integer sz, real speed returns nothing
local gamecache gc = SnakeCon()
local timer t = CreateTimer()
local timer t2 = CreateTimer()
local group g = CreateGroup()
local group g2 = CreateGroup()
local unit head = CreateUnitAtLocSaveLast(whichPlayer, SnakeType(), loc, 0.00)
local integer headId = H2I(head)
local integer GId = H2I(g)
local integer PId = H2I(whichPlayer)
local integer Id = H2I(t)
local string SID = I2S(Id)
call SetInt(sz,SID,"SnakeSz",gc)
call SetInt(PId,SID,"SnakePlayer",gc)
call SetInt(GId,SID,"SnakeGroup",gc)
call SetInt(H2I(g2),SID,"SnakeGroup2",gc)
call SetInt(headId,SID,"SnakeId",gc)
call SetInt(Id,I2S(headId),"SnakeHead",gc)
call SetInt(H2I(t2),I2S(headId),"SnakeMove",gc)
call SetInt(Id,I2S(H2I(t2)),"SnakeMove",gc)
call TimerStart(t, speed, true, function SnakeActions )
call TimerStart(t2, .05, true, function SnakeMove )
endfunction
/////////////
function movin takes nothing returns nothing
local gamecache gc = PushPullCon()
local unit whichUnit = null
local location loc = null
local location moveTo = null
local integer i = 0
local integer idx = 0
local integer idx = 0
local boolean b
local string str
local real dst = GetReal("Mov","Dir",gc)
local real x = 0
local real y = 0
if GetBool("GLOBAL","CINEMATIC",gc) == false then
loop
exitwhen i > 4
set whichUnit = udg_Ship[i]
set idx = GetInt(I2S(i),"DirPlayer",gc)
set str = I2S(idx)
set b = GetBool("DirBool",str,gc)
if b then
set loc = GetUnitLoc(whichUnit)
set moveTo = PolarProjectionBJ(loc, dst, GetReal(str,"Dir",gc))
if RectContainsLoc(gg_rct_Arena, moveTo) then
call IssuePointOrderLoc( whichUnit, "move", moveTo )
else//Okay lets put it in bounds
set x = GetLocationX(moveTo)
set y = GetLocationY(moveTo)
if x < udg_XMin then
set x = udg_XMin
elseif x > udg_XMax then
set x = udg_XMax
endif
if y < udg_YMin then
set y = udg_YMin
elseif y > udg_YMax then
set y = udg_YMax
endif
call RemoveLocation(moveTo)
set moveTo = Location(x,y)
call IssuePointOrderLoc( whichUnit, "move", moveTo )
endif
call RemoveLocation(loc)
call RemoveLocation(moveTo)
endif
set i = i + 1
endloop
endif
set str = null
set loc = null
set moveTo = null
endfunction
Name | Type | is_array | initial_value |
Boss | unit | No | |
Controls | quest | No | |
Credits | quest | No | |
DeathsArr | integer | Yes | |
DebugTimer | timer | No | |
Dist | real | No | 210.00 |
EnemyArr | unitcode | Yes | |
EnemyGet | string | Yes | |
EnemySz | integer | Yes | |
FIELD | rect | No | |
FirstTime | timer | No | |
idx | integer | No | |
inRange | trigger | Yes | |
isPlaying | boolean | Yes | |
Lifes | integer | Yes | 0 |
MoveTimer | timer | No | |
mult | multiboard | No | |
pArr | integer | Yes | 5 |
pArr2 | integer | Yes | 5 |
pCount | integer | No | |
Point1 | location | No | |
PointValue | integer | Yes | |
q | integer | No | |
r | integer | No | |
resetLifeVal | integer | No | 5 |
resetVal | integer | No | 0 |
select | trigger | Yes | |
Ship | unit | Yes | |
SpawnTimer | timer | No | |
StarSpawn | group | No | |
StarTimer | timer | No | |
SZ | integer | No | |
tmp | location | No | |
trg_wave | trigger | Yes | |
version | string | No | 1.05 |
WaveCount | integer | No | |
XMatrix | real | Yes | |
XMax | real | No | |
XMin | real | No | |
YMatrix | real | Yes | |
YMax | real | No | |
YMin | real | No |
function Trig_StarSpawn_Func002A takes nothing returns nothing
call UnitAddAbilityBJ( 'Aloc', GetEnumUnit() )
endfunction
function Trig_StarSpawn_Actions takes nothing returns nothing
set udg_StarSpawn = GetUnitsInRectAll(gg_rct_StarSpawn)
call ForGroupBJ( udg_StarSpawn, function Trig_StarSpawn_Func002A )
endfunction
//===========================================================================
function InitTrig_StarSpawn takes nothing returns nothing
set gg_trg_StarSpawn = CreateTrigger( )
call TriggerAddAction( gg_trg_StarSpawn, function Trig_StarSpawn_Actions )
endfunction
function Trig_CamView_Actions takes nothing returns nothing
local unit whichUnit = FirstOfGroup(udg_StarSpawn)
local location loc1 = GetRandomLocInRect(gg_rct_TopSpawn)
local location loc2 = null
local location loc3 = null
local real n=GetRandomReal(20, 100)
local integer i = 0
loop
exitwhen i > 4
call CameraSetupApplyForPlayer( true, gg_cam_GameScreen, Player(i), 0 )
set i = i + 1
endloop
call SetUnitPositionLoc( whichUnit, loc1)
set loc2 = GetUnitLoc(whichUnit)
set loc3 = PolarProjectionBJ(loc2,5000,270)
call SetUnitVertexColorBJ(whichUnit, n, n, n, 50)
set n=GetRandomReal(2, 12)
call SetUnitScalePercent(whichUnit, n, n, n)
call SetUnitMoveSpeed(whichUnit, GetRandomReal(90, 350))
call IssuePointOrderLoc( whichUnit, "move", loc3 )
call GroupRemoveUnitSimple( whichUnit,udg_StarSpawn)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
set loc1 = null
set loc2 = null
set loc3 = null
set whichUnit = null
endfunction
function InitTrig_stars takes nothing returns nothing
set gg_trg_stars = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_stars, udg_StarTimer )
call TriggerAddAction( gg_trg_stars, function Trig_CamView_Actions )
endfunction
function StarCon takes nothing returns boolean
return GetUnitTypeId(GetLeavingUnit()) == 'e000'
endfunction
function Trig_Unitouts_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_StarSpawn)
local unit whichUnit = GetTriggerUnit()
call SetUnitScalePercent(whichUnit, 100.00,100.00,100.00)
call SetUnitPositionLoc( whichUnit, loc)
call GroupAddUnitSimple( whichUnit, udg_StarSpawn )
call RemoveLocation(loc)
set loc = null
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_starRecycle takes nothing returns nothing
set gg_trg_starRecycle = CreateTrigger( )
call TriggerAddCondition( gg_trg_starRecycle, Condition( function StarCon ) )
call TriggerAddAction( gg_trg_starRecycle, function Trig_Unitouts_Actions )
endfunction
function Trig_launch_Actions takes nothing returns nothing
local texttag tt = null
local unit whichUnit = GetTriggerUnit()
if GetHeroLevel(whichUnit) == 2then
call UnitAddAbilityBJ( 'A00A', whichUnit )
set tt = CreateTextTagUnitBJ( "New Ability. Uses hotkey 'E'", whichUnit, 0, 10, 0.00, 100.00, 0.00, 0 )
call SetTextTagVelocityBJ( tt, 64, 90 )
call TriggerSleepAction( 2 )
call DestroyTextTagBJ( tt )
endif
set whichUnit = null
set tt = null
endfunction
//===========================================================================
function InitTrig_launch takes nothing returns nothing
set gg_trg_launch = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_launch, EVENT_PLAYER_HERO_LEVEL )
call TriggerAddAction( gg_trg_launch, function Trig_launch_Actions )
endfunction
function Trig_gameGone_Actions takes nothing returns nothing
local integer pid = GetPlayerId(GetTriggerPlayer())
call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(GetTriggerPlayer()) + " has left the game!" ) )
set udg_Lifes[pid] = -1
call RemoveUnit( udg_Ship[pid] )
endfunction
//===========================================================================
function InitTrig_gameGone takes nothing returns nothing
set gg_trg_gameGone = CreateTrigger( )
call TriggerRegisterPlayerEventLeave( gg_trg_gameGone, Player(0) )
call TriggerRegisterPlayerEventLeave( gg_trg_gameGone, Player(1) )
call TriggerRegisterPlayerEventLeave( gg_trg_gameGone, Player(2) )
call TriggerRegisterPlayerEventLeave( gg_trg_gameGone, Player(3) )
call TriggerAddAction( gg_trg_gameGone, function Trig_gameGone_Actions )
endfunction
function Trig_OrderCatch_Conditions takes nothing returns boolean
return GetIssuedOrderIdBJ() == String2OrderIdBJ("smart")
endfunction
function Trig_OrderCatch_Actions takes nothing returns nothing
local gamecache gc = PushPullCon()
local integer pid = GetPlayerId(GetTriggerPlayer())
local unit whichUnit = udg_Ship[pid]
local location moveTo = GetOrderPointLoc()
local real x = GetLocationX(moveTo)
local real y = GetLocationY(moveTo)
local real x1 = x
local real y1 = y
if x < udg_XMin then
set x = udg_XMin
elseif x > udg_XMax then
set x = udg_XMax
endif
if y < udg_YMin then
set y = udg_YMin
elseif y > udg_YMax then
set y = udg_YMax
endif
call RemoveLocation(moveTo)
if x1 != x or y1 != y then
set moveTo = Location(x,y)
call IssuePointOrderLoc( whichUnit, "move", moveTo )
call RemoveLocation(moveTo)
endif
set moveTo = null
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_OrderCatch takes nothing returns nothing
set gg_trg_OrderCatch = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_OrderCatch, Player(0), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_OrderCatch, Player(1), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_OrderCatch, Player(2), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_OrderCatch, Player(3), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( gg_trg_OrderCatch, Condition( function Trig_OrderCatch_Conditions ) )
call TriggerAddAction( gg_trg_OrderCatch, function Trig_OrderCatch_Actions )
endfunction
function Credit takes string str, string str2 returns nothing
call DisplayTextToForce( GetPlayersAll(), "|cff00ccff" + str + "|r: " + str2)
set str = null
endfunction
function Trig_Time_Actions takes nothing returns nothing
call Print("Use |cff00ccffarrow keys|r to move and |cff00ccffw|r to shoot.")
call TriggerSleepAction( 5.00 )
call ClearTextMessagesBJ( GetPlayersAll() )
call Credit("Lavarinth","Beholder Voice(s)")
call Credit("Electromancer","Pilot Voice(s)")
call Credit("Mantisscreamer","Interface")
call Credit("Cookie","Beholder Model")
call Credit("Xaran Alamas","Goblin Ship Model")
call Credit("Blizzard","Starcraft Sounds")
call TriggerSleepAction( 5.00 )
call ClearTextMessagesBJ( GetPlayersAll() )
call Print("Special Thanks to:")
call Credit("Mr.Thermistor","For making the original space map")
call Print("Check it out at |cff008000http://www.spiderserver.com/file/wc3/starforce.w3x|r")
call TriggerSleepAction( 5.00 )
call ClearTextMessagesBJ( GetPlayersAll() )
call Print("Very Special Thanks to:")
call Credit("Ricky Honejasi","Main Tester")
call TriggerSleepAction( 5.00 )
call ClearTextMessagesBJ( GetPlayersAll() )
call Credit("Aiursrage2k","Everything else")
endfunction
//===========================================================================
function InitTrig_Time takes nothing returns nothing
set gg_trg_Time = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Time, 2 )
call TriggerAddAction( gg_trg_Time, function Trig_Time_Actions )
endfunction
function Trig_DirMatrix_Actions takes nothing returns nothing
//Null
set udg_XMatrix[0] = 0.00
set udg_YMatrix[0] = 0.00
//Up
set udg_XMatrix[1] = 0.00
set udg_YMatrix[1] = udg_Dist
//Down
set udg_XMatrix[2] = 0.00
set udg_YMatrix[2] = -1 * udg_Dist
//Left
set udg_XMatrix[3] = ( -1.00 * udg_Dist )
set udg_YMatrix[3] = 0.00
//Right
set udg_XMatrix[4] = ( 1.00 * udg_Dist )
set udg_YMatrix[4] = 0.00
//Star Timer
call StartTimerBJ( udg_StarTimer, true, .513)
//Enemy Timer
call StartTimerBJ( udg_SpawnTimer, true, 0.61)
call StartTimerBJ( udg_DebugTimer, true, 1.23)
endfunction
//===========================================================================
function InitTrig_DirMatrix takes nothing returns nothing
set gg_trg_DirMatrix = CreateTrigger( )
call TriggerAddAction( gg_trg_DirMatrix, function Trig_DirMatrix_Actions )
endfunction
function Boss1B takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h008', Player(8), GetRectCenter(gg_rct_Arena), bj_UNIT_FACING )
set udg_Boss = GetLastCreatedUnit()
call TriggerExecute( gg_trg_BeholderEnter )
call TriggerRegisterUnitEvent( gg_trg_BeholderDie, udg_Boss, EVENT_UNIT_DEATH )
call DestroyTrigger( udg_trg_wave[7] )
endfunction
function Trig_Reset_Actions takes nothing returns nothing
set udg_WaveCount = udg_resetVal
set udg_r = 0
call TriggerSleepAction( 1.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 4
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call ReviveHeroLoc( udg_Ship[( GetForLoopIndexA() - 1 )], PolarProjectionBJ(GetRectCenter(gg_rct_Spawn), ( I2R(( -2 + GetForLoopIndexA() )) * 127.00 ), 0), false )
set udg_PointValue[( GetForLoopIndexA() + 1 )] = 0
set udg_Lifes[GetForLoopIndexA()-1] = udg_resetLifeVal
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call TriggerSleepAction( 0.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 4
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call SetHeroXP( udg_Ship[( GetForLoopIndexA() - 1 )], 0, false )
call SetHeroLevelBJ( udg_Ship[( GetForLoopIndexA() - 1 )], 1, false )
call SelectUnitForPlayerSingle( udg_Ship[( GetForLoopIndexA() - 1 )], ConvertedPlayer(GetForLoopIndexA()) )
call UnitRemoveAbilityBJ( 'A00A', udg_Ship[( GetForLoopIndexA() - 1 )] )
call SetHeroXP( udg_Ship[( GetForLoopIndexA() - 1 )], 0, false )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set udg_trg_wave[7] =CreateTrigger()
call TriggerAddAction( udg_trg_wave[7], function Boss1B)
call TriggerSleepAction( 0.00 )
call PlaySoundBJ( gg_snd_ilive )
endfunction
//===========================================================================
function InitTrig_Reset takes nothing returns nothing
set gg_trg_Reset = CreateTrigger( )
call TriggerAddAction( gg_trg_Reset, function Trig_Reset_Actions )
endfunction
function DeathCon takes nothing returns boolean
return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO)
endfunction
function DeathAct takes nothing returns nothing
local integer pid = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
set udg_Lifes[pid] = udg_Lifes[pid] - 1
if DeathReset() then
set udg_WaveCount = 0
set udg_r = 0
call FooBar()
call DisableTrigger( gg_trg_Waves )
call DisplayTextToForce( GetPlayersAll(), ( "Mission Failed: Resetting") )
call TriggerSleepAction( 2 )
call TriggerExecute( gg_trg_Reset )
call EnableTrigger( gg_trg_Waves )
endif
endfunction
//===========================================================================
function InitTrig_Death takes nothing returns nothing
local integer i = 0
set gg_trg_Death = CreateTrigger( )
loop
exitwhen i > 4
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Death, Player(i), EVENT_PLAYER_UNIT_DEATH )
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_Death, Condition( function DeathCon ) )
call TriggerAddAction( gg_trg_Death, function DeathAct )
endfunction
function ReviveCon takes nothing returns boolean
return IsUnitType(GetRevivableUnit(), UNIT_TYPE_HERO) == true
endfunction
function ReviveAction takes nothing returns nothing
local integer pIdx = GetPlayerId(GetTriggerPlayer())
local location loc = GetUnitLoc(GetRevivableUnit())
call TriggerSleepAction( 2 )
if udg_Lifes[pIdx] >= 0 then
set udg_Ship[pIdx] = GetRevivableUnit()
call PlaySoundBJ( gg_snd_ilive )
call ReviveHeroLoc( udg_Ship[pIdx],loc, true )
call SetUnitInvulnerable( udg_Ship[pIdx], true )
call SelectUnitForPlayerSingle( udg_Ship[pIdx], Player(pIdx) )
call TriggerSleepAction( 2 )
call SetUnitInvulnerable( udg_Ship[pIdx], false )
endif
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_ReviveShip takes nothing returns nothing
local integer i = 0
set gg_trg_ReviveShip = CreateTrigger( )
loop
exitwhen i > 4
call TriggerRegisterPlayerUnitEventSimple( gg_trg_ReviveShip, Player(i), EVENT_PLAYER_HERO_REVIVABLE )
set i = i + 1
endloop
call TriggerAddAction( gg_trg_ReviveShip, function ReviveAction )
endfunction
function Trig_Up1_Actions takes nothing returns nothing
local texttag tt = null
local unit whichUnit = GetEnteringUnit()
local integer idx = udg_idx
call RemoveUnit( whichUnit )
set udg_Lifes[idx] = udg_Lifes[idx] + 1
call MultiboardSetItemValueBJ( udg_mult, 3, ( udg_pArr[idx] + 1 ), I2S(udg_Lifes[idx]) )
set tt = CreateTextTagUnitBJ( "1 Up", whichUnit, 0, 10, 100, 0.00, 0.00, 0 )
call SetTextTagVelocityBJ( tt, 64, 90 )
call TriggerSleepAction( 1 )
call DestroyTextTagBJ( tt )
set tt = null
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_Up1 takes nothing returns nothing
set gg_trg_Up1 = CreateTrigger( )
call TriggerAddAction( gg_trg_Up1, function Trig_Up1_Actions )
endfunction
function setDir takes integer bit returns nothing
local gamecache gc = PushPullCon()
local player p = GetTriggerPlayer()
local string idx = I2S(GetPlayerId(p))
local unit whichUnit = udg_Ship[GetPlayerId(p)]
local integer f = GetInt(idx,"DirPlayer",gc)+bit
call SetInt(f,idx,"DirPlayer",gc)
if f < 1 then
call IssueImmediateOrderBJ( whichUnit, "stop" )
call SetUnitFacingTimed( whichUnit, 90, 0 )
//call SetInt(0,idx,"DirPlayer",gc)
endif
call movin()
set whichUnit = null
set p = null
endfunction
function goUp takes nothing returns nothing
call setDir(1)
endfunction
function goDown takes nothing returns nothing
call setDir(2)
endfunction
function goLeft takes nothing returns nothing
call setDir(4)
endfunction
function goRight takes nothing returns nothing
call setDir(8)
endfunction
function goUp2 takes nothing returns nothing
call setDir(-1)
endfunction
function goDown2 takes nothing returns nothing
call setDir(-2)
endfunction
function goLeft2 takes nothing returns nothing
call setDir(-4)
endfunction
function goRight2 takes nothing returns nothing
call setDir(-8)
endfunction
function InitControls takes nothing returns nothing
local trigger trgUp = CreateTrigger()
local trigger trgDown = CreateTrigger()
local trigger trgLeft = CreateTrigger()
local trigger trgRight = CreateTrigger()
local trigger trgUp2 = CreateTrigger()
local trigger trgDown2 = CreateTrigger()
local trigger trgLeft2 = CreateTrigger()
local trigger trgRight2 = CreateTrigger()
local integer i = 0
loop
exitwhen i > 11
call TriggerRegisterPlayerKeyEventBJ( trgUp, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_UP )
call TriggerRegisterPlayerKeyEventBJ( trgDown, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_DOWN )
call TriggerRegisterPlayerKeyEventBJ( trgLeft, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_LEFT)
call TriggerRegisterPlayerKeyEventBJ( trgRight, Player(i), bj_KEYEVENTTYPE_DEPRESS, bj_KEYEVENTKEY_RIGHT )
call TriggerRegisterPlayerKeyEventBJ( trgUp2, Player(i), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_UP )
call TriggerRegisterPlayerKeyEventBJ( trgDown2, Player(i), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_DOWN )
call TriggerRegisterPlayerKeyEventBJ( trgLeft2, Player(i), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_LEFT)
call TriggerRegisterPlayerKeyEventBJ( trgRight2, Player(i), bj_KEYEVENTTYPE_RELEASE, bj_KEYEVENTKEY_RIGHT )
set i = i + 1
endloop
call TriggerAddAction( trgUp, function goUp )
call TriggerAddAction( trgDown, function goDown )
call TriggerAddAction( trgLeft, function goLeft )
call TriggerAddAction( trgRight, function goRight )
call TriggerAddAction( trgUp2, function goUp2 )
call TriggerAddAction( trgDown2, function goDown2 )
call TriggerAddAction( trgLeft2, function goLeft2 )
call TriggerAddAction( trgRight2, function goRight2 )
endfunction
//===========================================================================
function InitTrig_Controls_2 takes nothing returns nothing
set gg_trg_Controls_2 = CreateTrigger( )
call TriggerAddAction( gg_trg_Controls_2, function InitControls )
endfunction
function Trig_DirMatrix2_Actions takes nothing returns nothing
local gamecache gc = PushPullCon()
local timer tmp = CreateTimer()
call SetReal(210.00,"Mov","Dir",gc)
call SetReal2(0,"8","Dir",gc)
call SetReal2(45,"9","Dir",gc)
call SetReal2(90,"1","Dir",gc)
call SetReal2(135,"5","Dir",gc)
call SetReal2(180,"4","Dir",gc)
call SetReal2(225,"6","Dir",gc)
call SetReal2(270,"2","Dir",gc)
call SetReal2(315,"10","Dir",gc)
call TimerStart(tmp, .5, true, function movin )
endfunction
//===========================================================================
function InitTrig_DirMatrix_2 takes nothing returns nothing
set gg_trg_DirMatrix_2 = CreateTrigger( )
call TriggerAddAction( gg_trg_DirMatrix_2, function Trig_DirMatrix2_Actions )
endfunction
function BeamCon takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function BeamAct takes nothing returns nothing
local gamecache gc = PushPullCon()
local integer pIdx = GetPlayerId(GetTriggerPlayer())
local unit whichUnit = udg_Ship[pIdx]
local location loc1 = GetUnitLoc(whichUnit)
local real face = GetUnitFacing(whichUnit)
local location loc2 = PolarProjectionBJ(loc1, 10.00, 90)
local location loc3 = PolarProjectionBJ(loc1, 5000.00, 90)
if GetBool("GLOBAL","CINEMATIC",gc) == false then
call CreateNUnitsAtLoc( 1, 'h001', Player(pIdx), loc2, 90)
call SetUnitPathing(GetLastCreatedUnit(),false)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc3 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
set loc1 = null
set loc2 = null
set loc3 = null
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_beamCreate takes nothing returns nothing
local integer i = 0
set gg_trg_beamCreate = CreateTrigger( )
loop
exitwhen i > 4
call TriggerRegisterPlayerUnitEventSimple( gg_trg_beamCreate, Player(i), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_beamCreate, Condition( function BeamCon ) )
call TriggerAddAction( gg_trg_beamCreate, function BeamAct )
endfunction
function BeamCon22 takes nothing returns boolean
return GetSpellAbilityId() == 'A00A'
endfunction
function BeamAct22 takes nothing returns nothing
local gamecache gc = PushPullCon()
local integer pIdx = GetPlayerId(GetTriggerPlayer())
local unit whichUnit = udg_Ship[pIdx]
local location loc1 = GetUnitLoc(whichUnit)
local real face = GetUnitFacing(whichUnit)
local location loc2 = PolarProjectionBJ(loc1, 10.00, 90)
local location loc3 = PolarProjectionBJ(loc1, 5000.00, 90)
if GetBool("GLOBAL","CINEMATIC",gc) == false then
call CreateNUnitsAtLoc( 1, 'h00C', Player(pIdx), loc2, 90)
call SetUnitPathing(GetLastCreatedUnit(),false)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc3 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
set loc1 = null
set loc2 = null
set loc3 = null
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_beamCreate_2 takes nothing returns nothing
local integer i = 0
set gg_trg_beamCreate_2 = CreateTrigger( )
loop
exitwhen i > 4
call TriggerRegisterPlayerUnitEventSimple( gg_trg_beamCreate_2, Player(i), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
set i = i + 1
endloop
call TriggerAddCondition( gg_trg_beamCreate_2, Condition( function BeamCon22 ) )
call TriggerAddAction( gg_trg_beamCreate_2, function BeamAct22 )
endfunction
function Trig_beamRemove_Actions takes nothing returns nothing
local integer id = GetUnitTypeId(GetLeavingUnit())
if id == 'h001' or id == 'h004' or id == 'h007' or id == 'h009' or id == 'h00B' or id == 'h00C' then
call RemoveUnit( GetLeavingUnit() )
endif
if id == 'h008' or id == 'h003' or id == 'h005' or id == 'h002' or id == 'h00A'then
call RemoveUnit( GetLeavingUnit() )
endif
endfunction
//===========================================================================
function InitTrig_removalThis takes nothing returns nothing
set gg_trg_removalThis = CreateTrigger( )
call TriggerAddAction( gg_trg_removalThis, function Trig_beamRemove_Actions )
endfunction
function snakeDestruct takes nothing returns nothing
if GetUnitTypeId(GetTriggerUnit()) == SnakeType() then
call SnakeDestroy()
endif
endfunction
//===========================================================================
function InitTrig_snakeDestruct takes nothing returns nothing
set gg_trg_snakeDestruct = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_snakeDestruct, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_snakeDestruct, function snakeDestruct )
endfunction
function Powerup takes nothing returns nothing
local location loc1 = GetRandomLocInRect(gg_rct_Arena)
call CreateNUnitsAtLoc( 1, 'h006', Player(9),loc1, 270.00 )
endfunction
function PowerupChance takes nothing returns nothing
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(9))
if CountUnitsInGroup(g) < 5 then
if GetRandomInt(0, 10) == 0 then
call Powerup()
endif
endif
call DestroyGroup(g)
set g = null
endfunction
function Wave1 takes nothing returns nothing
local location loc1 = GetRandomLocInRect(gg_rct_TopSpawn)
local location loc2 = OffsetLocation(loc1, 0, -5000)
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call CreateNUnitsAtLoc( 1, udg_EnemyArr[0], Player(8),loc1, 270.00 )
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call DestroyGroup(g)
set g = null
set loc2 = null
set loc1 = null
endfunction
function Wave2 takes nothing returns nothing
local location loc1 = GetRandomLocInRect(gg_rct_TopSpawn)
local location loc2 = GetRandomLocInRect(gg_rct_Circulate)
local location loc3 = Location(GetLocationX(loc1),GetLocationY(loc2))
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call CreateNUnitsAtLoc( 1, udg_EnemyArr[1], Player(8),loc1, 270.00 )
call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", loc3 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call RemoveLocation(loc3)
call DestroyGroup(g)
set g = null
set loc1 = null
set loc2 = null
set loc3 = null
endfunction
function Wave3 takes nothing returns nothing
if GetRandomInt(0, 2) == 0 then
call Wave2()
else
call Wave1()
endif
endfunction
function Wave4 takes nothing returns nothing
local location loc1 = GetRandomLocInRect(gg_rct_TopSpawn)
local location loc2 = GetRandomLocInRect(gg_rct_Arena)
local group g = GetUnitsOfPlayerAndTypeId(Player(8), 'h005')
if CountUnitsInGroup(g) < udg_SZ then
call CreateNUnitsAtLoc( 1, udg_EnemyArr[3], Player(8),loc1, 270.00 )
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2 )
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call DestroyGroup(g)
set g = null
set loc2 = null
set loc1 = null
endfunction
function Wave5 takes nothing returns nothing
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call DestroyGroup(g)
set g = GetUnitsOfPlayerAndTypeId(Player(8), 'h005')
if CountUnitsInGroup(g) < 2 then
call Wave4()
else
call Wave1()
endif
endif
call DestroyGroup(g)
set g = null
endfunction
function Wave6 takes nothing returns nothing
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call DestroyGroup(g)
set g = GetUnitsOfPlayerAndTypeId(Player(8), 'h005')
if CountUnitsInGroup(g) < 2 then
call Wave4()
else
call Wave2()
endif
endif
call DestroyGroup(g)
set g = null
endfunction
function Wave7 takes nothing returns nothing
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call DestroyGroup(g)
set g = GetUnitsOfPlayerAndTypeId(Player(8), 'h005')
if CountUnitsInGroup(g) < 3 then
call Wave4()
else
call Wave3()
endif
endif
call DestroyGroup(g)
set g = null
endfunction
function Boss1 takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h008', Player(8), GetRectCenter(gg_rct_Arena), bj_UNIT_FACING )
set udg_Boss = GetLastCreatedUnit()
call TriggerExecute( gg_trg_BeholderEnter )
call TriggerRegisterUnitEvent( gg_trg_BeholderDie, udg_Boss, EVENT_UNIT_DEATH )
call DestroyTrigger( udg_trg_wave[7] )
endfunction
function Wave8 takes nothing returns nothing
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call DestroyGroup(g)
call SnakeCreate(Player(8),GetRandomLocInRect(SnakeRect()),5,1)
endif
endfunction
function Wave9 takes nothing returns nothing
local location loc1 = GetRandomLocInRect(gg_rct_TopSpawn)
local location loc2 = GetRandomLocInRect(gg_rct_Arena)
local group g = GetUnitsInRectOfPlayer(gg_rct_Arena, Player(8))
if CountUnitsInGroup(g) < udg_SZ then
call DestroyGroup(g)
call CreateNUnitsAtLoc( 1, udg_EnemyArr[9], Player(8),loc1, 270.00 )
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2 )
set g = GetUnitsOfPlayerAndTypeId(Player(8), 'h00A')
if GetRandomInt(0, 2) != 2 then
call Wave2()
else
call Wave8()
endif
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call DestroyGroup(g)
set g = null
set loc2 = null
set loc1 = null
endfunction
function Trig_WavesInit_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 9
set udg_trg_wave[i] = CreateTrigger( )
call TriggerAddAction( udg_trg_wave[i], function PowerupChance )
set i = i + 1
endloop
call TriggerAddAction( udg_trg_wave[0], function Wave1 )
call TriggerAddAction( udg_trg_wave[1], function Wave2 )
call TriggerAddAction( udg_trg_wave[2], function Wave3 )
call TriggerAddAction( udg_trg_wave[3], function Wave4 )
call TriggerAddAction( udg_trg_wave[4], function Wave5 )
call TriggerAddAction( udg_trg_wave[5], function Wave6 )
call TriggerAddAction( udg_trg_wave[6], function Wave7 )
call TriggerAddAction( udg_trg_wave[7], function Boss1 )
call TriggerAddAction( udg_trg_wave[8], function Wave8 )
call TriggerAddAction( udg_trg_wave[9], function Wave9 )
endfunction
//===========================================================================
function InitTrig_WavesInit takes nothing returns nothing
set gg_trg_WavesInit = CreateTrigger( )
call TriggerAddAction( gg_trg_WavesInit, function Trig_WavesInit_Actions )
endfunction
function WavesAct takes nothing returns nothing
call TriggerExecute( udg_trg_wave[udg_WaveCount] )
endfunction
//===========================================================================
function InitTrig_Waves takes nothing returns nothing
set gg_trg_Waves = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_Waves, udg_SpawnTimer )
call TriggerAddAction( gg_trg_Waves, function WavesAct)
endfunction
function Trig_Attck_Doomship_Conditions takes nothing returns boolean
return GetUnitTypeId(GetSpellAbilityUnit()) == 'h003' and GetSpellAbilityId() == 'A007'
endfunction
function Trig_Attck_Doomship_Actions takes nothing returns nothing
local location loc = null
local location loc1 = null
local location loc2 = null
local unit whichUnit = GetSpellAbilityUnit()
set loc = GetUnitLoc(whichUnit)
set loc1 = OffsetLocation(loc, 0, -100)
set loc2 = OffsetLocation(loc1, 0, -5000)
call CreateNUnitsAtLoc( 1, 'h004', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc = null
set loc1 = null
set loc2 = null
endfunction
//===========================================================================
function InitTrig_Attck_Doomship takes nothing returns nothing
set gg_trg_Attck_Doomship = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Attck_Doomship, Player(8), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Attck_Doomship, Condition( function Trig_Attck_Doomship_Conditions ) )
call TriggerAddAction( gg_trg_Attck_Doomship, function Trig_Attck_Doomship_Actions )
endfunction
function Trig_Attck_Doomship_Conditions2 takes nothing returns boolean
return GetUnitTypeId(GetSpellAbilityUnit()) == 'h005' and GetSpellAbilityId() == 'A009'
endfunction
function Trig_Attck_Doomship_Actions2 takes nothing returns nothing
local location loc = null
local location loc1 = null
local location loc2 = null
local unit whichUnit = GetSpellAbilityUnit()
set loc = GetUnitLoc(whichUnit)
set loc1 = OffsetLocation(loc, 0, -100)
set loc2 = OffsetLocation(loc1, 0, -5000)
call CreateNUnitsAtLoc( 1, 'h007', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc = null
set loc1 = null
set loc2 = null
endfunction
//===========================================================================
function InitTrig_Attck_Dragon takes nothing returns nothing
set gg_trg_Attck_Dragon = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Attck_Dragon, Player(8), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Attck_Dragon, Condition( function Trig_Attck_Doomship_Conditions2 ) )
call TriggerAddAction( gg_trg_Attck_Dragon, function Trig_Attck_Doomship_Actions2 )
endfunction
function Trig_Attck_Doomship_Conditions3 takes nothing returns boolean
return GetUnitTypeId(GetSpellAbilityUnit()) == 'h008' and GetSpellAbilityId() == 'A008'
endfunction
function Trig_Attck_Doomship_Actions3 takes nothing returns nothing
local location loc = null
local location loc1 = null
local location loc2 = null
local unit whichUnit = GetSpellAbilityUnit()
set loc = GetUnitLoc(whichUnit)
set loc1 = OffsetLocation(loc, 0, -100)
set loc2 = OffsetLocation(loc1, 0, -5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc = GetUnitLoc(whichUnit)
set loc1 = OffsetLocation(loc, -150, -150)
set loc2 = OffsetLocation(loc1, -5000, -5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, 0, 100)
set loc2 = OffsetLocation(loc1, 0, 5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, 150, 150)
set loc2 = OffsetLocation(loc1, 5000, 5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, -100, 0)
set loc2 = OffsetLocation(loc1, -5000, 0)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, -150, 150)
set loc2 = OffsetLocation(loc1, -5000, 5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, 100, 0)
set loc2 = OffsetLocation(loc1, 5000, 0)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = OffsetLocation(loc, 150, -150)
set loc2 = OffsetLocation(loc1, 5000, -5000)
call CreateNUnitsAtLoc( 1, 'h009', Player(8), loc1, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set whichUnit = null
set loc = null
set loc1 = null
set loc2 = null
endfunction
//===========================================================================
function InitTrig_Attck_Beholder takes nothing returns nothing
set gg_trg_Attck_Beholder = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Attck_Beholder, Player(8), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Attck_Beholder, Condition( function Trig_Attck_Doomship_Conditions3 ) )
call TriggerAddAction( gg_trg_Attck_Beholder, function Trig_Attck_Doomship_Actions3 )
endfunction
function Trig_Attck_Doomship_Conditions4 takes nothing returns boolean
return GetUnitTypeId(GetSpellAbilityUnit()) == 'h00A' and GetSpellAbilityId() == 'A009'
endfunction
function Trig_Attck_Doomship_Actions4 takes nothing returns nothing
local location loc = null
local location loc1 = null
local location loc2 = null
local unit whichUnit = GetSpellAbilityUnit()
local real rand = 0.00
set loc = GetUnitLoc(whichUnit)
set loc1 = GetUnitLoc(udg_Ship[udg_pArr[GetRandomInt(0,udg_pCount)]])
set rand = AngleBetweenPoints(loc, loc1)
set loc2 = PolarProjectionBJ(loc1,5000,rand)
call CreateNUnitsAtLoc( 1, 'h00B', Player(8), loc, 0)
call IssuePointOrderLoc( GetLastCreatedUnit(), "move", loc2)
call RemoveLocation(loc)
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc = null
set loc1 = null
set loc2 = null
endfunction
//===========================================================================
function InitTrig_Attck_Pytusk takes nothing returns nothing
set gg_trg_Attck_Pytusk = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Attck_Pytusk, Player(8), EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Attck_Pytusk, Condition( function Trig_Attck_Doomship_Conditions4 ) )
call TriggerAddAction( gg_trg_Attck_Pytusk, function Trig_Attck_Doomship_Actions4 )
endfunction
function BeamAct2 takes nothing returns nothing
local unit whichUnit = null
local location loc1 = null
local location loc2 = null
local location loc3 = null
if GetRandomInt(0, 10) == 1 then
set whichUnit = GetEnumUnit()
set loc1 = GetUnitLoc(whichUnit)
set loc2 = GetRandomLocInRect(gg_rct_Circulate)
if RectContainsLoc(gg_rct_Circulate, loc1) then
set loc3 = Location(GetLocationX(loc2),GetLocationY(loc1))
call IssueImmediateOrderBJ( whichUnit, "windwalk" )
call IssuePointOrderLocBJ( whichUnit, "move", loc3 )
call RemoveLocation(loc3)
set loc3 = null
endif
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = null
set loc2 = null
endif
set whichUnit = null
endfunction
function BeamAct3 takes nothing returns nothing
local location rand = null
local unit whichUnit = GetEnumUnit()
call IssueImmediateOrderBJ( whichUnit, "windwalk" )
if GetRandomInt(0, 3) == 1 then
set rand = GetRandomLocInRect(gg_rct_Circulate)
call IssuePointOrderLocBJ( whichUnit, "move", rand )
call RemoveLocation(rand)
set rand = null
set whichUnit = null
endif
endfunction
function BeamAct4 takes nothing returns nothing
local location loc = null
local location loc1 = null
local location loc2 = null
local location rand = null
local unit whichUnit = null
set whichUnit = GetEnumUnit()
call IssueImmediateOrderBJ( whichUnit, "windwalk" )
if GetRandomInt(0, 3) == 1 then
set rand = GetRandomLocInRect(gg_rct_Circulate)
call IssuePointOrderLocBJ( whichUnit, "move", rand )
call RemoveLocation(rand)
set rand = null
endif
set whichUnit = null
endfunction
function BeamAct5 takes nothing returns nothing
local location loc1 = null
local location rand = null
local unit whichUnit = GetEnumUnit()
if GetRandomInt(0, 3) == 1 then
set loc1 = GetUnitLoc(whichUnit)
if RectContainsLoc(gg_rct_Circulate, loc1) then
call IssueImmediateOrderBJ( whichUnit, "windwalk" )
set rand = GetRandomLocInRect(gg_rct_Circulate)
call IssuePointOrderLocBJ( whichUnit, "move", rand )
call RemoveLocation(rand)
set rand = null
endif
call RemoveLocation(loc1)
set loc1 = null
set whichUnit = null
endif
endfunction
function Trig_spawn_Actions takes nothing returns nothing
local group g = GetUnitsOfTypeIdAll('h003')
if g != null then
call ForGroupBJ( g, function BeamAct2 )
call DestroyGroup(g)
set g = null
endif
set g = GetUnitsOfTypeIdAll('h005')
if g != null then
call ForGroupBJ( g, function BeamAct3 )
call DestroyGroup(g)
set g = null
endif
set g = GetUnitsOfTypeIdAll('h008')
if g != null then
call ForGroupBJ( g, function BeamAct4 )
call DestroyGroup(g)
set g = null
endif
set g = GetUnitsOfTypeIdAll('h00A')
if g != null then
call ForGroupBJ( g, function BeamAct5 )
call DestroyGroup(g)
set g = null
endif
endfunction
//===========================================================================
function InitTrig_EnemyAi takes nothing returns nothing
set gg_trg_EnemyAi = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_EnemyAi, udg_SpawnTimer )
call TriggerAddAction( gg_trg_EnemyAi, function Trig_spawn_Actions )
endfunction
function Trig_ClearControls_Actions takes nothing returns nothing
local gamecache gc = PushPullCon()
local integer i = 0
local unit whichUnit = null
if GetBool("GLOBAL","CINEMATIC",gc) == false then
call SetBool(true,"GLOBAL","CINEMATIC",gc)
//call Print("DEBUG::LOCKED")
else
call SetBool(false,"GLOBAL","CINEMATIC",gc)
//call Print("DEBUG::UNLOCKED")
endif
loop
exitwhen i > 4
set whichUnit = udg_Ship[i]
call IssueImmediateOrderBJ( whichUnit, "stop" )
call SetUnitFacingTimed( whichUnit, 90, 0 )
set i = i + 1
endloop
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_ClearControls takes nothing returns nothing
set gg_trg_ClearControls = CreateTrigger( )
call TriggerAddAction( gg_trg_ClearControls, function Trig_ClearControls_Actions )
endfunction
function Trig_Round1_Actions takes nothing returns nothing
local trigger trg = gg_trg_Round1
if GetUnitTypeId(GetDyingUnit()) == 'h002' and udg_WaveCount == 0 then
set udg_r = ( udg_r + 1 )
if ( udg_r >= udg_DeathsArr[udg_WaveCount]) then
call DisableTrigger( trg )
call NewRound()
call TriggerSleepAction( 0.01 )
call EnableTrigger( trg )
set udg_r = 0
endif
endif
endfunction
//===========================================================================
function InitTrig_Round1 takes nothing returns nothing
set gg_trg_Round1 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Round1, Player(8), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Round1, function Trig_Round1_Actions )
endfunction
function Trig_Round2_Actions takes nothing returns nothing
local trigger trg = gg_trg_Round2to3
if GetUnitTypeId(GetDyingUnit()) == 'h003' and udg_WaveCount < 3 then
set udg_r = ( udg_r + 1 )
if ( udg_r >= udg_DeathsArr[udg_WaveCount]) then
call DisableTrigger( trg )
call NewRound()
call TriggerSleepAction( 0.01 )
call EnableTrigger( trg )
set udg_r = 0
endif
endif
endfunction
//===========================================================================
function InitTrig_Round2to3 takes nothing returns nothing
set gg_trg_Round2to3 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Round2to3, Player(8), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Round2to3, function Trig_Round2_Actions )
endfunction
function Trig_Round4_Actions takes nothing returns nothing
local trigger trg = gg_trg_Round4to7
if GetUnitTypeId(GetDyingUnit()) == 'h005' and udg_WaveCount < 8 then
set udg_r = ( udg_r + 1 )
if ( udg_r >= udg_DeathsArr[udg_WaveCount]) then
call DisableTrigger( trg)
call NewRound()
call TriggerSleepAction( 0.01 )
call EnableTrigger( trg )
set udg_r = 0
endif
endif
endfunction
//===========================================================================
function InitTrig_Round4to7 takes nothing returns nothing
set gg_trg_Round4to7 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Round4to7, Player(8), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Round4to7, function Trig_Round4_Actions )
endfunction
function Trig_Round9_Actions takes nothing returns nothing
local trigger trg = gg_trg_Round9
if GetUnitTypeId(GetDyingUnit()) == 'e001' and udg_WaveCount == 8 then
set udg_r = ( udg_r + 1 )
if ( udg_r >= udg_DeathsArr[udg_WaveCount]) then
call DisableTrigger( trg)
call NewRound()
call TriggerSleepAction( 0.01 )
call EnableTrigger( trg )
set udg_r = 0
endif
endif
endfunction
//===========================================================================
function InitTrig_Round9 takes nothing returns nothing
set gg_trg_Round9 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Round9, Player(8), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Round9, function Trig_Round9_Actions )
endfunction
function Trig_Round10_Actions takes nothing returns nothing
local trigger trg = gg_trg_Round10
if GetUnitTypeId(GetDyingUnit()) == 'h00A' and udg_WaveCount == 9 then
set udg_r = ( udg_r + 1 )
if ( udg_r >= udg_DeathsArr[udg_WaveCount]) then
call DisableTrigger( trg)
call NewRound()
call TriggerSleepAction( 0.01 )
call EnableTrigger( trg )
set udg_r = 0
call Done()
endif
endif
endfunction
//===========================================================================
function InitTrig_Round10 takes nothing returns nothing
set gg_trg_Round10 = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Round10, Player(8), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Round10, function Trig_Round10_Actions )
endfunction