Kill Message System that detects owner of killing summons/dummies

Gluttonous

Active Member
Reaction score
1
Most kill message systems are simple due to only taking into account if the killing unit is also a Hero, but I have a good deal of summons and dummy casters in my map that triggers like that would ignore, which I want to take into account. Keep in mind that each player can only have 1 Hero in my typical AoS map, so a simple unit group -should- be able to find the hero who did it, even if he did it indirectly.

Does the trigger work? Sometimes, sometimes not. While it more commonly doesn't work when it's not a hero killing another hero directly, sometimes even then the trigger doesn't work. A message still shows up, sure, but oftentimes it'll bring up an incorrect hero, most commonly the Hero killing himself, and oftentimes the level of the killing hero will show up as 0 in the message. This leads me to think that the trigger detected a unit as the killing Hero, but this happens oftentimes even when a Hero is the killer directly. I have no idea what the problem is.

Oh, and if you're wondering why the Pandas are specifically addressed at the start of the trigger and not any other minions, that's because the main Brewmaster Hero can't be detected while his minions are running around due to him being hidden during the spell.

Code:
Kills
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        Set KillingHeroGroup = (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is A Hero) Equal to True))
        Unit Group - Pick every unit in KillingHeroGroup and do (Set KillingHero = (Picked unit))
        Custom script:   call DestroyGroup (udg_KillingHeroGroup)
        Set KillingHeroPlayer = (Owner of KillingHero)
        If ((Unit-type of (Killing unit)) Equal to Storm [custom]) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Fire [custom]) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Earth [custom]) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Earth) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Fire) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Storm) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Earth (Chen)) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Fire (Chen)) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Killing unit)) Equal to Storm (Chen)) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Paladin [Custom]) then do (Set KillingHeroString = Paladin) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Archmage [Custom]) then do (Set KillingHeroString = Archmage) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Archmage (etheral)) then do (Set KillingHeroString = Archmage) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Frost Sorceress [Custom]) then do (Set KillingHeroString = Frost Sorceress) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Blood Mage [Custom]) then do (Set KillingHeroString = Blood Mage) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Mountain King [Custom]) then do (Set KillingHeroString = Mountain King) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Lord Garithos) then do (Set KillingHeroString = General) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Blademaster [Custom]) then do (Set KillingHeroString = Blademaster) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Tauren Chieftain Custom) then do (Set KillingHeroString = Tauren Chieftain) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Shadow Hunter [Custom]) then do (Set KillingHeroString = Shadow Hunter) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Troll Berserker [Custom]) then do (Set KillingHeroString = Troll Berserker) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Far Seer [Custom]) then do (Set KillingHeroString = Far Seer) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Spirit Walker [Custom]) then do (Set KillingHeroString = Spirit Walker) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Death Knight [Custom]) then do (Set KillingHeroString = Death Knight) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Lich [Custom]) then do (Set KillingHeroString = Lich) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Dreadlord [Custom]) then do (Set KillingHeroString = Dreadlord) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Crypt Lord [Custom]) then do (Set KillingHeroString = Crypt Lord) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Crypt Lord [Burrowed]) then do (Set KillingHeroString = Crypt Lord) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Keeper of the Grove [Custom]) then do (Set KillingHeroString = Keeper of the Grove) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Demon Hunter [Custom]) then do (Set KillingHeroString = Demon Hunter) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Demon Hunter (Demon Form)[Custom]) then do (Set KillingHeroString = Demon Hunter) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Warden [Custom]) then do (Set KillingHeroString = Warden) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Priestess of the Moon [Custom]) then do (Set KillingHeroString = Priestess of the Moon) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Custom]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 1 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 2 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 3 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 4 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 5 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Alchemist [Morph level 6 unique]) then do (Set KillingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Naga Sea Witch [Custom]) then do (Set KillingHeroString = Naga Sea Witch) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Ancient [Custom]) then do (Set KillingHeroString = Ancient) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Beastmaster [Custom]) then do (Set KillingHeroString = Beastmaster) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Dark Ranger [Custom]) then do (Set KillingHeroString = Dark Ranger) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Fire Lord [Custom]) then do (Set KillingHeroString = Fire Lord) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Pandaren Brewmaster [Custom]) then do (Set KillingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Pit Lord [Custom]) then do (Set KillingHeroString = Pit Lord) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Tinker [Custom]) then do (Set KillingHeroString = Tinker) else do (Do nothing)
        If ((Unit-type of KillingHero) Equal to Tinker) then do (Set KillingHeroString = Tinker) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Paladin [Custom]) then do (Set DyingHeroString = Paladin) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Archmage [Custom]) then do (Set DyingHeroString = Archmage) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Archmage (etheral)) then do (Set DyingHeroString = Archmage) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Mountain King [Custom]) then do (Set DyingHeroString = Mountain King) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Blood Mage [Custom]) then do (Set DyingHeroString = Blood Mage) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Frost Sorceress [Custom]) then do (Set DyingHeroString = Frost Sorceress) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Blademaster [Custom]) then do (Set DyingHeroString = Blademaster) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Tauren Chieftain Custom) then do (Set DyingHeroString = Tauren Chieftain) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Shadow Hunter [Custom]) then do (Set DyingHeroString = Shadow Hunter) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Troll Berserker [Custom]) then do (Set DyingHeroString = Troll Berserker) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Far Seer [Custom]) then do (Set DyingHeroString = Far Seer) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Spirit Walker [Custom]) then do (Set DyingHeroString = Spirit Walker) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Death Knight [Custom]) then do (Set DyingHeroString = Death Knight) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Lich [Custom]) then do (Set DyingHeroString = Lich) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Dreadlord [Custom]) then do (Set DyingHeroString = Dreadlord) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Crypt Lord [Custom]) then do (Set DyingHeroString = Crypt Lord) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Crypt Lord [Burrowed]) then do (Set DyingHeroString = Crypt Lord) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Keeper of the Grove [Custom]) then do (Set DyingHeroString = Keeper of the Grove) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Demon Hunter [Custom]) then do (Set DyingHeroString = Demon Hunter) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Demon Hunter (Demon Form)[Custom]) then do (Set DyingHeroString = Demon Hunter) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Priestess of the Moon [Custom]) then do (Set DyingHeroString = Priestess of the Moon) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Custom]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 1 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 2 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 3 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 4 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 5 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Alchemist [Morph level 6 unique]) then do (Set DyingHeroString = Alchemist) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Naga Sea Witch [Custom]) then do (Set DyingHeroString = Naga Sea Witch) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Ancient [Custom]) then do (Set DyingHeroString = Ancient) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Beastmaster [Custom]) then do (Set DyingHeroString = Beastmaster) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Dark Ranger [Custom]) then do (Set DyingHeroString = Dark Ranger) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Fire Lord [Custom]) then do (Set DyingHeroString = Fire Lord) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Pandaren Brewmaster [Custom]) then do (Set DyingHeroString = Pandaren Brewmaster) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Pit Lord [Custom]) then do (Set DyingHeroString = Pit Lord) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Tinker [Custom]) then do (Set DyingHeroString = Tinker) else do (Do nothing)
        If ((Unit-type of (Triggering unit)) Equal to Tinker) then do (Set DyingHeroString = Tinker) else do (Do nothing)
Game - Display to (All players) the text: ((Name of KillingHeroPlayer) + ( (|cffffcc00 + (KillingHeroString + (|r Level  + ((String((Hero level of KillingHero))) + () has killed  + (((Name of (Owner of (Triggering unit))) + ( (|cffffcc00 + (DyingHeroString + (|r Level  + ((String((Hero level of (Triggiering Unit)))) + )
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Keep in mind that each player can only have 1 Hero in my typical AoS map, so a simple unit group -should- be able to find the hero who did it, even if he did it indirectly.
I haven't checked your trigger, because IMO it's much more complicated than necessary.

Since you can only have one hero per player, you can simply use a unit array with each player's hero saved at the player's index. When a player picks a hero, store it at HeroVariableName[Player number of (Owner of (picked hero))]. Then, you can recall which hero should have credit for the kill by the player number of the owner of the killing unit.
 
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