• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

player gets no credit for dummy kill

Level 7
Joined
Feb 22, 2009
Messages
260
  • Mass Entangling roots
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Level of Demigod Power for (Triggering unit)) Greater than 0
      • (Ability being cast) Equal to Entangling Roots
    • Actions
      • Set Owner = (Owner of (Casting unit))
      • Set Abilitylevel = (Level of (Ability being cast) for (Triggering unit))
      • Set Target_Pos = (Position of (Target unit of ability being cast))
      • Set TargetedGroup = (Units within AbilityStat[(Level of Demigod Power for (Triggering unit))] of Target_Pos)
      • Unit Group - Pick every unit in TargetedGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) is alive) Equal to True
              • (Picked unit) Not equal to (Target unit of ability being cast)
              • ((Picked unit) is visible to Owner) Equal to True
              • ((Picked unit) belongs to an enemy of Owner) Equal to True
            • Then - Actions
              • Unit - Create 1 Dummy for Owner at Target_Pos facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Entangling Roots to (Last created unit)
              • Unit - Set level of Entangling Roots for (Last created unit) to Abilitylevel
              • Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Target_Pos)
      • Custom script: call DestroyGroup (udg_TargetedGroup)


So this trigger is supposed to create a mass entangling roots spell but when those creeps were killed by the dummy's spells they did not give the credit to the triggering player.


Map in question.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
another possibility is that there are some issues with recursion happening here.

is the dummy casting the same spell that the demigod is casting which is starting this whole thing? If they are the same spell that is a big red flag and I'm surprised it's not causing more issues than this...
 
Level 7
Joined
Feb 22, 2009
Messages
260
try changing this: Set Owner = (Owner of (Casting unit))

to - owner of triggering unit.

I know it doesn't make much sense but I would start by trying that.

At first, it was triggering player. Then I changed to owner of triggering unit. This owner of casting unit is my last attempt.


Could it be because the dummy disappears ("dies") before the creeps take enough damage? What happens if you increase its expiration timer to match the duration of the spell (not ideal but that's just for testing)
I also had some assumption but it's so weird as to why that would affect the source of the damage.



another possibility is that there are some issues with recursion happening here.

is the dummy casting the same spell that the demigod is casting which is starting this whole thing? If they are the same spell that is a big red flag and I'm surprised it's not causing more issues than this...
Dummy doesn't have the demigod power ability so it is not qualified to trigger. I also thought it was the problem and added the unit type of triggering unit is demigod is true to the event but nothing happened.

And yeah, dummy and demigod cast the same spell.
 
Level 7
Joined
Feb 22, 2009
Messages
260
So the dummy unit is created and the entangling roots spell is cast?

Have you enabled the player bounties? Or what kind of credit are you expecting to get?

When the hero cast this spell, dummies will be created to cast the same spell to nearby enemies beside the target.
The hero get the credit (bounty + exp) as he should be but the kills caused by the dummies' spells are not credited to the owner of the hero. This means the hero does not receive exp and the player that owns him get no gold bounty from the creep.
In case you are still wondering, yes the bounty is on as I said "The hero get the credit (bounty + exp) as he should be".
 
Level 30
Joined
Aug 29, 2012
Messages
1,385
I'm 32% sure that because the source of the damage is removed from the game before the kill happens, the game assumes that units died for unknown reason and don't give proper credit

What if you'd cause the hero to deal 1 damage via trigger to the affected enemies? Perhaps then the player would be correctly linked to the dummy spells
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
When the hero cast this spell, dummies will be created to cast the same spell to nearby enemies beside the target.
The hero get the credit (bounty + exp) as he should be but the kills caused by the dummies' spells are not credited to the owner of the hero. This means the hero does not receive exp and the player that owns him get no gold bounty from the creep.
In case you are still wondering, yes the bounty is on as I said "The hero get the credit (bounty + exp) as he should be".
Yeah it is most probable that the game loses the idea of who is dealing the damage as you're removing the dummy units after two seconds. You can try this by making the expiration time longer (so the targets die before the dummy units are removed) and see if the hero then gets the bounty.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
as @Chaosium pointed out, the issue is that the source of the damage no longer exists by the time the entangled unit dies.
If you set up your dummy unit correctly, you can have a single dummy unit cast entangling roots on all units, instead of creating one dummy per target.
If set up even better, you can use one persistent dummy per player/hero so that the experience is always applied to relevant hero(es) and you don't pollute your map with unnecessary amount of dummies.

Edit: something like this:

  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet loc = (Center of (Playable map area))
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Picked player) at loc facing Default building facing degrees
          • Set VariableSet dummies[(Player number of (Picked player))] = (Last created unit)
      • Custom script: call RemoveLocation(udg_loc)
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Entangling Roots
    • Actions
      • Set VariableSet loc = (Position of (Triggering unit))
      • Set VariableSet PN = (Player number of (Triggering player))
      • Unit - Move dummies[PN] instantly to loc
      • Unit - Add Roots to dummies[PN]
      • Unit - Set level of Roots for dummies[PN] to (Level of (Ability being cast) for (Triggering unit))
      • Custom script: call RemoveLocation(udg_loc)
      • Set VariableSet loc = (Position of (Target unit of ability being cast))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of loc.) and do (Actions)
        • Loop - Actions
          • Set VariableSet target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • target Not equal to (Target unit of ability being cast)
              • (target belongs to an enemy of (Triggering player).) Equal to True
              • (target is visible to (Triggering player).) Equal to True
              • (target is A structure) Equal to False
              • (target is Mechanical) Equal to False
              • (target is A flying unit) Equal to False
              • (target is alive) Equal to True
            • Then - Actions
              • Unit - Order dummies[PN] to Night Elf Keeper Of The Grove - Entangling Roots target
            • Else - Actions
      • Custom script: call RemoveLocation(udg_loc)
      • Unit - Remove Roots from dummies[PN]
