Trithilon-V2
New Member
- Reaction score
- 20
Guyz...I read a few jass and vjass tutorials and a lot of jass scripts and i am starting to get a hang of if.
I finally learnt a little bit of jass and made my first jass spell.
As you all know Jass is almost the same as gui (apart from functions and locals) without CSCache or HandleVars.
Any trigger that has to do certain actions after some time and to be MUI at the same time needs one of the two systems above.
However i cant seem to use them properly....
can you guyz please tell me how to fix this?
Its working...just the fact that the local trigger keeps firing even after the timer has expired.This leads to multiple instances of Event - Unit Takes Damage.
And if i try to destroy the local trigger after the timer expires...the trigger wont fire off again.
Btw i am using Newgen 5a and Warcraft TFT ver 1.20e.
I finally learnt a little bit of jass and made my first jass spell.
As you all know Jass is almost the same as gui (apart from functions and locals) without CSCache or HandleVars.
Any trigger that has to do certain actions after some time and to be MUI at the same time needs one of the two systems above.
However i cant seem to use them properly....
can you guyz please tell me how to fix this?
JASS:
function RecordDamage takes nothing returns nothing
local unit target=GetTriggerUnit()
local unit caster=GetEventDamageSource()
local real damage=GetHandleReal(caster,"damage")
call SetUnitLifeBJ(target,(GetUnitStateSwap(UNIT_STATE_LIFE,target) + (GetEventDamage())))
set damage=damage+GetEventDamage()
call SetHandleReal(caster,"damage",damage)
call BJDebugMsg("Damage Taken from "+GetUnitName(GetEventDamageSource())+" to "+GetUnitName(GetTriggerUnit())+" = "+R2S(damage))
set caster=null
endfunction
function DealDamage takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit target=GetHandleUnit(t,"target")
local unit caster=GetHandleUnit(t,"caster")
local real damage=GetHandleReal(caster,"damage")
call BJDebugMsg("The Caster over here is = "+(GetUnitName(caster))+" and the damage recorded is "+R2S(damage))
call UnitDamageTargetBJ( caster, target, damage, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL )
call SetHandleReal(caster,"damage",0)
call SetHandleHandle(t,"caster",null)
call SetHandleHandle(t,"target",null)
endfunction
function Trig_Test_Actions takes nothing returns nothing
local timer t = CreateTimer()
local real damage=0
local trigger damagedetect=CreateTrigger()
local unit caster=GetTriggerUnit()
local unit target=GetSpellTargetUnit()
call TriggerRegisterUnitEvent(damagedetect,target,EVENT_UNIT_DAMAGED)
call TriggerAddAction(damagedetect,function RecordDamage)
call BJDebugMsg("The Caster is = "+GetUnitName(GetTriggerUnit())+" and the Target is "+GetUnitName(GetSpellTargetUnit()))
call TimerStart(t, 10, false,function DealDamage)
call SetHandleReal(caster,"damage",damage)
call SetHandleHandle(t,"caster",caster)
call SetHandleHandle(t,"target",target)
call SetHandleHandle(t,"trigger1",damagedetect)
call SetHandleHandle(t,"trigger2",GetTriggeringTrigger())
call SetHandleHandle(damagedetect,"AttachCaster",caster)
endfunction
//===========================================================================
function InitTrig_Test_Copy takes nothing returns nothing
local trigger trig=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( trig, function Trig_Test_Actions )
endfunction
Its working...just the fact that the local trigger keeps firing even after the timer has expired.This leads to multiple instances of Event - Unit Takes Damage.
And if i try to destroy the local trigger after the timer expires...the trigger wont fire off again.
Btw i am using Newgen 5a and Warcraft TFT ver 1.20e.