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

Floating text above buildings like in the troll and elves

Status
Not open for further replies.
Level 6
Joined
Jan 16, 2017
Messages
107
Hi everyone i am making on map that is based on troll and elves but i need to know how to make floating text like in troll and elves. I know how to do it but its a lot buggy. If you know how to do it without any bugs then reply please thanks.
 
Level 4
Joined
May 20, 2011
Messages
59
Hey, I'm not too sure what you mean by "Buggy" but to answer your question as to how to create Floating Text, its like this.

You would first create a Region by selecting the Region Palette in Tools, same area of the interface where you select Units and such, but instead of Units or Doodads just select Regions.

Then, Create a Region where you would like you desired Floating Text to be. Name, color it, do whatever you wish.

Then, Create a Trigger titled FloatingTextTrigger or whatever you may like and add an Event that you would like, maybe Map Initialization. Once you've done this, add a Wait Action as a safeguard and give it 0.25 Seconds.

Ex.) Wait - 0.25 Seconds.
Then, from Actions select the Dropdown Box and click "Floating Text" and select at Center of "RegionYouCreated", in regards to coloring your Floating Text, change the percentages as you desire. Seeing as how many including myself are used to RedGreenBlue (RGB) Values, this link will help with coloring the text. Floating Text Colors?? | The Helper
 
Level 6
Joined
Jan 16, 2017
Messages
107
Hey, I'm not too sure what you mean by "Buggy" but to answer your question as to how to create Floating Text, its like this.

You would first create a Region by selecting the Region Palette in Tools, same area of the interface where you select Units and such, but instead of Units or Doodads just select Regions.

Then, Create a Region where you would like you desired Floating Text to be. Name, color it, do whatever you wish.

Then, Create a Trigger titled FloatingTextTrigger or whatever you may like and add an Event that you would like, maybe Map Initialization. Once you've done this, add a Wait Action as a safeguard and give it 0.25 Seconds.

Ex.) Wait - 0.25 Seconds.
Then, from Actions select the Dropdown Box and click "Floating Text" and select at Center of "RegionYouCreated", in regards to coloring your Floating Text, change the percentages as you desire. Seeing as how many including myself are used to RedGreenBlue (RGB) Values, this link will help with coloring the text. Floating Text Colors?? | The Helper
so i should put regions everywhere on the map that has 256x256? there must be easier way
 
Last edited:
Level 4
Joined
May 20, 2011
Messages
59
so i should put regions everywhere on the map that has 256x256? there must be easier wait
Everywhere on the Map? How many Floating Texts do you even want? If your talking thousands than that is just ridiculous. I'm confused by what your looking for, do you want the Floating Text to pop up when something happens? Is it in one spot the whole time? And no to my knowledge there is no easier way, you must place them in a region or above a unit.
 
Level 13
Joined
May 10, 2009
Messages
868
You can create floating texts at a point or above a unit.

After creating your floating text, set it to not be considered as permanent, and add fading time and lifespan to it. You can also move it towards any angle at any given speed.

Example:
  • Actions
    • -------- EITHER --------
    • Set point = (Center of Region 000 <gen>)
    • Floating Text - Create floating text that reads VALUE at point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Custom script: call RemoveLocation(udg_point)
    • -------- OR --------
    • Floating Text - Create floating text that reads VALUE above Paladin 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • -------- THEN DO MORE ACTIONS --------
    • Set floatingText = (Last created floating text)
    • Floating Text - Set the velocity of floatingText to 64.00 towards (Random real number between 85.00 and 95.00) degrees
    • Floating Text - Change floatingText: Disable permanence
    • Floating Text - Change the fading age of floatingText to 1.00 seconds
    • Floating Text - Change the lifespan of floatingText to 2.00 seconds
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
but i need to know how to make floating text like in troll and elves.
And what is that exactly? Never played the map, too busy. Please post a screenshot or video of what you want.
I know how to do it but its a lot buggy.
Please post a screenshot of video of the bugs as well as your current triggers in text form.
 
Level 6
Joined
Jan 16, 2017
Messages
107
You can create floating texts at a point or above a unit.

