Stats Modification

zepho

New Member
Reaction score
0
This trigger here works perfectly when my hero kills a hero by normal attacks or basic spells. Just wondering, would this work properly when damage is dealt by TRIGGER and kills the target hero? Thanks :)

JASS:
scope Spell

globals
    private constant integer SPELLID = 'A00'
endglobals

    function Conditions takes nothing returns boolean
        return GetUnitAbilityLevel(GetKillingUnit(),SPELLID)>0
    endfunction

    function Actions takes nothing returns nothing
        local unit c = GetKillingUnit()
        if IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO) then
            call SetHeroStr(c,GetHeroStr(c,false)+2,true)
        endif
        set c=null
    endfunction
        
    function InitTrig_Spell takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(t,Condition(function Conditions))
        call TriggerAddAction(t,function Actions)
        set t=null
    endfunction

endscope
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Depends on how you deal damage.
If you have your hero deal damage via trigger then it will probably work.
 

zepho

New Member
Reaction score
0
Yeah but I tried this
JASS:
 UnitDamageTarget(some data here)
but that code isn't recognized or doesn't function properly :(

Edit: FIXED it! Realized I should have modified that UnitDamageTarget(fixed some data here) function so it is recognized on the code. Thanks +rep :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top