Name | Type | is_array | initial_value |
//<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
// Author : CryoniC
//
// Description: Creates the special FX for the nuke
// and calculates the damage given by
// the fallout.
//<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
//=============================================================================================================================================================
// TRIGGER CONDITIONS
//=============================================================================================================================================================
function Trig_NUKE_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSummonedUnit()) == 'e000' ) ) then
return false
endif
return true
endfunction
//=============================================================================================================================================================
// USER CREATED FUNCTIONS
//=============================================================================================================================================================
function GetNukeGameCache takes nothing returns gamecache
return gg_trg_Nuke
return null
endfunction
function StoreNukeGameCache takes nothing returns trigger
return bj_lastCreatedGameCache
return null
endfunction
function TimedSFX_Child takes nothing returns nothing
local effect tempeffect = bj_lastCreatedEffect
call PolledWait(14.00)
call DestroyEffect(tempeffect)
set tempeffect = null
endfunction
function TimedSFX takes location Loc, string Effect, real duration returns nothing
local trigger TimedSFXTrigger = CreateTrigger()
call AddSpecialEffectLocBJ( Loc, Effect )
call TriggerAddAction(TimedSFXTrigger,function TimedSFX_Child)
call TriggerExecute(TimedSFXTrigger)
call DestroyTrigger(TimedSFXTrigger)
set TimedSFXTrigger = null
endfunction
function TimedBlight takes nothing returns nothing
local location Center = Location(GetStoredReal(GetNukeGameCache(), "Nuke", "LocationX" ), GetStoredReal(GetNukeGameCache(), "Nuke", "LocationY" ))
call PolledWait(16.00)
call SetBlightLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), Center, 512.00, false )
call RemoveLocation(Center)
set Center = null
endfunction
function NukeDamage takes nothing returns nothing
call UnitDamageTargetBJ( GetSummonedUnit(),GetEnumUnit(), 175.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_FIRE )
endfunction
function RandomPointInRange takes location Center, real Radius returns location
return PolarProjectionBJ(Center, GetRandomReal(128.00, Radius), GetRandomDirectionDeg())
endfunction
//=============================================================================================================================================================
//MAIN ACTIONS FUNCTION
//=============================================================================================================================================================
function Trig_NUKE_Actions takes nothing returns nothing
local integer k = 0
local location uloc = (GetUnitLoc(GetSummonedUnit()))
local trigger TempTrigger = CreateTrigger()
local player owner = GetOwningPlayer(GetSummonedUnit())
call StoreReal( GetNukeGameCache(), "Nuke", "LocationX", GetLocationX(uloc) )
call StoreReal( GetNukeGameCache(), "Nuke", "LocationY", GetLocationY(uloc) )
call PolledWait( 4.00 )
call SetUnitTimeScalePercent( GetSummonedUnit(), 10.00 )
call SetBlightLoc(Player(12), uloc, 512.00, true)
call TriggerAddAction(TempTrigger,function TimedBlight)
call TriggerExecute(TempTrigger)
call DestroyTrigger(TempTrigger)
set TempTrigger = null
call TerrainDeformCrater(GetLocationX(uloc), GetLocationY(uloc), 512, -160, 50, true)
call TerrainDeformCrater(GetLocationX(uloc), GetLocationY(uloc), 460, 256, 50, true)
set k = 1
loop
exitwhen k > 32
call TimedSFX( RandomPointInRange(uloc, 512.00), "Environment\\UndeadBuildingFire\\UndeadSmallBuildingFire0.mdl", 14.00 )
call TimedSFX( RandomPointInRange(uloc, 512.00), "Environment\\NightElfBuildingFire\\ElfLargeBuildingFire1.mdl", 14.00 )
call TimedSFX( PolarProjectionBJ(uloc, GetRandomReal(384.00, 512.00), (11.25 * I2R(k))), "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl", 14.00 )
set k = k + 1
endloop
set k = 1
loop
exitwhen k > 15
call ForGroupBJ( GetUnitsInRangeOfLocAll(512.00, uloc), function NukeDamage )
call PolledWait( 1.00 )
set k = k + 1
endloop
endfunction
//=============================================================================================================================================================
//MAIN TRIGGER FUNCTION
//=============================================================================================================================================================
function InitTrig_Nuke takes nothing returns nothing
local trigger NukeTrigger = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( NukeTrigger, EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( NukeTrigger, Condition( function Trig_NUKE_Conditions ) )
call TriggerAddAction( NukeTrigger, function Trig_NUKE_Actions )
set bj_lastCreatedGameCache = InitGameCache("Nuke.w3v")
set gg_trg_Nuke = StoreNukeGameCache()
endfunction