Exfyre
hmm...
- Reaction score
- 60
hey, i was making a spell to increase my minimal knowledge of JASS, and i was wondering why i can't press 'stop' while this is running to stop it.
the spell teleports the caster to the target every x seconds dealing x damage.
how can i make it so pressing 'stop' will stop it?
the spell teleports the caster to the target every x seconds dealing x damage.
how can i make it so pressing 'stop' will stop it?
JASS:
function Trig_Followup_Slash_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 039;A000039; then
return true
endif
return false
endfunction
function Trig_Followup_Slash_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer hits = 5
local real TimeBetweenHits = .1
local location targetloc = GetUnitLoc(target)
local location casterloc = GetUnitLoc(caster)
local integer damage = 25
local real angle = AngleBetweenPoints(targetloc, casterloc)
local location temploc
loop
exitwhen hits == 0 or GetUnitState(caster, UNIT_STATE_LIFE) <= 0 ==
true or GetUnitState(target, UNIT_STATE_LIFE) <= 0 == true or
OrderId2String(GetUnitCurrentOrder(caster)) == "Stop"
set targetloc = GetUnitLoc(target)
set temploc = PolarProjectionBJ(targetloc, 78, angle)
call SetUnitPositionLoc(caster, temploc)
call UnitDamageTarget(caster, target, damage, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_ROCK_HEAVY_BASH)
call SetUnitAnimation(caster, "attack")
call RemoveLocation(temploc)
call RemoveLocation(targetloc)
call TriggerSleepAction(TimeBetweenHits)
set hits = hits - 1
endloop
call RemoveLocation(casterloc)
set casterloc = null
set temploc = null
set caster = null
set target = null
set targetloc = null
endfunction
//==== Init Trigger NewTrigger ====
function InitTrig_Followup_Slash takes nothing returns nothing
set gg_trg_Followup_Slash = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Followup_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
//call TriggerRegister__(gg_trg_NewTrigger, )
call TriggerAddCondition(gg_trg_Followup_Slash, Condition(function Trig_Followup_Slash_Conditions))
call TriggerAddAction(gg_trg_Followup_Slash, function Trig_Followup_Slash_Actions)
endfunction