But for this to work, you have to have correctly configured your dummy unit so that it can instant cast spells.
 
Last edited:
Level 7
Joined
Feb 22, 2009
Messages
260
as @Chaosium pointed out, the issue is that the source of the damage no longer exists by the time the entangled unit dies.
If you set up your dummy unit correctly, you can have a single dummy unit cast entangling roots on all units, instead of creating one dummy per target.
If set up even better, you can use one persistent dummy per player/hero so that the experience is always applied to relevant hero(es) and you don't pollute your map with unnecessary amount of dummies.

Edit: something like this:

  • Map Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet loc = (Center of (Playable map area))
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Picked player) at loc facing Default building facing degrees
          • Set VariableSet dummies[(Player number of (Picked player))] = (Last created unit)
      • Custom script: call RemoveLocation(udg_loc)
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Entangling Roots
    • Actions
      • Set VariableSet loc = (Position of (Triggering unit))
      • Set VariableSet PN = (Player number of (Triggering player))
      • Unit - Move dummies[PN] instantly to loc
      • Unit - Add Roots to dummies[PN]
      • Unit - Set level of Roots for dummies[PN] to (Level of (Ability being cast) for (Triggering unit))
      • Custom script: call RemoveLocation(udg_loc)
      • Set VariableSet loc = (Position of (Target unit of ability being cast))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of loc.) and do (Actions)
        • Loop - Actions
          • Set VariableSet target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • target Not equal to (Target unit of ability being cast)
              • (target belongs to an enemy of (Triggering player).) Equal to True
              • (target is visible to (Triggering player).) Equal to True
              • (target is A structure) Equal to False
              • (target is Mechanical) Equal to False
              • (target is A flying unit) Equal to False
              • (target is alive) Equal to True
            • Then - Actions
              • Unit - Order dummies[PN] to Night Elf Keeper Of The Grove - Entangling Roots target
            • Else - Actions
      • Custom script: call RemoveLocation(udg_loc)
      • Unit - Remove Roots from dummies[PN]
But for this to work, you have to have correctly configured your dummy unit so that it can instant cast spells.

This feels like it's waiting for bug to happen. The unit-order action isn't a queue and it is bound to have delay between the action. Even if I make the dummy with 0 cast point and damage point + making them needless to turn and face the target before casting, it is still possible for dummy to miss a batch of targets
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
This feels like it's waiting for bug to happen. The unit-order action isn't a queue and it is bound to have delay between the action. Even if I make the dummy with 0 cast point and damage point + making them needless to turn and face the target before casting, it is still possible for dummy to miss a batch of targets
It shouldn't cause any bugs assuming that you manage your triggers properly. I've always reused Dummy units in my own maps and have never had any issues that weren't my own doing. The game simply isn't programmed to have "misfires", and if something like that were to occur it'd be because of user error which is a misunderstanding of how the game works and NOT a bug. But I do agree that it requires a deeper understanding to manage properly which could lead to problems.

To clarify on a proper Dummy unit, it means Movement Type = None, Speed Base = 0, and Art - Cast Point and Art - Cast Backswing = 0. Also, remember not to use this method when you want your Dummy unit to cast an Ability that's channeled or that has it's own built in time component.

