~GaLs~
† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
- Reaction score
- 180
Why No damage is dealt to target
View attachment 11198
JASS:
scope Aim
constant function RawC takes nothing returns integer
return 039;A006039; // the raw code if Aim
endfunction
private function ChannelingCond takes nothing returns boolean
return GetSpellAbilityId() == RawC()
endfunction
private function AimCountAct takes nothing returns nothing
local effect array laser
local timer t = GetExpiredTimer()
local real Time = GetHandleReal(t,"time")
local integer dmg = GetHandleInt(t,"dmg")
local unit caster = GetHandleUnit(t,"caster")
local unit target = GetHandleUnit(t,"target")
if (OrderId2StringBJ(GetUnitCurrentOrder(caster)) == "channel") then
if Time >= .5 then
call SetHandleInt(t,"dmg",dmg+GetRandomInt(1,100))
call SetHandleReal(t,"time",Time-.5)
else
call PauseTimer(GetExpiredTimer())
set laser[1] = AddSpecialEffectTarget("LasercannonfinalRED.mdx", target, "origin")
set laser[2] = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl",caster,"origin")
call TriggerSleepAction(1.20)
call BJDebugMsg(I2S(dmg)) //testing
call UnitDamageTarget(caster, target, I2R(dmg), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call FlushHandleLocals(t)
call DestroyTimer(GetExpiredTimer())
call DestroyEffect(laser[1])
call DestroyEffect(laser[2])
set laser[1] = null
set laser[2] = null
endif
else
call PauseTimer(GetExpiredTimer())
set laser[1] = AddSpecialEffectTarget("LasercannonfinalRED.mdx", target, "origin")
set laser[2] = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Flare\\FlareCaster.mdl",caster,"origin")
call BJDebugMsg(I2S(dmg)) //testing
call TriggerSleepAction(1.20)
call UnitDamageTarget(caster, target, I2R(dmg), true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call FlushHandleLocals(t)
call DestroyTimer(GetExpiredTimer())
call DestroyEffect(laser[1])
call DestroyEffect(laser[2])
set laser[1] = null
set laser[2] = null
endif
set t = null
set caster = null
set target = null
endfunction
private function AimSetCond takes nothing returns boolean
return GetSpellAbilityId() == RawC()
endfunction
private function AimSetAct takes nothing returns nothing
local integer dmg = 0
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local timer t = CreateTimer()
local integer LvlOfSpell = GetUnitAbilityLevel(caster,RawC())
local real Time = I2R(LvlOfSpell)+4
call SetHandleReal(t,"time",Time)
call SetHandleInt(t,"dmg",dmg)
call SetHandleHandle(t,"caster",caster)
call SetHandleHandle(t,"target",target)
call TimerStart(t,0.5,true,function AimCountAct)
set caster = null
set target = null
set t = null
endfunction
//===========================================================================
function InitTrig_FullAimSetTryHandleVars takes nothing returns nothing
set gg_trg_FullAimSetTryHandleVars = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(gg_trg_FullAimSetTryHandleVars, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_FullAimSetTryHandleVars, Condition(function AimSetCond))
call TriggerAddAction( gg_trg_FullAimSetTryHandleVars, function AimSetAct )
endfunction
endscope
View attachment 11198