• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Trigger not working

Status
Not open for further replies.
Level 7
Joined
Jan 11, 2022
Messages
108
Let me explain first what is trigger supposed to do. Pit of Pain is a spell based on flamestrike. It insta-damages an area and creates a fog. If enemies are in the fog (range of 600 of the created unit) then they have a damage reduction buff. If they quit the fog, buff is removed.. But for some reason it doesn't even cast a cripple buff on the units (checked if the dummy can cast the spell). Also the dummy that is created has a fog model, but after 10sec of expiration timer the fog doesn't disappear...
  • Pit of Pain
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Pit of Pain
    • Actions
      • Set Temppoint = (Target point of ability being cast)
      • Set Tempplayer = (Triggering player)
      • Set Tempunit = (Last created unit)
      • Set Target = (Picked unit)
      • Wait 0.66 game-time seconds
      • Unit - Create 1 Dummy fog for Tempplayer at Temppoint facing default building facing degrees
      • Custom script: call RemoveLocation(udg_Temppoint)
      • Unit - Add Pit of Pain (damage reduce) to Tempunit
      • Unit - Add a 10.00 second generic expiration timer to Tempunit
      • Set Range = 600.00
      • Set Temppoint2 = (Position of Tempunit)
      • Set Tempgroup = (Units within Range of Temppoint2)
      • 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
              • (Target belongs to an enemy of Tempplayer) Equal to True
              • (Target is alive) Equal to True
            • Then - Actions
              • Unit - Order Tempunit to Undead Necromancer: Cripple Target
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Tempgroup)
      • Set Range2 = 50.00
      • Set Tempgroup2 = (Units within Range2 of Temppoint2)
      • Unit Group - Pick every unit in Tempgroup2 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target has buff Pit of Pain buff ) Equal to True
            • Then - Actions
              • Unit - Remove Pit of Pain buff buff from Target
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Tempgroup2)
      • Custom script: call RemoveLocation(udg_Temppoint2)
 
Level 39
Joined
Feb 27, 2007
Messages
5,034
  • Set Tempunit = (Last created unit)
    Set Target = (Picked unit)

    This doesn't work before creating the unit or when out of a Unit Group - Pick... loop (respectively), lol. Things like LCU are resolved to a specific unit when assigned/used. It does not become a stand-in that you can use anywhere you would have used LCU. Picked Unit here returns null. You'll need to assign Tempunit after the dummy is created and assign Target within the Pick loop.
  • Waits in triggers that use variables are bad news. Any other trigger that runs during those 0.66 seconds will overwrite any of those variables if they are used in both triggers. Some specific event responses are also lost/potentially wrong after a wait. Why do you need to delay slightly here?
  • A single dummy unit can cast instantaneously on any number of units without issue, but only if it is properly configured. Is yours? (This isn't the reason it's not working... yet.) It must have all animation cast points/backswing set to 0, 0 move speed, and movement type None.
  • You could reuse both TempPoint and TempGroup since you properly clean their old values/data before you'd be assigning them new ones. For that matter, Temppoint2 will have the same exact coordinates as TempPoint, since you create the dummy at TempPoint and then assign Temppoint2 to the dummy's position!
  • Removing the buff from units in the center will work on-cast, but you'll need something more complex to keep track of which units are where in the circle to properly remove the buff if they leave the fog/enter the middle or if they enter the fog but weren't inside when the ability was cast. If you just want the debuff to be applied on-cast then what you have is fine.
  • The fog doesn't disappear immediately because it doesn't have a death animation. Units will play death animations upon being killed, but if no such animation exists then the current animation will continue until it is finished, even after the unit has died. The solution is to detect when a fog cloud dummy dies and immediately remove it.
 
Level 7
Joined
Jan 11, 2022
Messages
108
1) Fixed that, my mistake setting these variables in wrong places
2) the reason i wanted to delay is because without wait action, the fog appeared before the animation of the Pit of Pain spell and it looked really odd
3) Everything is set correctly (this dummy works with other triggers that also cast many spells instananeously so should also here)
4) So after removing location and destroying groups I can use the same variable to set it to different point/group?
5) welp that's gonna take me sometime to figure out, because as you said, wanted to make it that if unit leaves - buff is removed, if unit re-enters - buff is applied again (same for units that weren't in the range during on-cast)
6) I'll do that later. won't that also remove other dummy fogs (in case any other hero used this ability)?

Cripple still isn't applied to enemies, so I think these variables in wrong places weren't the only issue

Edit: I deleted the second Group Unit - Pick Action and Cripple was applied, so probably it removed the Cripple buff right after giving it, idk why. So now I have to figure out a way to track units in/out the fog lol
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I attached a map with an example of your described ability.

Note that there's all sorts of ways to create custom spells, sometimes you can get away with simple designs like the one in my map and other times you'll need to bust out more advanced techniques like Unit Indexing, Dynamic Indexing, and/or Hashtables.

But in all of these cases you generally use the same few techniques:
  • Creating Dummy unit(s) for casting spells.
  • Using Unit Groups to damage multiple units, cast multiple spells on units, and track units over time.
  • Using another trigger with a Periodic Interval/Timer event for managing over time effects.
I recommend getting the hang of creating simple spells that take advantage of those few techniques. Then once you're comfortable with that move onto harder things like making a spell that uses Dynamic Indexing. Also, the sooner you learn how to use a Unit Indexer the better. It allows you to easily store data to your units, for example you could attach a Special Effect to the Dummy unit in your Pit of Pain spell and Destroy the effect when the Dummy dies. Hashtables are sometimes needed as well but I prefer to use anything else whenever possible. All of these techniques can be combined together to create just about anything you want.
 

Attachments

  • Pit of Pain 1.w3m
    21.6 KB · Views: 3
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
This trigger works perfectly, just as described! What's the purpose of integer variable and doing so FogCount = (FogCount + 1)?
Also you're right, have to sit to it and learn all necessary techniques and try to find ways to do one trigger in many ways, it may help getting hang of it! Thanks for that trigger by the way!!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
This trigger works perfectly, just as described! What's the purpose of integer variable and doing so FogCount = (FogCount + 1)?
Also you're right, have to sit to it and learn all necessary techniques and try to find ways to do one trigger in many ways, it may help getting hang of it! Thanks for that trigger by the way!!
I'm using the Counter to determine when to Turn On and Turn Off the Loop trigger. You don't want the Loop trigger running when the spell isn't active.
 
Status
Not open for further replies.
Top