• 🏆 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!

Make earthquake debuff not affect allies

Status
Not open for further replies.
Level 2
Joined
Dec 9, 2018
Messages
4
Hi, I'm having a little trouble making a spell. Right now I have a spell that makes a dummy cast earthquake on the position of the caster, and I'm trying to figure out how to best go about making earthquake not affect allies. As of right now my trigger removes the debuff earthquake from the caster unit but I feel this is a really gross way of doing it. Any advice on how to do this better or on how to make it not affect allies would be much appreciated!

Here's my absolutely atrocious way of getting earthquake to cast on my unit, I am aware I should use a variable for the dummy due to the function Last created unit being able to pick up something else if someone uses a spell at the same time but lets just ignore that for now.

  • Titanic Slam
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Titanic Slam
    • Actions
      • Unit - Create 1 dummy caster for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add Titanic Slam Effect to (Last created unit)
      • Set Caster = (Triggering unit)
      • Set TitanicSlamCounter = 0
      • Trigger - Turn on Remove Debuff <gen>
      • Unit - Order (Last created unit) to Orc Far Seer - Earthquake (Position of (Triggering unit))
      • Wait 5.00 seconds
      • Unit - Remove (Last created unit) from the game
Here is my Remove Debuff Trigger, right now it just removes the buff every 0.01 seconds from the caster. I feel this is really bad and I'm not sure how to improve this, let alone make it not affect allies too.

  • Remove Debuff
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • TitanicSlamCounter Less than or equal to 500
    • Actions
      • Set TitanicSlamCounter = (TitanicSlamCounter + 1)
      • Unit - Remove Earthquake buff from Caster
 
Level 11
Joined
Nov 23, 2013
Messages
665
Instead of removing debuffs via triggers, why don't you set the earthquake spell's targets to enemy only, not friend? (in Object Editor, "Stats - Targets Allowed")
Just make sure the dummy is a friend and the trick should be done.

Something else that could be helpful: instead of removing Last created unit after a few seconds (which uses a Wait action, it's bad in case of multiple uses of the Last created unit, as you mentionned), you may add an expiration timer to Last created unit. It will automatically kill the dummy after X seconds.
 
Level 2
Joined
Dec 9, 2018
Messages
4
Wow, I've often heard the phrase the simplest solution is usually the best but now I just feel silly. I had originally assumed just because "Stats - Targets Allowed" had nothing checked except for Debris, Ground, Structure, Tree, that it was hard coded to hit units and there was nothing I could do about it! I just checked off "Enemy" and now it doesn't affect friendlies!

Also wow I didn't think of that for how to deal with those dummy units, I was gonna end up making a variable for everything once I was finished rough outlines of hero's, thats awesome, saves me a lot of time! Thanks for the help.
 
Level 38
Joined
Feb 27, 2007
Messages
4,951
I am aware I should use a variable for the dummy due to the function Last created unit being able to pick up something else if someone uses a spell at the same time but lets just ignore that for now.
It seems you understand this, but this is only a problem because of the Wait command. Triggers effectively run instantly all the way through unless something they do causes another trigger to fire. That second trigger will then run all the way through before going back to finish the first. No two triggers (or two instances of the same trigger) can be running simultaneously if they don't involve waits.
 
Status
Not open for further replies.
Top