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

Problem with Text-Mesage Trigger

Status
Not open for further replies.
Level 8
Joined
Mar 26, 2009
Messages
301
EDIT: I've found out that it's a duplicate trigger issue. Sorry =))
Following Trigger causes "Unable to repair" message to be shown double times at screen. What is wrong with it?
  • Engineering Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Enginneering
    • Actions
      • Set Engineer = (Casting unit)
      • Set Engineer_Owner_Player = (Owner of (Triggering unit))
      • Set Enginneer_Mana = ((Integer((Mana of (Casting unit)))) - 15)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Unit-type of (Target unit of ability being cast)) Equal to Turret) or (((Unit-type of (Target unit of ability being cast)) Equal to Heavy Turret) or ((Unit-type of (Target unit of ability being cast)) Equal to X-22K Prototype))
              • (Integer((Percentage life of (Target unit of ability being cast)))) Not equal to 100
        • Then - Actions
          • Sound - Play Repairing <gen> at 100.00% volume, attached to (Target unit of ability being cast)
          • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + ((Max life of (Target unit of ability being cast)) / 10.00))
        • Else - Actions
          • Game - Display to (Player group(Engineer_Owner_Player)) the text: |cffFF0000Unable to...
          • Wait 0.01 seconds
          • Unit - Set mana of Engineer to ((Real(Enginneer_Mana)) + 15.00)
      • Set Engineer = No unit
 
  • (Integer((Percentage life of (Target unit of ability being cast)))) Not equal to 100
You don't have to change it into an integer, just make a Real comparison.

The "And - Conditions" is not necessary, by default, conditions piled up together are under an invisible "and" ;)

I guess it has to do with the conditions, since they both seem to meet the requirement, the message appears twice. Try using one condition and in the "Then - Actions", use your other one and let us know.
 
Level 8
Joined
Mar 26, 2009
Messages
301
Game - Display to (Player group(Engineer_Owner_Player)) the text: |cffFF0000Unable to...

- Leaks

I advise referencing "Engineer" variable instead of repeatedly trying to get the Triggering/Casting unit. And I would only use Triggering unit, never casting unit, as it's faster.
Fixed casting-triggerring unit stuff and stuff Pharaoh_ suggested. But how do I prevent that leak? If I manually create a Player Group, how do I destroy it? Is there a custom script for that?
 
Status
Not open for further replies.
Top