| 03-25-2007, 08:33 AM | #1 |
causing the target to damage itself whenever it attacks....it doesnt do anything when used.... i gave few DebugMsg it says the target is null!!! help pls. I did try removing the call FlushHandleLocals(t) call DestroyTrigger(t) still doesnt work JASS:// ---------------------- Divine Repent ----------------------- constant function Divine_Repent_Abi takes nothing returns integer return 'S000' endfunction constant function Divine_Repent_Buf takes nothing returns integer return 'B002' endfunction constant function Divine_Repent_Duration takes nothing returns real return 8. endfunction constant function Divine_Repent_Damage takes integer l returns real return 10. + 20.*l endfunction //=========================================================== // Divine Repent //=========================================================== function divine_repent_cond takes nothing returns boolean return GetSpellAbilityId() == Divine_Repent_Abi() endfunction function divine_repent_damage_attacker takes nothing returns nothing local trigger t = GetTriggeringTrigger() local unit v = GetHandleUnit(t, "v") local unit c = null local integer l call BJDebugMsg(GetUnitName(v)) if GetAttacker() == v and GetUnitAbilityLevel(v, Divine_Repent_Buf()) > 0 then set c = GetHandleUnit(t, "c") set l = GetUnitAbilityLevel(c, Divine_Repent_Abi() ) call UnitDamageTarget(c, v, Divine_Repent_Damage(l), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS) // call DebugMsg(GetUnitName(v)+" attacked, and took "+R2S(Divine_Repent_Damage(l))+" damage") endif set v = null set t = null endfunction function divine_repent_action takes nothing returns nothing local unit c = GetTriggerUnit() local unit v = GetSpellTargetUnit() local trigger t = CreateTrigger() call SetHandleHandle(t, "c", c) call SetHandleHandle(t, "v", v) call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED) call TriggerAddAction(t, function divine_repent_damage_attacker) call TriggerSleepAction(Divine_Repent_Duration()) call FlushHandleLocals(t) call DestroyTrigger(t) set t = null set c = null set v = null endfunction //==== Init Trigger divine_repent ==== function InitTrig_divine_repent takes nothing returns nothing set gg_trg_divine_repent = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_divine_repent,EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition(gg_trg_divine_repent, Condition(function divine_repent_cond)) call TriggerAddAction(gg_trg_divine_repent, function divine_repent_action) endfunction |
| 03-25-2007, 08:38 AM | #2 |
Is your cache initialised? |
| 03-25-2007, 06:59 PM | #3 | |
Quote:
could u explain a lil more |
| 03-25-2007, 07:00 PM | #4 |
Did you initialize your gamecache before you used it? set udg_blah=Initgamecache(blah.w3v)? |
| 03-25-2007, 07:14 PM | #5 |
The correct writing is: set udg_<your gamecache> = InitGameCache("<Whatever>") This is important, because as we all know WC will make a difference between upper and small letters. |
| 03-26-2007, 08:44 AM | #6 |
its working its working!!! made a stupid mistake |