After creating your floating text, set it to not be considered as permanent, and add fading time and lifespan to it. You can also move it towards any angle at any given speed.

Example:
  • Actions
    • -------- EITHER --------
    • Set point = (Center of Region 000 <gen>)
    • Floating Text - Create floating text that reads VALUE at point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • Custom script: call RemoveLocation(udg_point)
    • -------- OR --------
    • Floating Text - Create floating text that reads VALUE above Paladin 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
    • -------- THEN DO MORE ACTIONS --------
    • Set floatingText = (Last created floating text)
    • Floating Text - Set the velocity of floatingText to 64.00 towards (Random real number between 85.00 and 95.00) degrees
    • Floating Text - Change floatingText: Disable permanence
    • Floating Text - Change the fading age of floatingText to 1.00 seconds
    • Floating Text - Change the lifespan of floatingText to 2.00 seconds
and how can i do it periodically? :D
 
Level 13
Joined
May 10, 2009
Messages
868
It's simple. Just take the hydraulic phase shift emulator--

Create a unit group and add structures/units to it when they are constructed/trained. Then, you use another trigger with a timer event, and use For Group to enumerate through those units, creating a floating text where they are.


EDIT: I added an example below.
The problem with the map you mentioned is that it doesn't check if a building is completely constructed. It gives gold to players as soon as such structures enter the map. However, there's an easy way to avoid this problem.

All right, here's a simple example where I give gold to players who own one or more farms:

  • Income Register Structure
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Income_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn on Income Loop <gen>
        • Else - Actions
      • Unit Group - Add (Triggering unit) to Income_Group
I am adding the farm to the group, but prior to that, I check if there's no unit in the group. That means the Loop trigger is turned off. So, turn it on.

  • Income Unregister Structure
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in Income_Group) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from Income_Group
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Income_Group) Equal to 0
        • Then - Actions
          • Trigger - Turn off Income Loop <gen>
        • Else - Actions
If a farm gets destroyed, you simply remove it from the group. After that, check if there's no units left in the group. If yes, then turn the loop trigger off.

  • Income Loop
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set udg_localPlayer = GetLocalPlayer()
      • Unit Group - Pick every unit in Income_Group and do (Actions)
        • Loop - Actions
          • Set buildPlayer = (Owner of (Picked unit))
          • -------- Create Floating Text --------
          • Floating Text - Create floating text that reads |cffffcc00+2|r above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set lastTextTag = (Last created floating text)
          • Floating Text - Set the velocity of lastTextTag to 64.00 towards 90.00 degrees
          • Floating Text - Change lastTextTag: Disable permanence
          • Floating Text - Change the fading age of lastTextTag to 0.75 seconds
          • Floating Text - Change the lifespan of lastTextTag to 1.50 seconds
          • -------- Show it for only one player --------
          • Custom script: if udg_localPlayer != udg_buildPlayer then
          • Custom script: call SetTextTagVisibility(udg_lastTextTag, false)
          • Custom script: endif
          • -------- Do whatever actions you want to do --------
          • Player - Add 2 to buildPlayer Current gold
You probably noticed that I used the GetLocalPlayer() function in order to hide the floating text for other players. I also used another player variable to NOT call the ( Owner of (unit) ) multiple times.

However, I believe that for this example only, this is quite an exaggeration. I recommend that you do this for triggers where you call the same function more than 4~5 times in a row. The same applies for other functions such as Picked Unit, Triggering Unit, Last Created Floating Text, etc...

NOTE: Floating texts are also known as text tag. I just named that variable as lastTextTag, because I'm lazy.
 

Attachments

  • Income.w3x
    18.4 KB · Views: 65
Last edited:
Level 11
Joined
May 16, 2016
Messages
730
Hi everyone i am making on map that is based on troll and elves but i need to know how to make floating text like in troll and elves. I know how to do it but its a lot buggy. If you know how to do it without any bugs then reply please thanks.
There is the simplest template. YOu don't need to use anything else.
 

Attachments

  • BUILDING TEXT.w3x
    14.9 KB · Views: 67
Status
Not open for further replies.
Top