Does Cause Unit To Damage Unit Not Register As Killing Unit?

BarzahdX

Active Member
Reaction score
18
It should, it gives the credit for the kill(bounties, and kill count triggers.)

EDIT: Where is your issue? Perhaps post your trigger?
 

waaaks!

Zinctified
Reaction score
255
no it doesnt register as killing unit, because it only deals damage
based on my experience Killing Unit only refers to the event "A unit Dies"
 

Frosthowl

TH.net Regular
Reaction score
15
I have this spell, Leech Seed, which uses triggers to damage a unit. For some reason, when leech seed does the final hit, the trigger does not run the required actions to continue gameplay...here are the triggers.

Code:
function Trig_Leech_Seed_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'LEEH'
endfunction

function Trig_Leech_Seed_Actions takes nothing returns nothing
    local unit u = GetSpellAbilityUnit()
    local unit t = GetSpellTargetUnit()
    local effect e
    local effect e2
    local integer i = 0
    
    call AddSpecialEffectTargetUnitBJ( "overhead", t, "Abilities\\Spells\\NightElf\\FaerieDragonInvis\\FaerieDragon_Invis.mdl" )
    set e = GetLastCreatedEffectBJ()
    
    call TriggerSleepAction(7)
    
    call DestroyEffect(e)
    call AddSpecialEffectTargetUnitBJ( "overhead", t, "Abilities\\Spells\\Other\\Drain\\DrainCaster.mdl" )
    set e = GetLastCreatedEffectBJ()
    call AddSpecialEffectTargetUnitBJ( "overhead", u, "Abilities\\Spells\\Other\\Drain\\DrainTarget.mdl" )
    set e2 = GetLastCreatedEffectBJ()
   
    loop
        exitwhen i == 10
        set i = i + 1
        if IsUnitAliveBJ(t) == true then
            call UnitDamageTargetBJ(u, t, 25, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL)
            call SetUnitLifeBJ(u, GetUnitStateSwap(UNIT_STATE_LIFE, u) + 25)
        else
            set i = 10
        endif
        call TriggerSleepAction(1)
    endloop
    
    call DestroyEffect(e)
    call DestroyEffect(e2)
    
endfunction

//===========================================================================
function InitTrig_Leech_Seed takes nothing returns nothing
    set gg_trg_Leech_Seed = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Leech_Seed, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Leech_Seed, Condition( function Trig_Leech_Seed_Conditions ) )
    call TriggerAddAction( gg_trg_Leech_Seed, function Trig_Leech_Seed_Actions )
endfunction

Code:
Events
    Unit - A unit Dies
Conditions
    ((Triggering unit) is An Ancient) Equal to True
Actions
    Set PlayersLeft = (PlayersLeft - 1)
    Set RemoveHero[(Player number of (Owner of (Dying unit)))] = (Dying unit)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Killing unit) Not equal to No unit
        Then - Actions
            Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) + ( has been killed by  + (Name of (Owner of (Killing unit)))))
            Set PlayerScores[(Player number of (Owner of (Killing unit)))] = (PlayerScores[(Player number of (Owner of (Killing unit)))] + 2)
            Leaderboard - Change the value for (Owner of (Killing unit)) in LeaderBoard to PlayerScores[(Player number of (Owner of (Killing unit)))]
        Else - Actions
            Game - Display to (All players) the text: ((Name of (Owner of (Triggering unit))) +  has been killed by the forces of nature)
            Set PlayerScores[(Player number of (Owner of (Triggering unit)))] = (PlayerScores[(Player number of (Owner of (Triggering unit)))] - 2)
            Leaderboard - Change the value for (Owner of (Triggering unit)) in LeaderBoard to PlayerScores[(Player number of (Owner of (Triggering unit)))]
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            PlayersLeft Equal to 1
        Then - Actions
            Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) is An Ancient) Equal to True))) and do (Actions)
                Loop - Actions
                    Game - Display to (All players) the text: ((Name of (Owner of (Picked unit))) +  has won the match and received an extra 3 points)
                    Set PlayerScores[(Player number of (Owner of (Picked unit)))] = (PlayerScores[(Player number of (Owner of (Picked unit)))] + 3)
                    Leaderboard - Change the value for (Owner of (Picked unit)) in LeaderBoard to PlayerScores[(Player number of (Owner of (Picked unit)))]
                    Set RemoveHero[(Player number of (Owner of (Picked unit)))] = (Picked unit)
            Custom script:   call DestroyGroup(GetLastCreatedGroup())
            Countdown Timer - Pause Timer
            Trigger - Run Victory Conditions <gen> (checking conditions)
        Else - Actions
    Leaderboard - Sort LeaderBoard by Value in Descending order

EDIT: ok, then what should I do to fix this?

EDIT AGAIN: Ok, so it seems I was an idiot and when I made this new hero, I forgot to classify it as an ancient...and that trigger does work after all
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top