Here's something similar to what I've done in the past, taking advantage of a Unit Indexer to link the Dummy to their associated Hero:
  • Events
    • Unit - A Hero is created for the first time (how this happens varies from map to map)
  • Conditions
  • Actions
    • Set Variable Hero = (Triggering unit)
    • Unit - Create 1 Dummy for (Owner of Hero) at SomePoint...
    • Set Variable Dummy_Link[(Custom value of (Last created unit)) = Hero
  • Events
    • Unit - A unit Dies
  • Conditions
  • Actions
    • If all conditions are true then do actions
      • If - Conditions
        • Dummy_Link[(Custom value of (Killing unit))] Equal to No unit
      • Then - Actions
        • Set Variable Killing_Unit = (Killing unit)
      • Else - Actions
        • Set Variable Killing_Unit = Dummy_Link[(Custom value of (Killing unit))]
    • Set Variable Death_Event = 1.00
    • Set Variable Death_Event = 0.00
  • Events
    • Unit - A unit Takes damage
  • Conditions
  • Actions
    • If all conditions are true then do actions
      • If - Conditions
        • Dummy_Link[(Custom value of (Damage source))] Equal to No unit
      • Then - Actions
        • Set Variable Damaging_Unit = (Damage source)
      • Else - Actions
        • Set Variable Damaging_Unit = Dummy_Link[(Custom value of (Damage source))]
    • Set Variable Damage_Event = 1.00
    • Set Variable Damage_Event = 0.00
So you would want to have one central "A unit Dies" trigger and one central "Takes damage" trigger, which detect when our Dummy kills/deals damage and redirects the killing unit/damage source to our Hero that is linked to the Dummy unit.

After which, a "custom Event" runs which you would use as the Event for the rest of your "Dies" and "Takes damage" triggers:
  • Events
    • Game - Death_Event becomes Equal to 1.00
  • Conditions
    • (Unit-type of Killing_Unit) Equal to Pit Lord
    • (Level of Corpse Eater for Killing_Unit) Greater than 0
  • Actions
    • Hero - Modify Strength of Killing_Unit: Add 1.
^ Now whenever the Pit Lord OR it's personal Dummy unit gets a kill, the kill credit is redirected to the Pit Lord. This design is very flexible and can support multiple Dummy units per Hero. Note that it's the sort of thing that you want to do from the very beginning since it can be a pain to implement when you're deep into development.
 
Last edited:

Rheiko

Spell Reviewer
Level 27
Joined
Aug 27, 2013
Messages
4,214
This feels like it's waiting for bug to happen. The unit-order action isn't a queue and it is bound to have delay between the action. Even if I make the dummy with 0 cast point and damage point + making them needless to turn and face the target before casting, it is still possible for dummy to miss a batch of targets
To clarify on a proper Dummy unit, it means Movement Type = None, Speed Base = 0, and Art - Cast Point and Art - Cast Backswing = 0. Also, remember not to use this method when you want your Dummy unit to cast an Ability that's channeled or that has it's own built in time component.
Just to add, speed base = 0 ensures that the dummy unit doesn't have to turn and face the target before casting. Art - Cast Point and Art - Cast Backswing = 0 ensures that the dummy unit can cast the ability without waiting for the animation. All these to make sure the spell can be cast almost instantly by the dummy.
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
This feels like it's waiting for bug to happen. The unit-order action isn't a queue and it is bound to have delay between the action. Even if I make the dummy with 0 cast point and damage point + making them needless to turn and face the target before casting, it is still possible for dummy to miss a batch of targets
The trigger I posted is working without any flaws.
Majority of spells are instant cast spells. Exceptions are channeled spells like Starfall, Blizzard, etc. where the caster applies spell's effect periodically.

As @Uncle and @Rheiko pointed out, the reason why spells like Firebolt for standard units are not instant is because:
  • unit must turn to the target, which causes delay. However if unit has 0 movement speed and movement type 'None', it will not turn to the target, and it will cast the spell immediately
  • Animation Cast Point and Cast Backswing are fields for delaying spells cast. They are used so that visually the spell fires when unit for example swings its magic staff (or at some cool-looking point of its spell cast animation). If it were zero for all units, no unit would play its spell cast animation when casting spells. But for invisible dummy unit we don't need any cast spell animation to play, so if we set both fields to zero, it will cause the spell to fire instantly.

Finally, since both things delaying spell cast have been eliminated, your dummy unit can now instant cast multiple spells.
Other stuff that can delay spell cast are:
  • mana cost - if unit has no mana, it cannot cast :)
  • spell cooldown - must be zero
  • distance to target - dummy cannot move, so its spell should have correct range so it can always reach the target
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
All these to make sure the spell can be cast almost instantly by the dummy.
@Weigazod More detail was given by others but to back up this specific claim, things like this will work just fine:
  • Set Dum = Some Unit Somewhere
  • Unit Group - Pick every unit in SomeGroup and do (actions)
    • Loop - Actions
      • Unit - Order Dum to Human Mountain King - Storm Bolt (Picked unit)
  • Set Dum = Some Unit Somewhere
  • Unit - Order Dum to Human Mountain King - Storm Bolt SomeOtherUnit
  • Unit - Move Dum to SomePoint[1]
  • Unit - Order Dum to Human Blood Mage - Flamestrike SomePoint[2]
  • Unit - Move Dum to SomePoint[3]
  • Unit - Order Dum to Night Elf Druid of the Claw - Roar
 
Top