• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Dummy unit not casting ability on enemies in fog of war

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

The following trigger should order the dummy unit to cast Frost Nova on all matching enemies, regardless if the enemy is visible to the triggering player or not. However, in reality the dummy unit casts Frost Nova only on visible enemies (the dummy unit has 0 vision).

  • Unit Group - Pick every unit in (Units within 2000.00 of DB_Point[1].) and do (Actions)
    • Loop - Actions
      • Set VariableSet DB_Unit = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (DB_Unit is alive) Equal to True
          • (DB_Unit has buff Dual Breath ) Equal to True
          • (DB_Unit belongs to an enemy of (Owner of DB_Caster[DB_Index]).) Equal to True
        • Then - Actions
          • Unit - Create 1 Dummy (Ground/Speed 0) for (Owner of DB_Caster[DB_Index]) at DB_Point[1] facing Default building facing degrees
          • Set VariableSet DB_Dummy = (Last created unit)
          • Unit - Add Dual Breath (Slow) to DB_Dummy
          • Unit - Order DB_Dummy to Undead Lich - Frost Nova DB_Unit
          • Unit - Add a 0.50 second Generic expiration timer to DB_Dummy
        • Else - Actions
I assume the reason is that since the dummy unit belongs to the casting player, and the player cannot see the enemy, the dummy unit cannot either "see" the enemy and hence does not cast its ability.

Is there a way to fix this, without giving the dummy unit vision?

