• 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.

[Spell] Dummy unit won't cast a skill

Status
Not open for further replies.
Level 3
Joined
Apr 21, 2009
Messages
42
How this skill supposed to work:
If my hero attacks a unit within his 200 range, a dummy unit would pick 1 random enemy unit within his 600 range of my hero and cast "Storm Bolt"

Problem:
Even though my dummy unit is created on the position of the random unit within the 600 range, that unit won't use the skill "Storm Bolt" to that enemy unit.

(well sometimes, it works, but most of the time it doesn't)
NOTE: The "Storm Bolt" is the skill basis of the "Storm Master Lightning Effect" skill

  • Storm Master
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) belongs to an enemy of (Owner of HeavyRain_caster)) Equal to True
      • (Attacking unit) Equal to HeavyRain_caster
      • HeavyRain_chk Equal to 1
    • Actions
      • Unit Group - Pick every unit in (Units within 200.00 of (Position of HeavyRain_caster)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Equal to (Attacked unit)
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 600.00 of (Position of HeavyRain_caster)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of HeavyRain_caster)) Equal to True
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to HeavyRain_targetGrp
                    • Else - Actions
                      • Do nothing
            • Else - Actions
              • Do nothing
      • Unit - Create 1 Dummy Skiller Unit for (Owner of HeavyRain_caster) at (Position of (Attacked unit)) facing Default building facing degrees
      • Set StormMaster_attacker = (Last created unit)
      • Unit - Add Storm Master (Lightning Effect) to StormMaster_attacker
      • If ((Level of Storm Master for HeavyRain_caster) Equal to 1) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 1) else do (Do nothing)
      • If ((Level of Storm Master for HeavyRain_caster) Equal to 2) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 2) else do (Do nothing)
      • If ((Level of Storm Master for HeavyRain_caster) Equal to 3) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 3) else do (Do nothing)
      • Unit - Order StormMaster_attacker to Human Mountain King - Storm Bolt (Random unit from HeavyRain_targetGrp)
      • Unit - Remove StormMaster_attacker from the game
Please help. Thanks!
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Level 12
Joined
Mar 13, 2012
Messages
1,121
I see no big mistakes in the trigger. My guess is you didnt give your dummy 0 ms, which requires it to turn when casting a spell. Or maybe you didnt set the castpoint to 0.

Btw, removing the unit from the game instantly after cast will mess up the kill detection, incase that stormbolt is dealing any damage.
 
Level 3
Joined
Sep 9, 2009
Messages
658
Use If/Then/Else multiple actions in your trigger.

For the unit groups, use Unit Group - Pick Every Unit In Range Matching Conditions. Also, store your unit groups in a variable and destroy them afterwards.

Never use position of unit. It leaks. Store it into a variable first then remove it.

And what's HeavyRainchk supposed to be? If that's part of another trigger maybe you should post them too. It could be another trigger affecting this one.

For the conditions, try checking if the attacked unit is in the group instead of checking if the picked unit is equal to the attacking unit.

Edit: And like they said above, don't remove the dummy unit. Use an expiration timer instead. It could be that the dummy is removed before it can even cast the spell.
 
Level 3
Joined
Apr 21, 2009
Messages
42
The dummy doesn't have a movement speed, it doesn't need to, cast range is 200 range, w/c i think is sufficient enough. <hr>

Thanks for the link! Btw, any suggestions for the level to be triggered in a more sufficient way?<hr>
Just for the update here's the new trigger
  • Storm Master
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) belongs to an enemy of (Owner of HeavyRain_caster)) Equal to True
      • (Attacking unit) Equal to HeavyRain_caster
      • HeavyRain_chk Equal to 1
    • Actions
      • Unit Group - Pick every unit in (Units within 600.00 of (Position of HeavyRain_caster)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Equal to (Attacked unit)
            • Then - Actions
              • Unit Group - Pick every unit in (Units within 600.00 of (Position of HeavyRain_caster)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of HeavyRain_caster)) Equal to True
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to HeavyRain_targetGrp
                    • Else - Actions
            • Else - Actions
      • Unit Group - Pick every unit in (Random 1 units from (Random 1 units from HeavyRain_targetGrp)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy Skiller Unit for (Owner of HeavyRain_caster) at (Position of (Picked unit)) facing Default building facing degrees
          • Set StormMaster_attacker = (Last created unit)
          • Unit - Add Storm Master (Lightning Effect) to StormMaster_attacker
          • If ((Level of Storm Master for HeavyRain_caster) Equal to 1) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 1) else do (Do nothing)
          • If ((Level of Storm Master for HeavyRain_caster) Equal to 2) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 2) else do (Do nothing)
          • If ((Level of Storm Master for HeavyRain_caster) Equal to 3) then do (Unit - Set level of Storm Master (Lightning Effect) for StormMaster_attacker to 3) else do (Do nothing)
          • Unit - Order StormMaster_attacker to Human Mountain King - Storm Bolt (Picked unit)
          • Unit Group - Remove all units from HeavyRain_targetGrp
          • Wait 2.00 seconds
          • Unit - Remove StormMaster_attacker from the game
 
