scope Spread
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A00D039; or GetSpellAbilityId() == 039;A006039;
endfunction
private function Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location Cast_Point = GetSpellTargetLoc()
local real x = GetUnitX(Caster)
local real y = GetUnitY(Caster)
local real x1 = GetLocationX(Cast_Point)
local real y1 = GetLocationY(Cast_Point)
local real Angle = Atan2(y1 - y, x1 - x)
local real px1 = x + 256 * Cos(Angle + 0.34906)
local real py1 = y + 256 * Sin(Angle + 0.34906)
local real px2 = x + 256 * Cos(Angle - 0.34906)
local real py2 = y + 256 * Sin(Angle - 0.34906)
local unit Dummy = CreateUnit(GetOwningPlayer(Caster), 039;h001039;, x, y, 0)
call UnitApplyTimedLife(Dummy, 039;BTLF039;, 4.00 )
call SetUnitAbilityLevel(Dummy, 039;A009039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()) )
call IssuePointOrder(Dummy, "breathoffrost", px1, py1)
call IssuePointOrder(Dummy, "breathoffrost", px2, py2)
call RemoveLocation(Cast_Point)
set Caster = null
set Cast_Point = null
set Dummy = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger Spread= CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Spread, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Spread, Condition( function Conditions ) )
call TriggerAddAction( Spread, function Actions )
endfunction
endscope
questions for the trigger in my previous post.i have a few questions, why isn't the Shake function Private? (everything else is)
and after i call StartTimer, how do i do actions when the timer expires (without a new trigger perhaps?)
alright, replaced 20 with 0.34906
JASS:scope Spread private function Conditions takes nothing returns boolean return GetSpellAbilityId() == 039;A00D039; or GetSpellAbilityId() == 039;A006039; endfunction private function Actions takes nothing returns nothing local unit Caster = GetTriggerUnit() local location Cast_Point = GetSpellTargetLoc() local real x = GetUnitX(Caster) local real y = GetUnitY(Caster) local real x1 = GetLocationX(Cast_Point) local real y1 = GetLocationY(Cast_Point) local real Angle = Atan2(y1 - y, x1 - x) local real px1 = x + 256 * Cos(Angle + 0.34906) local real py1 = y + 256 * Sin(Angle + 0.34906) local real px2 = x + 256 * Cos(Angle - 0.34906) local real py2 = y + 256 * Sin(Angle - 0.34906) local unit Dummy = CreateUnit(GetOwningPlayer(Caster), 039;h001039;, x, y, 0) call UnitApplyTimedLife(Dummy, 039;BTLF039;, 4.00 ) call SetUnitAbilityLevel(Dummy, 039;A009039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()) ) call IssuePointOrder(Dummy, "breathoffrost", px1, py1) call IssuePointOrder(Dummy, "breathoffrost", px2, py2) call RemoveLocation(Cast_Point) set Caster = null set Cast_Point = null set Dummy = null endfunction //=========================================================================== public function InitTrig takes nothing returns nothing local trigger Spread= CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( Spread, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( Spread, Condition( function Conditions ) ) call TriggerAddAction( Spread, function Actions ) endfunction endscope
alright, im assuming thats done
questions for the trigger in my previous post.
globals
integer i = 0
endglobals
function Callback takes nothing returns nothing
local timer t = GetExpiredTimer() //retrieves the timer that expired
set i = i + 1
if i >= 50 then
call PauseTimer(t) //will stop the timer
call DestroyTimer(t) //destroys the timer
endif
set t = null
endfunction
function JASS takes nothing returns nothing
local timer t = CreateTimer()
call TimerStart(t,0.05,true,function Callback) //starts the timer
//Starts timer "t"
//Runs the function "Callback" every 0.05 seconds
//It is periodic because of the "true"
//It runs to function "Callback" because of the "function Callback" argument
set t = null
endfunction
The same would happen if you removed the t nulling and return line from the if.
Handlerfunc
scope HA
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A00C039; or GetSpellAbilityId() == 039;A00W039;
endfunction
private function Shake takes nothing returns nothing
call CameraSetEQNoiseForPlayer( GetOwningPlayer(GetEnumUnit()), 50.00 )
endfunction
private function Fire takes nothing returns nothing
local timer t = GetExpiredTimer()
local real px = x + Offset * Cos(Angle)
local real py = y + Offset * Sin(Angle)
if Offset <= Offset_Max then
call IssuePointOrder(Dummy, "flamestrike", px, py)
set Offset = Offset + 250
else
call PauseTimer(t)
call DestroyTimer(t)
set t = null
set Dummy = null
endif
endfunction
private function Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location Caster_Loc = GetUnitLoc(Caster)
local real x = GetUnitX(Caster)
local real y = GetUnitY(Caster)
local location Cast_Point = GetSpellTargetLoc()
local real x1 = GetLocationX(Cast_Point)
local real y1 = GetLocationY(Cast_Point)
local real Angle = Atan2(y1 - y, x1 - x)
local group Shake_Group = GetUnitsInRangeOfLocAll(4000.00, Caster_Loc)
local unit Dummy = CreateUnit(GetOwningPlayer(Caster),039;h000039;, x, y, 0)
local unit Dummy2 = CreateUnit(GetOwningPlayer(Caster),039;h000039;, x, y, 0)
local real Offset = 250.
local real Offset_Max = (1500 + ( 500 * GetUnitAbilityLevel(Caster, GetSpellAbilityId())))
local timer t = CreateTimer ()
call ForGroup(Shake_Group, function Shake )
call DestroyGroup(Shake_Group)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ))
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", x , y ))
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ))
call TerrainDeformRipple ( x, y, 2000, 60, 4, 20, 1000.00 , 0.5 , 500.00 , true)
call SetUnitState(Caster, UNIT_STATE_LIFE, GetUnitState(Caster, UNIT_STATE_MAX_LIFE))
call UnitApplyTimedLife(Dummy,039;BTLF039;,7)
call SetUnitAbilityLevel(Dummy, 039;A00A039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
call TimerStart( t, 0.27, true, function Fire )
call UnitApplyTimedLife(Dummy2,039;BTLF039;,5)
call SetUnitAbilityLevel(Dummy2, 039;A001039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
call IssuePointOrder(Dummy2, "shockwave", x1 , y1 )
call RemoveLocation(Cast_Point)
call RemoveLocation(Caster_Loc)
call DestroyTimer(Holy_Arrow_Timer)
set Caster = null
set Dummy2 = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger HA = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( HA, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( HA, Condition( function Conditions ) )
call TriggerAddAction( HA, function Actions )
endfunction
endscope
scope HA
globals
real x
real y
real x1
real y1
real px
real py
real Angle
unit Dummy
real Offset
real Offset_Max
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A00C039; or GetSpellAbilityId() == 039;A00W039;
endfunction
private function Shake takes nothing returns nothing
call CameraSetEQNoiseForPlayer( GetOwningPlayer(GetEnumUnit()), 50.00 )
endfunction
private function Fire takes nothing returns nothing
local timer t = GetExpiredTimer()
set px = x + Offset * Cos(Angle)
set py = y + Offset * Sin(Angle)
if Offset <= Offset_Max then
call IssuePointOrder(Dummy, "flamestrike", px, py)
set Offset = Offset + 250
else
call PauseTimer(t)
call DestroyTimer(t)
set t = null
set Dummy = null
endif
endfunction
private function Actions takes nothing returns nothing
local unit Caster = GetTriggerUnit()
local location Caster_Loc = GetUnitLoc(Caster)
local location Cast_Point = GetSpellTargetLoc()
local group Shake_Group = GetUnitsInRangeOfLocAll(4000.00, Caster_Loc)
local unit Dummy2 = CreateUnit(GetOwningPlayer(Caster),039;h000039;, x, y, 0)
local timer t = CreateTimer ()
set x = GetUnitX(Caster)
set y = GetUnitY(Caster)
set x1 = GetLocationX(Cast_Point)
set y1 = GetLocationY(Cast_Point)
set Angle = Atan2(y1 - y, x1 - x)
set Offset = 250.
set Offset_Max = (1500 + ( 500 * GetUnitAbilityLevel(Caster, GetSpellAbilityId())))
set Dummy = CreateUnit(GetOwningPlayer(Caster),039;h000039;, x, y, 0)
call ForGroup(Shake_Group, function Shake )
call DestroyGroup(Shake_Group)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ))
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", x , y ))
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ))
call TerrainDeformRipple ( x, y, 2000, 60, 4, 20, 1000.00 , 0.5 , 500.00 , true)
call SetUnitState(Caster, UNIT_STATE_LIFE, GetUnitState(Caster, UNIT_STATE_MAX_LIFE))
call UnitApplyTimedLife(Dummy,039;BTLF039;,7)
call SetUnitAbilityLevel(Dummy, 039;A00A039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
call TimerStart( t, 0.27, true, function Fire )
call UnitApplyTimedLife(Dummy2,039;BTLF039;,5)
call SetUnitAbilityLevel(Dummy2, 039;A001039;, GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
call IssuePointOrder(Dummy2, "shockwave", x1 , y1 )
call RemoveLocation(Cast_Point)
call RemoveLocation(Caster_Loc)
set Caster = null
set Dummy2 = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger HA = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( HA, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( HA, Condition( function Conditions ) )
call TriggerAddAction( HA, function Actions )
endfunction
endscope