function Trig_Accel_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A03T' )
endfunction
function Trig_Accel_Actions takes nothing returns nothing
// Spell Data
local unit caster = GetSpellAbilityUnit()
local integer level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), caster)
local location target = GetSpellTargetLoc()
// Editable Parameters - CHANGE FOR BALANCE
// Time is 2 except for level 4, then it's 1.5
local real time = RMinBJ(2, 3.5 - level * 0.5)
local real interval = 0.2
local real maxspeed = 10
local real speedinc = (510-162) * interval / time
local real increment = maxspeed * interval / time
local real distance = 900 + 750 * level
local real effectSpeed = 8 + (2 * level)
// Variables
local location newTarget = target
local real cSpeed = 0
// Calculate true target point
if(DistanceBetweenPoints(target, GetUnitLoc(caster)) > distance) then
set newTarget = PolarProjectionBJ(GetUnitLoc(caster), distance, AngleBetweenPoints(GetUnitLoc(caster), target))
endif
// If you want to have terrain restrictions, add a check here.
// Begin Spell
call SetUnitMoveSpeed(caster, 162)
call SetUnitPathing(caster, false)
// Accelerate
loop
exitwhen cSpeed >= maxspeed
call SetUnitMoveSpeed(caster, 162 + speedinc*cSpeed)
if(GetUnitCurrentOrder(caster) != OrderId("move")) then
call IssuePointOrderLoc(caster, "move", newTarget)
endif
call SetUnitTimeScale(caster, cSpeed)
set cSpeed = cSpeed + increment
call TriggerSleepAction(interval)
endloop
// Warp and add effects
call SetUnitPathing(caster, true)
// call EffectMoveLoc("Doodads\\Cinematic\\TownBurningFireEmitter\\TownBurningFireEmitter.mdl", GetUnitLoc(caster), newTarget, effectSpeed)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetUnitLoc(caster)))
call SetUnitPositionLoc(caster, newTarget)
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetUnitLoc(caster)))
// Order a continued move towards original target point
call IssuePointOrderLoc(caster, "move", target)
// Wait for speeddown
call TriggerSleepAction(I2R(level) * 2)
// Reset Speed and Animation
call SetUnitMoveSpeed(caster, GetUnitDefaultMoveSpeed(caster))
call SetUnitTimeScale(caster, 1)
// Cleanup
call RemoveLocation(target)
call RemoveLocation(newTarget)
set newTarget = null
set target = null
endfunction
Name | Type | is_array | initial_value |
bWarned100 | boolean | Yes | |
bWarned50 | boolean | Yes | |
CastingUnit | unit | No | |
DayNumber | integer | No | 1 |
DeactivatedPhalanx | group | No | |
EastFortsOwned | integer | No | |
EastPGroup | force | No | |
EastPowerLeft | integer | No | 500 |
EastPowerLeftReal | real | No | 500.00 |
EffectPosition | location | No | |
FortDifference | integer | No | |
GenericPoint | location | No | |
GoldtoGive | integer | No | |
LocalUnit | unit | No | |
numSpecialties | integer | Yes | |
PowerMulti | multiboard | No | |
SetRegion | rect | No | |
WestFortsOwned | integer | No | |
WestPGroup | force | No | |
WestPowerLeft | integer | No | 500 |
WestPowerLeftReal | real | No | 500.00 |
function Trig_Push_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A02H' )
endfunction
//Called from the loop, determines the action to take on push back
function PushResult takes nothing returns nothing
local location targetofpush = PolarProjectionBJ(GetUnitLoc(GetEnumUnit()), 65.00, AngleBetweenPoints(udg_EffectPosition, GetUnitLoc(GetEnumUnit())))
if(IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == false) then
if ( IsTerrainPathableBJ(targetofpush, PATHING_TYPE_WALKABILITY ) == true) then
call UnitDamageTargetBJ(udg_CastingUnit, GetEnumUnit(), 60.00, ATTACK_TYPE_SIEGE, DAMAGE_TYPE_NORMAL )
call AddSpecialEffectTargetUnitBJ( "chest", GetEnumUnit(), "Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl" )
call SetUnitPositionLoc( GetEnumUnit(), targetofpush )
else
call SetUnitPositionLoc( GetEnumUnit(), targetofpush )
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" )
endif
else
endif
endfunction
function Trig_Push_Actions takes nothing returns nothing
// The spell is instant and only has one level
// so it always goes to a specified distance
// variables set to constants are generally for readability
// and editability
local real waittime = 0.1
local real enddistance = 700
local real currentdistance = 0
local real effectspeed = 100
local unit caster = GetSpellAbilityUnit()
local location casterpos = GetUnitLoc(caster)
local lightning Leffect
local unit effect_unit
local location effect_pos
//create the unit that will serve as the location of the lightning effect
call CreateNUnitsAtLoc( 1, 'u005', GetOwningPlayer(caster), GetUnitLoc(caster), GetUnitFacing(caster) )
set effect_unit = GetLastCreatedUnit()
set effect_pos = GetUnitLoc(effect_unit)
call AddLightningLoc( "AFOD", casterpos, effect_pos )
set Leffect = GetLastCreatedLightningBJ()
//Begin Main Spell Loop
loop
exitwhen currentdistance > enddistance
//Move effect_unit to new position
call SetUnitPositionLoc( effect_unit, PolarProjectionBJ(effect_pos, effectspeed, GetUnitFacing(effect_unit)) )
set effect_pos = GetUnitLoc(effect_unit)
call MoveLightningLoc(Leffect, casterpos, effect_pos)
//set for the function call, which doesn't scope the local variables
set udg_CastingUnit = caster
set udg_EffectPosition = effect_pos
call ForGroupBJ( GetUnitsInRangeOfLocAll(150.00, effect_pos), function PushResult)
set currentdistance = DistanceBetweenPoints(effect_pos, casterpos)
call TriggerSleepAction(waittime)
endloop
//Kill lightning
call DestroyLightningBJ(Leffect)
//Remove Effect_Unit
call RemoveUnit(effect_unit)
endfunction
//===========================================================================
function InitTrig_Push takes nothing returns nothing
set gg_trg_Push = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Push, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Push, Condition( function Trig_Push_Conditions ) )
call TriggerAddAction( gg_trg_Push, function Trig_Push_Actions )
endfunction