Last edited:
Level 3
Joined
Apr 21, 2009
Messages
42
Checking if the Heavy Rain is currently in effect.

Use If/Then/Else multiple actions in your trigger.
And what's HeavyRainchk supposed to be? If that's part of another trigger maybe you should post them too. It could another trigger affecting this one.


This is a passive ability and would only work if the Heavy Rain skill is in effect.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Don't use waits if your unit attacks more than once in 2 seconds which I'd assume it does it will bug.

Just use an expiration timer on the dummy.

If you really want it removed just in another trigger do
a unit dies
unit type of triggering unit == dummy
remove triggering unit from game

Still leaking btw

Edit:

Why is the cast range 200 if it looks for units in a 600 AoE?
Set Level of Dummy Storm bolt to the level of Passive for X unit
 
Level 3
Joined
Sep 9, 2009
Messages
658
  • Unit - Set level of Storm Bolt for (Last created unit) to (Level of YourSkill for (HeavyRain_caster))
You might want to do this instead of the ITE conditions.

EDIT: And this as well.
  • Untitled Trigger 003
    • Set Loc = (Position of (Triggering unit))
    • Set TempGroup = (Units within 600.00 of Loc matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Attacked unit) is in TempGroup) Equal to True
          • Then - Actions
          • Else - Actions
    • Custom script: call RemoveLocation (udg_Loc)
    • Custom script: call DestroyGroup(udg_TempGroup)
EDIT: Of course, set triggering unit to a variable first but you're already doing that do no worries there.
 
Level 3
Joined
Apr 21, 2009
Messages
42
Yes I did

hey have you read the link?

Actually we have the same problem and if you just read the link your problem is fix now..

Yes I did, the solution was

Code:
Custom script: call IssueTargetOrder (udg_dummyvar, "thunderbolt", udg_targetvar)

I'm not actually familiar of using custom scripts and I'm trying to learn that right now on the link provided to me above.



Thanks for the suggestions, I'm gonna follow all your advice and I'll update soon!
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Yes I did, the solution was

Code:
Custom script: call IssueTargetOrder (udg_dummyvar, "thunderbolt", udg_targetvar)

I'm not actually familiar of using custom scripts and I'm trying to learn that right now on the link provided to me above.



Thanks for the suggestions, I'm gonna follow all your advice and I'll update soon!

Goodluck with your problem hope it will be solved..
 
Level 3
Joined
Sep 9, 2009
Messages
658
I realized one thing with your trigger. I might be wrong but your trigger doesn't have to be as long as that. It sort of feels like you're checking for redundant things.

In the first half of your trigger, you're adding the units to another group, when you could just easily pick a random unit from that group and stun them.

I think it would be better if you just make one group, check if attacked unit is there, and pick a random unit to stun. Actually, I don't get why you even need to check for the attacked unit. The trigger occurs by a unit being attacked and it'd be very rare for attacked unit to suddenly disappear within range of the caster.
 
Level 3
Joined
Apr 21, 2009
Messages
42
  • Unit - Set level of Storm Bolt for (Last created unit) to (Level of YourSkill for (HeavyRain_caster))
You might want to do this instead of the ITE conditions.

EDIT: And this as well.
  • Untitled Trigger 003
    • Set Loc = (Position of (Triggering unit))
    • Set TempGroup = (Units within 600.00 of Loc matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False))
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Attacked unit) is in TempGroup) Equal to True
          • Then - Actions
          • Else - Actions
    • Custom script: call RemoveLocation (udg_Loc)
    • Custom script: call DestroyGroup(udg_TempGroup)
