• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Why target unit of ability being cast not works properly in here? I have already solved, just wanted to share

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,193
This is not working (not passing Then)

  • MagnataurQ Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reckless Hit //
    • Actions
      • Unit - Create 1 DUMMY [JFA] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Unit - Add Fireball // master to (Last created unit)
      • Unit - Set level of Fireball // master for (Last created unit) to 23
      • Unit - Order (Last created unit) to Neutral - Firebolt (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 1.00 seconds the text: YES
        • Else - Actions
          • Game - Display to (All players) for 1.00 seconds the text: NO
But this does.

  • MagnataurQ Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reckless Hit //
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is A Hero) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 1.00 seconds the text: YES
        • Else - Actions
          • Game - Display to (All players) for 1.00 seconds the text: NO
      • Unit - Create 1 DUMMY [JFA] for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Unit - Add Fireball // master to (Last created unit)
      • Unit - Set level of Fireball // master for (Last created unit) to 23
      • Unit - Order (Last created unit) to Neutral - Firebolt (Target unit of ability being cast)
What is the mystery behind it? It was bug for the previous versions or am i missing something imporant in here?
 
Level 13
Joined
Jan 10, 2023
Messages
211
Not sure, does the fireball find the target? Either way if you set the target to a variable at the top then you can just use the variable

Edit:
I would be somewhat surprised if this caused the issue, I should hope it doesn't get interpreted as a comment but I recommend not naming anything "Fireball // master"
or more specifically, never using "//" in a name.
For the sake of ruling it out I would change that name, maybe "Fireball - master" instead?

When the second trigger fires, does the whole trigger work or just the debug msg? If the second trigger also fails to cast the fireball, maybe that's a hint toward the "don't use comment tags (//) in names" theory ?
 
Last edited:
Level 26
Joined
Sep 26, 2009
Messages
2,436
The (Target unit of ability being cast) is a global variable, meaning it can get overwritten.
This is what happens:
  1. Unit casts an ability
  2. Ability is Reckless Hit
    1. At this point, the (Target unit of ability being cast) refers to the target of Reckless Hit
  3. You create a dummy, give it fireball, order it to cast the fireball on some target
  4. Since the dummy is casting a spell, it fires a new "Unit casts an ability" event
    1. At this point, the (Target unit of ability being cast) refers to the target of the Fireball spell
  5. After any trigger that satisfies the event has been finished, the (Target unit of ability being cast) is nulled
  6. Now you get back to your trigger. The If/then/else does not work because there is no longer any (Target unit of ability being cast)
 
Level 26
Joined
Sep 26, 2009
Messages
2,436
I am not sure, I have no experience with event filters. If it works with those filters, I imagine you would need to use them in all your triggered spells.
But this is a very specific use-case as I believe this only works with dummies - since a properly setup dummy has no turn rate, no movement and has 0.00 cast point, it can "inject" its own cast event into the currently running cast event trigger. But setting for example cast point to 0.001 will prevent such behavior.
 
Level 26
Joined
Sep 26, 2009
Messages
2,436
Is it as it supposed to be or bug?
That's hard to say, but it's not the only case where triggers behave this way.
Actually, I think this behavior is in many cases beneficial - for example damage detection systems make use of this behavior.
On your side to prevent this issue, all you have to do is store the unit in your own variable, so it's easy fix/prevention on your side.
 
Status
Not open for further replies.
Top