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

Weird trigger bug

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
I got this weird bug with one of my triggers..

  • RHeal
    • Events
      • Time - RTimer[1] expires
      • Time - RTimer[2] expires
      • Time - RTimer[3] expires
      • Time - RTimer[4] expires
      • Time - RTimer[5] expires
      • Time - RTimer[6] expires
      • Time - RTimer[7] expires
      • Time - RTimer[8] expires
    • Conditions
    • Actions
      • Set RHealIndex = (Load 2 of (Key (Expiring timer)) from Hash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RCaster[RHealIndex] has buff Restoration) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: heal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IW[RHealIndex] Equal to True
            • Then - Actions
              • Unit - Set life of RCaster[RHealIndex] to ((Life of RCaster[RHealIndex]) + ((Percentage life of RCaster[RHealIndex]) x RPercentW[(Level of Restoration for RCaster[RHealIndex])]))
              • Game - Display to (All players) the text: (String(((Percentage life of RCaster[RHealIndex]) + RPercentW[(Level of Restoration for RCaster[RHealIndex])])))
              • Animation - Play RCaster[RHealIndex]'s spell animation
            • Else - Actions
              • Unit - Set life of RCaster[RHealIndex] to ((Life of RCaster[RHealIndex]) + ((Percentage life of RCaster[RHealIndex]) x RPercent[(Level of Restoration for RCaster[RHealIndex])]))
              • Game - Display to (All players) the text: (String(((Percentage life of RCaster[RHealIndex]) + RPercent[(Level of Restoration for RCaster[RHealIndex])])))
              • Animation - Play RCaster[RHealIndex]'s spell animation
        • Else - Actions
The animation works, but the 'Unit - Set Life' and debug messages don't.. how's that even possible?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Assuming that the animation works, both the index and the caster values are correct.
A function that is caught in an exception (which stops all its actions) is often made by having an invalid value of a variable.
However, because you are using GUI, I dont really know what variables could be invalid.

Try making the calculations in multiple steps (one step at a time) and display the total amount each step.
So it will look like this:
  • RHeal
    • Events
      • Time - RTimer[1] expires
      • Time - RTimer[2] expires
      • Time - RTimer[3] expires
      • Time - RTimer[4] expires
      • Time - RTimer[5] expires
      • Time - RTimer[6] expires
      • Time - RTimer[7] expires
      • Time - RTimer[8] expires
    • Conditions
    • Actions
      • Set RHealIndex = (Load 2 of (Key (Expiring timer)) from Hash)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RCaster[RHealIndex] has buff Restoration) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: heal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IW[RHealIndex] Equal to True
            • Then - Actions
              • Set TempInteger[0] = (Level of Restoration for RCaster[RHealIndex])
              • Game - Display to (All players) the text: (String(TempInteger[0]))
              • Set TempReal[0] = (Percentage life of RCaster[RHealIndex])
              • Game - Display to (All players) the text: (String(TempReal[0]))
              • Set TempReal[0] = (TempReal[0] x RPercentW[TempInteger[0]])
              • Game - Display to (All players) the text: (String(TempReal[0]))
              • Unit - Set life of RCaster[RHealIndex] to ((Life of RCaster[RHealIndex]) + TempReal[0])
              • Animation - Play RCaster[RHealIndex]'s spell animation
            • Else - Actions
              • Set TempInteger[0] = (Level of Restoration for RCaster[RHealIndex])
              • Game - Display to (All players) the text: (String(TempInteger[0]))
              • Set TempReal[0] = (Percentage life of RCaster[RHealIndex])
              • Game - Display to (All players) the text: (String(TempReal[0]))
              • Set TempReal[0] = (TempReal[0] x RPercent[TempInteger[0]])
              • Game - Display to (All players) the text: (String(TempReal[0]))
              • Unit - Set life of RCaster[RHealIndex] to ((Life of RCaster[RHealIndex]) + TempReal[0])
              • Animation - Play RCaster[RHealIndex]'s spell animation
        • Else - Actions
 
Level 11
Joined
Jan 23, 2015
Messages
788
The variable values are set in a different trigger, I don't think they are the reason for 'heal' not to display, I've also set it as a first action in the trigger, but it still does not appear.. It's the same with 'Set Life', only the animation works..
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Do you have any systems in your map that I should know about...
Maybe a chat system?

