Name | Type | is_array | initial_value |
LW_Duration | real | No | |
LW_Integer | integer | No | |
LW_Level | integer | No | |
LW_Loop_Number | integer | No | |
LW_Spawn_Point | location | No | |
LW_Target_Point | location | No | |
LW_Target_Position | location | No | |
LW_Target_Unit | unit | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Lightning_Ward_JASS_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A003'
endfunction
function Trig_Lightning_Ward_JASS_Actions takes nothing returns nothing
local unit LTR = GetTriggerUnit()
local unit LV = GetSpellTargetUnit()
local location LP = GetSpellTargetLoc()
local location LT = GetUnitLoc(LV)
local location LSP
local integer LL = GetUnitAbilityLevel(LTR, 'A003')
local real LD = 5.00 + 5.00 * LL
local integer LI = 1
local unit LU
local real FA = AngleBetweenPoints(LT, LP)
local integer DU = 5
local real Deg = 360/DU
loop
exitwhen LI > DU
set LSP = PolarProjectionBJ(LT, 500.00, LI * Deg)
set LU = CreateUnitAtLoc(GetOwningPlayer(LTR), 'o000', LSP, FA)
call UnitApplyTimedLife(LU, 'BTLF', LD)
call UnitAddAbility(LU, 'A002')
call IssueImmediateOrder(LU, "locustswarm" )
call IssueTargetOrder(LU, "attack", LV )
call RemoveLocation(LSP)
set LU = null
set LI = (LI+1)
endloop
call RemoveLocation(LP)
call RemoveLocation(LT)
set LP = null
set LT = null
set LTR = null
set LV = null
set LSP = null
endfunction
constant function DummyFilter takes nothing returns boolean
return true
endfunction
function Lightning_Ward_JASS takes nothing returns nothing
local trigger T = CreateTrigger()
local integer TI = 0
local filterfunc FF = Filter(function DummyFilter)
loop
exitwhen (TI >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(T, Player(TI), EVENT_PLAYER_UNIT_SPELL_EFFECT, FF)
set TI = TI + 1
endloop
call DestroyFilter(FF)
set FF = null
set T = null
endfunction
//===========================================================================
function InitTrig_Lightning_Ward_JASS takes nothing returns nothing
set gg_trg_Lightning_Ward_JASS = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Ward_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lightning_Ward_JASS, Condition( function Trig_Lightning_Ward_JASS_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Ward_JASS, function Trig_Lightning_Ward_JASS_Actions )
endfunction
//TESH.scrollpos=18
//TESH.alwaysfold=0
library_once LightningWard initializer Init
globals
private constant integer LIGHTNING_WARD = 'A004'
private constant integer DUMMY_RAWCODE = 'o000'
private constant integer SWARM_RAWCODE = 'A002'
private constant real OFFSET_DISTANCE = 500.
private constant integer MAX_WARDS = 5
endglobals
private function LightningWard takes nothing returns boolean
local unit LTU
local unit LV
local player P
local real X
local real Y
local real LD
local integer LI
local unit LU
local real RAD
if (GetSpellAbilityId() == LIGHTNING_WARD) then
set LTU = GetTriggerUnit()
set LV = GetSpellTargetUnit()
set X = GetUnitX(LV)
set Y = GetUnitY(LV)
set LD = (GetUnitAbilityLevel(LTU, LIGHTNING_WARD)*5)+5.
set RAD = (2.*bj_PI)/MAX_WARDS
set P = GetOwningPlayer(LTU)
set LI = 0
loop
exitwhen (LI >= MAX_WARDS)
set LU = CreateUnit(P, DUMMY_RAWCODE, X+OFFSET_DISTANCE*Cos(RAD*LI), Y+OFFSET_DISTANCE*Sin(RAD*LI), 0.)
call UnitApplyTimedLife(LU, 'BTLF', LD)
call UnitAddAbility(LU, SWARM_RAWCODE)
call IssueImmediateOrder(LU, "locustswarm" )
call IssueTargetOrder(LU, "attack", LV)
set LI = LI + 1
endloop
set LU = null
set P = null
set LTU = null
set LV = null
endif
return (FALSE)
endfunction
// ===========================================================================
private constant function DummyFilter takes nothing returns boolean
return true
endfunction
private function Init takes nothing returns nothing
local trigger T = CreateTrigger()
local integer I = 0
local filterfunc FF = Filter(function DummyFilter)
loop
exitwhen (I >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(T, Player(I), EVENT_PLAYER_UNIT_SPELL_EFFECT, FF)
set I = I + 1
endloop
call TriggerAddCondition(T, Condition(function LightningWard))
call DestroyFilter(FF)
set FF = null
set T = null
endfunction
endlibrary
//TESH.scrollpos=6
//TESH.alwaysfold=0
function Trig_Lightning_Ward_JASS_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A003' // At here, we change the id of the ability.
endfunction
function Trig_Lightning_Ward_JASS_Actions takes nothing returns nothing
local unit LTU = GetTriggerUnit() // (LTR = Lightning Trigger Unit) This is where we get the trigger unit.
local unit LV = GetSpellTargetUnit() // (LV = Lightning Victim) At here, this is unit we cast the spells upon it.
local location LP = GetSpellTargetLoc() // (LP = Lightning Point) This is position in which we cast the spells upon it.
local location LT = GetUnitLoc(LV) // (LT = Lightning Target) This is where we get the position of the unit we cast the spells upon it.
local location LSP // (LSP = Lightning Spells Position) This is where we get the position to create the ward in a circle formation.
local integer LL = GetUnitAbilityLevel(LTU, 'A003') // (LL = Lightning Level) This is where we check the casting unit ability level.
local real LD = 5.00 + 5.00 * LL // (LD = Lightning Duration) This is where we set the duration of the ward depends on the ability level.
// If you want the ward to last longer or shorter depends on the level, simply change the values at this part >>(5.00)<< * LL.
// LL is the ability level. So assume that your hero Lightning Ward ability was at level 2, the ward duration would last about 15 seconds.
// To show you the exact meaning of it. Here is the example >> 5 + (5 * 2 (It was 2 since the ability level was level 2)) = 15
local integer LI = 1 // (LI = Lightning Integer) This is where we set the beginning of the loop.
local unit LU // (LU = Lightning Unit) This is where we create a local variable in order to create a ward at specific point.
local real FA = AngleBetweenPoints(LT, LP) // (FA = Facing Angle) This is where we make a local variable that make the ward face the unit we cast the spells upon it.
local integer DU = 5 // (DU = Dummy Unit) This is where we set the amount of ward we wanted for the spells
local real Deg = 360/DU // (Deg = Degree) This is where we set the unit position in circle formation according to the number of ward available.
loop
exitwhen LI > DU // We set the loop to execute the amount of times depends on how many ward we had.
set LSP = PolarProjectionBJ(LT, 500.00, LI * Deg) // At here, we set the position of the wards 500 distance from the targeted unit in a circle.
// If you want to set the ward further or closer from the targeted unit, simply change the 500 values to something else.
set LU = CreateUnitAtLoc(GetOwningPlayer(LTU), 'o000', LSP, FA) // At here, we create a ward for the player who own the casting unit at circle formation around the targeted unit.
// (o000) are the id of the dummy unit.
call UnitApplyTimedLife(LU, 'BTLF', LD) // Add expiration timer to the ward so they would not remain after the duration expired.
call UnitAddAbility(LU, 'A002') // Add Lightning Bolt ability to the ward a.k.a dummy unit.
call IssueImmediateOrder(LU, "locustswarm" ) // Order the ward to unleash lightning.
call IssueTargetOrder(LU, "attack", LV ) // Order the ward to attack the unit we cast the spells.
call RemoveLocation(LSP) // Remove the location to avoid leak.
set LU = null // Reset it to the origin status to enable it to create ward at other position instead of making all ward spawn at the same place.
set LI = (LI+1) // We add the integer values each time it execute, once it match with DU. It would stop.
endloop
// Remove the location to avoid leak.
call RemoveLocation(LP)
call RemoveLocation(LT)
// Once the casting is complete, we reset everything back to it's original status.
set LP = null
set LT = null
set LTU = null
set LV = null
set LSP = null
endfunction
// Do not edit anything at this function.
//The function below are use to remove 16 memory leaks of type boolexpr cause by TriggerRegisterAnyUnitEventBJ
constant function DummyFilter takes nothing returns boolean
return true
endfunction
function Lightning_Ward_JASS takes nothing returns nothing
local trigger T = CreateTrigger()
local integer TI = 0
local filterfunc FF = Filter(function DummyFilter)
loop
exitwhen (TI >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(T, Player(TI), EVENT_PLAYER_UNIT_SPELL_EFFECT, FF)
set TI = TI + 1
endloop
call DestroyFilter(FF)
set FF = null
set T = null
endfunction
//===========================================================================
function InitTrig_Lightning_Ward_JASS_Documentation takes nothing returns nothing
set gg_trg_Lightning_Ward_JASS_Documentation = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Ward_JASS_Documentation, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lightning_Ward_JASS_Documentation, Condition( function Trig_Lightning_Ward_JASS_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Ward_JASS_Documentation, function Trig_Lightning_Ward_JASS_Actions )
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
library_once LightningWard initializer Init
globals
// Raw code for the ability (ID Spells Ability)
private constant integer LIGHTNING_WARD = 'A004'
// Raw code for the ward (ID Ward)
private constant integer DUMMY_RAWCODE = 'o000'
// Raw code for Lightning Bolt (ID Ward Ability)
private constant integer SWARM_RAWCODE = 'A002'
// How far away form target unit wards are created
private constant real OFFSET_DISTANCE = 500.
// This is where we set the max amount of ward for the spells
private constant integer MAX_WARDS = 5
endglobals
//Everything below has been set properly and does not need to be adjust except the ward duration.
private function LightningWard takes nothing returns boolean
local unit LTU
local unit LV
local player P
local real X
local real Y
local real LD
local integer LI
local unit LU
local real RAD
if (GetSpellAbilityId() == LIGHTNING_WARD) then
set LTU = GetTriggerUnit()
set LV = GetSpellTargetUnit()
set X = GetUnitX(LV)
set Y = GetUnitY(LV)
set LD = (GetUnitAbilityLevel(LTU, LIGHTNING_WARD)*5)+5. // This is where you change the duration of the ward.
set RAD = (2.*bj_PI)/MAX_WARDS
set P = GetOwningPlayer(LTU)
set LI = 0
loop
exitwhen (LI >= MAX_WARDS)
set LU = CreateUnit(P, DUMMY_RAWCODE, X+OFFSET_DISTANCE*Cos(RAD*LI), Y+OFFSET_DISTANCE*Sin(RAD*LI), 0.)
call UnitApplyTimedLife(LU, 'BTLF', LD)
call UnitAddAbility(LU, SWARM_RAWCODE)
call IssueImmediateOrder(LU, "locustswarm" )
call IssueTargetOrder(LU, "attack", LV)
set LI = LI + 1
endloop
set LU = null
set P = null
set LTU = null
set LV = null
endif
return (FALSE)
endfunction
// ===========================================================================
private constant function DummyFilter takes nothing returns boolean
return true
endfunction
private function Init takes nothing returns nothing
local trigger T = CreateTrigger()
local integer I = 0
local filterfunc FF = Filter(function DummyFilter)
loop
exitwhen (I >= bj_MAX_PLAYER_SLOTS)
call TriggerRegisterPlayerUnitEvent(T, Player(I), EVENT_PLAYER_UNIT_SPELL_EFFECT, FF)
set I = I + 1
endloop
call TriggerAddCondition(T, Condition(function LightningWard))
call DestroyFilter(FF)
set FF = null
set T = null
endfunction
endlibrary