Cheers
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
@Warseeker In which way would you suggest to create the visibility? If I give the dummy unit visibility, the the casting player also get (shorty) visibility of the enemy (which is what I don't want for some spells)

@GIMLI_2 The problem is that I'm using a kill system which rewards the "killing player" upon killing an enemy player - so in these cases neutral hostile would get the kill. With this method I'd essentially need to remake all debuffs which damage enemy and create them as triggers... for simple slowing/silencing effects I think that's definitely a good idea though!
 
Last edited:
Level 12
Joined
May 16, 2020
Messages
660
@Devalut Thanks for the tip! Saves a bit of performance I guess. The reason why I usually don't do it, is because sometimes the dummy unit doesn't target all desired targets. For example, Acid Bomb frequently has this issue - in these I cases I just create 1 dummy for 1 target and then it consistently works.

@DoomBlade Unfortuantely no success, with this added condition the dummy still doesn't cast it on enemies outside of vision.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
@Warseeker In which way would you suggest to create the visibility? If I give the dummy unit visibility, the the casting player also get (shorty) visibility of the enemy (which is what I don't want for some spells)
  • Visibility - Create an initially Active visibility modifier for (Owner of (Triggering unit)) emitting Visibility from (Position of (Picked unit)) to a radius of 150.00
  • Unit - Order DB_Dummy to Undead Lich - Frost Nova DB_Unit
  • Wait 0.50 seconds
  • Visibility - Destroy (Last created visibility modifier)
The wait is necessary because frost nova can't be casted if you remove the visibility instantly, I know it may not be the perfect solution but it works nonetheless.
 
Level 12
Joined
May 16, 2020
Messages
660
@Warseeker Thanks, just tried it. But I guess in this case I could just add vision to the dummy unit, would essentially be the same (at least I didn't notice any difference)

@doom_sheep Didn't work unfortunately, still gives vision.

I think if all else fails I will use @GIMLI_2 suggestion - would need to trigger damaging buffs though.

***

EDIT: @chopinski I just realized that in your hero concepts the effects always work through fog of war. Is there something special you do in JASS that allows this?
 
Last edited:
Level 2
Joined
May 25, 2020
Messages
13
Hey Ugabunda,

maybe try using an AOE spell instead of a targeted spell if you have this problem. With AOE spell you only need to get the location of the enemy within 2000 range and force the dummy cast the AOE spell to the target's coordinates even into fog of war.
 
Level 12
Joined
May 16, 2020
Messages
660
@doom_sheep If I do this, it unfortunately doesn't work:

  • Visibility - Create an initially Enabled visibility modifier for Neutral Passive emitting Visibility across (Playable map area)
  • Unit - Create 1 Dummy (Ground/Speed 522) for Neutral Passive at DB_PointTemp facing Default building facing degrees
  • Unit - Change ownership of (Last created unit) to Player 2 (Blue) and Retain color
  • Unit - Order DB_Dummy to Neutral Alchemist - Acid Bomb DB_Unit
But If I delete this line, it does work:

  • Unit - Change ownership of (Last created unit) to Player 2 (Blue) and Retain color
So I guess as soon as you change ownership, the unit cannot target anymore.


@Chickncz Thanks, will keep this in mind for other spells. I think that's only applicable to a few dummy spells however. For cases like Frost Nova or Acid Bomb, I'd need to have a target unit.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
Here's a strange idea: create a dummy frost nova ability that can be casted on the caster then order the target to cast it upon itself. The issue however is that it won't deal damage to nearby units or slow them down.
Otherwise, why not simply trigger the damage when the unit is invisible? It will be a lot easier imo.
 
Level 12
Joined
May 16, 2020
Messages
660
@GIMLI_2 Visibility should be granted instantly imo, as the Neutral Passive player has visibility over the entire map. The point above was referring to the dummy unit being created for Neutral Passive (= have visibility) > Change Ownership to the casting player > Order it to cast Frost Nova / Acid Bomb or whatever. But unfortunately the unit doesn't cast its dummy ability when changing ownership.

@Warseeker I guess this would trigger the casting animation though, so not really viable. And thanks! This is what I actually started doing now. I split the damage part and the slow part of the spell into 2 sections in the trigger. For spells like Frost Nova my issue is now solved, thanks :)

***

@All: For spells which only inflict a status debuff (Frost Nova with 1 AOE, Slow, Silence etc...), I'm using now the Neutral Passive player to cast his stuff. This works wonderfully. The remaining issue are the debuffs which deal damage over time (like Acid Bomb). I can trigger this if required, but if anyone knows a simpler option then very glad to hear it.
 
Level 12
Joined
May 16, 2020
Messages
660
@doom_sheep / @Astrella / whoever else has this problem in the future, this is how I solved it now (for DOT damage):

I used Paladon's DOT system as base, but did adjustments because the "Real" values didn't provide correct numbers.

DOT [GUI-Damage Over Time]

  • Actions to apply Copy
    • Events
    • Conditions
    • Actions
      • Set VariableSet DTA_Target = (Target unit of ability being cast)
      • Set VariableSet DTA_DmgDealer = (Casting unit)
      • Set VariableSet DTA_TotalDamageDealt = (100.00 x (Real((Level of (Ability being cast) for (Casting unit)))))
      • Set VariableSet DTA_CounterMax = 100
      • Set VariableSet DTA_Interval = 5
      • Set VariableSet DTA_Attacktype = Spells
      • Set VariableSet DTA_DamageType = Magic
      • -------- --------
      • Set VariableSet DTA_Buff = Acid Bomb
      • Trigger - Run Get DOT <gen> (checking conditions)

  • Get DOT
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DT_Integer[1] Equal to 0
        • Then - Actions
          • Countdown Timer - Start DT_Timer as a Repeating timer that will expire in 0.10 seconds
          • Trigger - Turn on Deal DOT <gen>
        • Else - Actions
      • Set VariableSet DT_Integer[1] = (DT_Integer[1] + 1)
      • Set VariableSet DT_Integer[2] = (DT_Integer[2] + 1)
      • Set VariableSet DT_Targets[DT_Integer[2]] = DTA_Target
      • Set VariableSet DT_Dealers[DT_Integer[2]] = DTA_DmgDealer
      • Set VariableSet DT_Damage[DT_Integer[2]] = DTA_TotalDamageDealt
      • Set VariableSet DT_DamagePerInterval[DT_Integer[2]] = (DTA_TotalDamageDealt / (Real((DTA_CounterMax / DTA_Interval))))
      • Set VariableSet DT_Interval[DT_Integer[2]] = DTA_Interval
      • Set VariableSet DT_CounterMax[DT_Integer[2]] = DTA_CounterMax
      • Set VariableSet DT_Attacktype[DT_Integer[2]] = DTA_Attacktype
      • Set VariableSet DT_DamageTypes[DT_Integer[2]] = DTA_DamageType
      • Set VariableSet DT_Buff[DT_Integer[2]] = DTA_Buff
  • Deal DOT
    • Events
      • Time - DT_Timer expires
    • Conditions
    • Actions
      • For each (Integer DT_Integer[3]) from 1 to DT_Integer[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DT_Targets[DT_Integer[3]] Not equal to No unit
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (DT_Targets[DT_Integer[3]] is dead) Equal to True
                      • (DT_Targets[DT_Integer[3]] has buff DT_Buff[DT_Integer[3]]) Equal to False
                • Then - Actions
                  • Set VariableSet DT_Counter[DT_Integer[3]] = 0
                  • Set VariableSet DT_Targets[DT_Integer[3]] = No unit
                  • Set VariableSet DT_Integer[1] = (DT_Integer[1] - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DT_Integer[1] Equal to 0
                    • Then - Actions
                      • Set VariableSet DT_Integer[2] = 0
                      • Countdown Timer - Pause DT_Timer
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set VariableSet DT_Counter[DT_Integer[3]] = (DT_Counter[DT_Integer[3]] + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DT_Counter[DT_Integer[3]] mod DT_Interval[DT_Integer[3]]) Equal to 0
                    • Then - Actions
                      • Unit - Cause DT_Dealers[DT_Integer[3]] to damage DT_Targets[DT_Integer[3]], dealing DT_DamagePerInterval[DT_Integer[3]] damage of attack type DT_Attacktype[DT_Integer[3]] and damage type DT_DamageTypes[DT_Integer[3]]
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • DT_Counter[DT_Integer[3]] Equal to DT_CounterMax[DT_Interval[3]]
                        • Then - Actions
                          • Set VariableSet DT_Counter[DT_Integer[3]] = 0
                          • Set VariableSet DT_Targets[DT_Integer[3]] = No unit
                          • Set VariableSet DT_Integer[1] = (DT_Integer[1] - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • DT_Integer[1] Equal to 0
                            • Then - Actions
                              • Set VariableSet DT_Integer[2] = 0
                              • Countdown Timer - Pause DT_Timer
                              • Trigger - Turn off (This trigger)
                            • Else - Actions
                        • Else - Actions
                    • Else - Actions
            • Else - Actions

This applies the correct amount of DOT damage the correct amount of times (something the original system didn't do). It also checks now wheter the unit still has the debuff, and if not, stops doing damage. I'm very happy with this solution - thanks all!
 
Status
Not open for further replies.
Top