EDIT:
Uhm... forget that.
One more question... Do you initialize the timers?

As far as I can see you only use one timer instead of 8.
I think that the spell animation comes from something else and that your trigger doesnt even run at all.

What you need is a trigger like this:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_RTimer[2] = CreateTimer()
      • Custom script: set udg_RTimer[3] = CreateTimer()
      • Custom script: set udg_RTimer[4] = CreateTimer()
      • Custom script: set udg_RTimer[5] = CreateTimer()
      • Custom script: set udg_RTimer[6] = CreateTimer()
      • Custom script: set udg_RTimer[7] = CreateTimer()
      • Custom script: set udg_RTimer[8] = CreateTimer()
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[0] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[1] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[2] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[3] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[4] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[5] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[6] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[7] expires)
      • Trigger - Add to RHeal <gen> the event (Time - RTimer[8] expires)
Then you can remove the events from your RHeal trigger.
 
Level 11
Joined
Jan 23, 2015
Messages
788
  • Restoration
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Restoration
    • Actions
      • Set RIndex = (Player number of (Owner of (Casting unit)))
      • Set RCaster[RIndex] = (Casting unit)
      • Unit - Order (Casting unit) to Stop
      • Unit - Set (Casting unit) acquisition range to 0.00
      • Animation - Play (Casting unit)'s spell animation
      • Countdown Timer - Start RTimer[(Player number of (Owner of (Casting unit)))] as a Repeating timer that will expire in 1.00 seconds
      • Hashtable - Save (Player number of (Owner of (Casting unit))) as 2 of (Key (Last started timer)) in Hash
That's the other trigger, I thought the same about the animation, so I removed the animation action in this trigger, and the animations of the second trigger ran, so in the other trigger, the animation and the If/Then/else WORK, while the other actions DON'T work. Also, there's no other triggers that play this unit's animation, not even the spell..
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
First of all, this one is pretty overpowered as it will heal the caster every second until... until the game ends. So even when the unit is dead, he will be healed.

Another thing is that ONLY player 1 can use this ability because ONLY for player 1 a timer exists.
RTimer[0] and RTimer[1] are a timer but all others are nothing.

Still I dont see why normal actions like text messages are not displayed.
They are in my map.
 
Level 11
Joined
Jan 23, 2015
Messages
788
The buff of the ability lasts for a limited time, and the trigger checks if the unit has the buff or not, I also forgot to pause the timer if the caster does not have the buff..


Another thing is that ONLY player 1 can use this ability because ONLY for player 1 a timer exists.
RTimer[0] and RTimer[1] are a timer but all others are nothing.

What does that mean? The last trigger I've shown you creates a timer for the owner of the caster..

edit: I've also tried to remove all other timers and leave only timer[1], the trigger does not work again..

edit 2: strange, now I realise that all other messages in the map does not display, what the hell?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
No you dont.
You "Start" a timer, you do NOT "Create" a timer.
GUI automatically creates a timer for variables but for arrays it only makes them for index 0 and 1.
All other indexes still need a timer.
However when you test the map as Player 1 red, you have no problem about that because you use index 1.

Also, if you create a new timer after you added the event of the timer expiration, the event wont work for the "new" timer.
If you (re-)start a timer, then the events of that timer still work.
That is why you have to add the events in that map initialization trigger.

Welcome to "The Hell of Warcraft III's World Editor" Season 1 Episode 1, "Timers and GUI!"
 
Level 11
Joined
Jan 23, 2015
Messages
788
Ah, stop with that 'probably', if I did import something like that, that would be the first thing that will come to my mind, and I would check what will happen without it.. I've tested a lot of things before even writing this thread.. and no, I don't have a trigger that runs when a player says something, how can that even affect 'display messages'?

I've shown you all of the triggers (it's only the two above), and there's no trigger "creating a timer".. I'm also not that stupid not to realise that I'm still Player 1 for god sake's.

Does those timers have an Array Value greater than 1? (In Variable Editor/Manager/Thing)

Yes, but that's not the problem, the timers work properly, but the messages does not display..
 
Status
Not open for further replies.
Top