Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MultiShock initializer Init
globals
private constant integer ACTIVATOR_RAWCODE = 'A003'
private constant integer DUMMY_RAWCODE = 'h000'
private constant string DUMMY_STRING = "carrionswarm"
private constant real TARGET_ARC = 300
private constant integer WAVE_NUMBER_PER_LEVEL = 3
private constant integer WAVE_NUMBER_BASE = 0
private constant real TARGET_ARC_CUTOFF = TARGET_ARC/6.28319
private constant real TARGET_OFFSET = 150
private constant real DUMMY_DURATION = 1
endglobals
private function MSCondition takes nothing returns boolean
return GetSpellAbilityId() == ACTIVATOR_RAWCODE
endfunction
private constant function DummyFilter takes nothing returns boolean
return true
endfunction
private function MultiShock takes nothing returns nothing
local unit tu = GetTriggerUnit()
local location tl = GetSpellTargetLoc()
local unit lu
local player p = GetOwningPlayer(tu)
local integer im = WAVE_NUMBER_BASE + GetUnitAbilityLevel(tu,ACTIVATOR_RAWCODE) * WAVE_NUMBER_PER_LEVEL
local integer i = 0
local real x = GetUnitX(tu)
local real y = GetUnitY(tu)
local real tx = GetLocationX(tl)
local real ty = GetLocationY(tl)
local real distance = SquareRoot((x-tx)*(x-tx)+(y-ty)*(y-ty))
local real circum
local real r
call RemoveLocation(tl)
set tl = null
if distance > TARGET_ARC_CUTOFF then
set circum = TARGET_ARC/distance
set r = Atan2(ty-y,tx-x) - circum/2
else
set circum = 6.28319
set r = GetUnitFacing(tu)*bj_DEGTORAD
endif
set circum = circum/im
loop
exitwhen i == im
set lu = CreateUnit(p,DUMMY_RAWCODE,x,y,r*bj_RADTODEG)
call UnitApplyTimedLife(lu,'BTLF',DUMMY_DURATION)
call IssuePointOrder(lu,DUMMY_STRING,x+TARGET_OFFSET*Cos(r),y+TARGET_OFFSET*Sin(r))
set r = r + circum
set i = i + 1
endloop
set tu = null
set lu = null
set p = null
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 MSCondition))
call TriggerAddAction(t,function MultiShock)
call DestroyFilter(ff)
set ff = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
//This is the early work of my spells, even though everything was coded right. It doesn't work and ineffective.
//All ineffective part such as bj has been remove and the code has been improve by using x/y instead of location.
//Do not use this trigger files, it was a WIP to be view by everybody.
library_once MultiShock initializer Init
globals
private constant integer Multi_Shock = 'A003'
private constant integer DUMMY_RAWCODE = 'h000'
endglobals
private function MSCondition takes nothing returns boolean
return GetSpellAbilityId() == Multi_Shock
endfunction
function MultiShock takes nothing returns boolean
local unit tu
local real r
local integer i
local location tl
local location dtl
local location otl
local unit lu
local player p
set tu = GetTriggerUnit()
set tl = GetSpellTargetLoc()
set r = ( GetUnitFacing(tu) - ( I2R(GetUnitAbilityLevelSwapped(Multi_Shock, tu)) * 60.00 ) )
set i = 1
loop
exitwhen i > ( GetUnitAbilityLevelSwapped(Multi_Shock, tu) * 3 )
set dtl = GetUnitLoc(GetTriggerUnit())
set lu = CreateUnitAtLoc( p, DUMMY_RAWCODE, dtl, AngleBetweenPoints(dtl, tl) )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', lu )
set otl = PolarProjectionBJ(tl, 150.00, r)
call IssuePointOrderLocBJ( lu, "shockwave", otl )
set r = ( r + 20.00 )
call RemoveLocation (dtl)
call RemoveLocation (otl)
set i = i + 1
endloop
set tu = null
set tl = null
set dtl = null
set otl = null
set lu = null
set p = null
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 MultiShock))
call DestroyFilter(FF)
set FF = null
set T = null
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library MultiShock initializer Init
globals
//This is where you set the rawcode of the spells that activate this trigger.
private constant integer ACTIVATOR_RAWCODE = 'A003'
//This is where you set the rawcode of the dummy units that would cast dummy spells.
private constant integer DUMMY_RAWCODE = 'h000'
//This is where you set the order for the dummy unit to cast the spells
private constant string DUMMY_STRING = "carrionswarm"
//The arc size in WC3 units that the projectiles will be fired in at the target point.
private constant real TARGET_ARC = 300
//Constants below alter the number of waves created.
private constant integer WAVE_NUMBER_PER_LEVEL = 3
private constant integer WAVE_NUMBER_BASE = 0
//Engine Mechanic Constants below --- Editing not advisable unless you know what you are doing.
//The cutoff distance, under which the spell will default to perfect circular cast mode.
private constant real TARGET_ARC_CUTOFF = TARGET_ARC/6.28319
//The offset the dummy's are past when trying to cast the spell in a circle (too small may cause bugs).
private constant real TARGET_OFFSET = 150
//The length of time the dummy units will live for after casting the spell (too small may cause bugs).
private constant real DUMMY_DURATION = 1
endglobals
private function MSCondition takes nothing returns boolean
return GetSpellAbilityId() == ACTIVATOR_RAWCODE
endfunction
private constant function DummyFilter takes nothing returns boolean
return true
endfunction
private function MultiShock takes nothing returns nothing
local unit tu = GetTriggerUnit()
local location tl = GetSpellTargetLoc()
local unit lu
local player p = GetOwningPlayer(tu)
local integer im = WAVE_NUMBER_BASE + GetUnitAbilityLevel(tu,ACTIVATOR_RAWCODE) * WAVE_NUMBER_PER_LEVEL
local integer i = 0
local real x = GetUnitX(tu)
local real y = GetUnitY(tu)
local real tx = GetLocationX(tl)
local real ty = GetLocationY(tl)
local real distance = SquareRoot((x-tx)*(x-tx)+(y-ty)*(y-ty))
local real circum
local real r
//Location is no longer needed, thus free up recources as quickly as possible.
call RemoveLocation(tl)
set tl = null
//Below checks if focusing mode is being used, this is to prevent bugs occuring if targeted too close to the caster.
if distance > TARGET_ARC_CUTOFF then
//Focus mode, it will base angle on the percentage of the arc for the entered distance.
set circum = TARGET_ARC/distance
set r = Atan2(ty-y,tx-x) - circum/2
else
//Nonfocused mode, it will fire all projectiles evenly in a perfect circle.
set circum = 6.28319
set r = GetUnitFacing(tu)*bj_DEGTORAD
endif
//Sets up the angle offset each projectile is.
set circum = circum/im
//Loop below handles creation of all individual waves.
loop
exitwhen i == im
set lu = CreateUnit(p,DUMMY_RAWCODE,x,y,r*bj_RADTODEG)
call UnitApplyTimedLife(lu,'BTLF',DUMMY_DURATION)
call IssuePointOrder(lu,DUMMY_STRING,x+TARGET_OFFSET*Cos(r),y+TARGET_OFFSET*Sin(r))
set r = r + circum
set i = i + 1
endloop
set tu = null
set lu = null
set p = null
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 MSCondition))
call TriggerAddAction(t,function MultiShock)
call DestroyFilter(ff)
set ff = null
endfunction
endlibrary