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

Floating Text Problems

Status
Not open for further replies.
Level 9
Joined
Oct 3, 2006
Messages
302
SO I'm trying to create a floating text on a boss fight that says "ROAR!" And destroy it after 2 seconds.

So, I create a "Floating Text Variable" that's titled "ROAR"

I use the triggers.
upload_2016-8-31_1-14-0.png


The only problem with this is that, the same map has these following triggers as default

upload_2016-8-31_0-37-5.png


I'm scared that the supposed to be Floating Text for "Grunt Mumbling" may be set as the "ROAR/Sasquatch Pause" Floating text variable and vice versa if the timer hits the same.

How do I avoid having this problem?
 

Attachments

  • upload_2016-8-31_0-35-52.png
    upload_2016-8-31_0-35-52.png
    34.6 KB · Views: 60
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Once can make floating text automatically destroy/fade itself after a certain period of time. This is done by disabling permanence, setting a duration and setting a fade point. If fade point is equal to duration then it will disappear after the duration expires, otherwise if fade point is less than duration it will fade starting at the fade point until being completely transparent at the end of the duration. One can also give the floating text velocity so it moves, but that is optional.
 
Level 9
Joined
Oct 3, 2006
Messages
302
Once can make floating text automatically destroy/fade itself after a certain period of time. This is done by disabling permanence, setting a duration and setting a fade point. If fade point is equal to duration then it will disappear after the duration expires, otherwise if fade point is less than duration it will fade starting at the fade point until being completely transparent at the end of the duration. One can also give the floating text velocity so it moves, but that is optional.
How do you do this? Can you make an example?

Also, can I create and destroy a Floating Text without using any Variables to save/set/destroy the Floating Text?

tnx in advanced
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,030
I'm not at the WE right now but I believe they are listed under floating text actions in the trigger editor. Something like

  • Floating Text - disable permanence for (last created floating text)
  • Floating Text - Make (last created floating text) expire after 2.00 seconds
And just so you know no two triggers will ever run at the exact sam moment (ExecuteFunc is kind of an exception to that but you will likely never use it). Things like (last created unit) will always work fine as long as you don't have any Wait actions in it. Such references will definitely break after waits (like the one in your trigger) so you need to store them into variables you only use in that trigger (exactly like you did).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Also, can I create and destroy a Floating Text without using any Variables to save/set/destroy the Floating Text?
You need to at least use 1 variable. Even if that is the global variable "last created floating text" that GUI provides.

How do you do this? Can you make an example?
By doing what I said? Disable permanence, set duration, set fade point, set velocity.

(ExecuteFunc is kind of an exception to that but you will likely never use it).
That still runs in a well defined, not concurrent, order. WC3 game engine is single threaded so outside some I/O and miscellaneous threads, everything runs in a single thread and as such everything has a well defined order.
Things like (last created unit) will always work fine as long as you don't have any Wait actions in it.
They will break if some action is run which spawns another trigger thread. For example damaging a unit when that unit is hooked with an on-damage event.
Such references will definitely break after waits (like the one in your trigger) so you need to store them into variables you only use in that trigger (exactly like you did).
Nothing stops the trigger running multiple times concurrently though. The best is to use local variables to hold such values. Due to how badly designed WC3 GUI is local variables are not available in GUI and can only be used by wiring JASS directly. This was fixed in StarCraft II where local variables are available in GUI.
 
Status
Not open for further replies.
Top