EDIT: Of course, set triggering unit to a variable first but you're already doing that do no worries there.

Thanks this great help a lot! However this part only checks units that are attacked in 200 range. (Note before a dummy unit would be created and issued to skill "storm bolt" any random 1 enemy unit in 600 range, my hero should be attacking an enemy unit first that's within a 200 range

But I think I actually just need to use the same "functions" for the 2nd part to work and use this
Code:
Custom script: call IssueTargetOrder (udg_dummyvar, "thunderbolt", udg_targetvar)
to issue the dummy unit to skill the "random enemy unit w/in the 600 range", am I right?
 
Level 6
Joined
Feb 5, 2012
Messages
1,685
Thanks this great help a lot! However this part only checks units that are attacked in 200 range. (Note before a dummy unit would be created and issued to skill "storm bolt" any random 1 enemy unit in 600 range, my hero should be attacking an enemy unit first that's within a 200 range

But I think I actually just need to use the same "functions" for the 2nd part to work and use this
Code:
Custom script: call IssueTargetOrder (udg_dummyvar, "thunderbolt", udg_targetvar)
to issue the dummy unit to skill the "random enemy unit w/in the 600 range", am I right?

Absolutely..
 
Level 3
Joined
Sep 9, 2009
Messages
658
I tried doing your trigger. Basically, what it does is that every time your Hero attacks and it has Heavy Rain active, a random unit will be stunned. Is that right?

  • Storm Master
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) belongs to an ally of (Owner of HeavyRain_caster)) Equal to False
      • (Level of Heavy Rain for (Attacking unit)) Greater than 0
    • Actions
      • Set HeavyRain_caster = (Attacking unit)
      • Set Loc = (Position of HeavyRain_caster)
      • Set TempGroup = (Units within 600.00 of Loc matching (((Matching unit) belongs to an ally of (Owner of HeavyRain_caster)) Equal to False))
      • Unit - Create 1 Dummy for (Owner of HeavyRain_caster) at Loc facing Default building facing degrees
      • Unit - Add Storm Bolt to (Last created unit)
      • Unit - Set level of Storm Bolt for (Last created unit) to (Level of Heavy Rain for HeavyRain_caster)
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Random unit from TempGroup)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_Loc)
      • Custom script: call DestroyGroup(udg_TempGroup)
The conditions aren't the same because I don't know what HeavyRain is but I think this shortens your trigger while still getting the desired effects. But I don't understand the 200 range part. The ability only activates if the attacked unit is within 200 range of the Hero?

EDIT: I got what you mean now.

  • Storm Master
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) belongs to an ally of (Owner of HeavyRain_caster)) Equal to False
      • (Level of Heavy Rain for (Attacking unit)) Greater than 0
    • Actions
      • Set HeavyRain_caster = (Attacking unit)
      • Set Loc[0] = (Position of HeavyRain_caster)
      • Set Loc[1] = (Position of (Attacked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between Loc[0] and Loc[1]) Less than or equal to 200.00
        • Then - Actions
          • Set TempGroup = (Units within 600.00 of Loc[0] matching (((Matching unit) belongs to an ally of (Owner of HeavyRain_caster)) Equal to False))
          • Unit - Create 1 Dummy for (Owner of HeavyRain_caster) at Loc[0] facing Default building facing degrees
          • Unit - Add Storm Bolt to (Last created unit)
          • Unit - Set level of Storm Bolt for (Last created unit) to (Level of Heavy Rain for HeavyRain_caster)
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Random unit from TempGroup)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Loc[0])
      • Custom script: call RemoveLocation(udg_Loc[1])
I tested it. It should work although 200 is practically the same as melee range. You have to be really close for it to work.

Again the conditions aren't the same as yours but the basic idea of what you want should be there.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I also thought about checking for dead units but sometimes I wonder if there's even any point to that for pure damage spells.

The spell could random a dead unit instead of a unit that is alive. Creating a unit is also a costly operation and should be avoided for invalid targets. Creating a unit causes a very tiny memory leak.
 
Status
Not open for further replies.
Top