• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Floating text

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2010
Messages
480
I just copy this trigger from one map. i forgot the site where i downloaded, but i do have one problem, when i try to make this work like every unit has the players name. it doesn't work. the one made it gave up because he can't fix it.



  • Floating Text
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Floating Text - Destroy text_player[(Integer A)]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                • Loop - Actions
                  • Set text_point[1] = (Position of (Picked unit))
              • Set text_point[2] = (text_point[1] offset by 50.00 towards 180.00 degrees)
              • Floating Text - Create floating text that reads (Name of (Player((Integer A)))) at text_point[2] with Z offset 100.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Set text_player[(Integer A)] = (Last created floating text)
              • Custom script: call RemoveLocation(udg_text_point[1])
              • Custom script: call RemoveLocation(udg_text_point[2])
            • Else - Actions
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
I did not say that only but the trigger...oviously without text_point[2] then there's no floating text and so on...

You didn't get me. I know that you haven't said 'only' and for sure you knewn that all other actions should be there - thats why i said 'heh' becasue it looked funny to see all the actions outside loop.

;) for you.
 
Level 9
Joined
Apr 7, 2010
Messages
480
@Bribe, oh sorry about that.

guys. i remove if/then/else and i put all the triggers in the loop. still doesn't work
  • Floating Text
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Floating Text - Destroy text_player[(Integer A)]
          • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            • Loop - Actions
              • Set text_point[1] = (Position of (Picked unit))
              • Set text_point[2] = (text_point[1] offset by 50.00 towards 180.00 degrees)
              • Floating Text - Create floating text that reads (Name of (Player((Integer A)))) at text_point[2] with Z offset 100.00, using font size 8.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Set text_player[(Integer A)] = (Last created floating text)
              • Custom script: call RemoveLocation(udg_text_point[1])
              • Custom script: call RemoveLocation(udg_text_point[2])
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
looks OK to me...
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            • Loop - Actions
              • Set text[1] = (Position of (Picked unit))
              • Set text[2] = (text[1] offset by 50.00 towards 180.00 degrees)
              • Floating Text - Create floating text that reads (Name of (Player((Integer A)))) at text[2] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Custom script: call RemoveLocation(udg_text[1])
              • Custom script: call RemoveLocation(udg_text[2])
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
What I don't get is: why loop from 1 to 10 if you pick all units either way?
It'll be a complete chaos of text tags (every unit will have 10 player names above its head).

Additional mistakes:
1) Do not use arrays for locations if you just end up using 2 array slots either way.
2) "set bj_wantDestroyGroup = true"
3) He wants the text tags to move with the units, not appear and fade above them every 2 seconds (that's a bit sloppy).
4) You can also use "Above unit" if you don't want to use locations.

  • FloatingText
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set textTagHandleID = (Key (Picked unit))
          • Floating Text - Destroy (Load 0 of textTagHandleID in textTagTableIf the label is not found, this function returns NULL.)
          • Floating Text - Create floating text that reads (Name of (Owner of (Picked unit))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Hashtable - Save Handle Of(Last created floating text) as 0 of textTagHandleID in textTagTable
This works.
Don't forget to initialize the table though.

Demo-map attached.

Note: there can only be 100 texttags (floating texts) in a map at a time! This is a limit in Wacraft's coding.
You have to make sure that you can never exceed this limit, otherwise you'll have to drop this idea.


Edit: I just noticed how sloppy Blizzard added the hashtable stuff in GUI... they actually accidentally merged a part of the action's comment with the action's name (see the "destroy floating text" part).
Lazy Blizz...
 

Attachments

  • Floating Text.w3x
    19.7 KB · Views: 45
Level 9
Joined
Apr 7, 2010
Messages
480
thanks ap0calypse +rep

btw, does adding color to the floating text for every player going to make the trigger complicated? like player 1 red, then player 2 blue. if not please show me how to do it. thanks. ... if yes, hahaha i don't want to make much trouble, you guys already have solved this problem. : )
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
It's not really difficult ^^
First you have to set up some variables at map initialization, like this:

  • Initialize Colors
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Color Codes --------
      • Set Color[1] = |c00ff0303
      • Set Color[2] = |c000042ff
      • Set Color[3] = |c001CE6B9
      • Set Color[4] = |c00540081
      • Set Color[5] = |c00FFFC01
      • Set Color[6] = |c00FE8A0E
      • Set Color[7] = |c00FE8A0E
      • Set Color[8] = |c00E55BB0
      • Set Color[11] = |c00106246
      • Set Color[12] = |c004E2A04

Then you just have to show: playerColor[player number of (Owner of (Picked Unit))]" + (name of player) + "|r" in the floating text.
Or something, I don't actually have the world editor at hand right now.
Well, I hope you understand the idea behind it :)
 
Level 9
Joined
Apr 7, 2010
Messages
480
thanks, i'm going to test it right now.

and lol. you're making triggers without a world editor??? you must be a pro : )

{EDIT}
lol.. i suck in editing.
  • FloatingText
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set textTagHandleID = (Key (Picked unit))
          • Floating Text - Destroy (Load 0 of textTagHandleID in textTagTableIf the label is not found, this function returns NULL.)
          • Floating Text - Create floating text that reads (Color[(Player number of (Owner of (Picked unit)))] + ((Name of (Triggering player)) + |r)) above (Picked unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Hashtable - Save Handle Of(Last created floating text) as 0 of textTagHandleID in textTagTable
can't find the "player"Color and (name of "player") .. trigger does not work now..

--how do i remove the floating text for player 16 (neutral) ??
--how do i remove the floating text for dead units
 
Last edited:
Level 9
Joined
Apr 7, 2010
Messages
480
  • FloatingText
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) is dead) Equal to False) and (((Matching unit) is in (Units owned by Neutral Passive)) Equal to False))) and do (Actions)
        • Loop - Actions
          • Set textTagHandleID = (Key (Picked unit))
          • Floating Text - Destroy (Load 0 of textTagHandleID in textTagTableIf the label is not found, this function returns NULL.)
          • Floating Text - Create floating text that reads (Name of (Owner of (Picked unit))) above (Picked unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Hashtable - Save Handle Of(Last created floating text) as 0 of textTagHandleID in textTagTable
thanks, +rep. how about the color?

--i can't find this condition "matching unit is owned by neutral = false".. lol.
i used this instead "(((Matching unit) is in (Units owned by Neutral Passive)) Equal to False)))" or is it the same??

{EDIT}
((((Matching unit) is dead) Equal to False) "does not work."
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Here is some typical Blizzard stupidity:
"Is unit alive == true" calls "Is unit dead == false", "is unit dead == false" calls "is unit HP greater than 0 == true".

So in the end, you should just use a real comparison: check whether the HP of the unit is greater than 0.405
  • (Life of (Matching unit)) Greater than or equal to 0.40
And I'm sorry, I was kind-of switching a few variable names, the "playerColor" should just be "Color".
Although the general variable naming conventions states that variables should start with a lower-case letter and every word behind it must begin with a capital letter, such as: "thisIsAnExample", or "dialogButtons", or "playerColor".
Well, that's just so you know :D


  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Hashtable - Create a hashtable
      • Set textTagTable = (Last created hashtable)
      • -------- Color Codes --------
      • Set playerColor[1] = |c00ff0303
      • Set playerColor[2] = |c000042ff
      • Set playerColor[3] = |c001ce6b9
      • Set playerColor[4] = |c00540081
      • Set playerColor[5] = |c00fffc01
      • Set playerColor[6] = |c00fe8a0e
      • Set playerColor[7] = |c001fbf00
      • Set playerColor[8] = |c00e45aaf
      • Set playerColor[9] = |c00949596
      • Set playerColor[10] = |c007dbef1
      • Set playerColor[11] = |c000f6145
      • Set playerColor[12] = |c004d2903

  • FloatingText
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set textTagHandleID = (Key (Picked unit))
          • Floating Text - Destroy (Load 0 of textTagHandleID in textTagTableIf the label is not found, this function returns NULL.)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Greater than or equal to 0.40
              • (Owner of (Picked unit)) Not equal to Neutral Hostile
              • (Owner of (Picked unit)) Not equal to Neutral Passive
              • ((Picked unit) is hidden) Equal to False
            • Then - Actions
              • Floating Text - Create floating text that reads (playerColor[(Player number of (Owner of (Picked unit)))] + ((Name of (Owner of (Picked unit))) + |r)) above (Picked unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Hashtable - Save Handle Of(Last created floating text) as 0 of textTagHandleID in textTagTable
            • Else - Actions
That should work.
 
Level 9
Joined
Apr 7, 2010
Messages
480
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set textTagTable = (Last created hashtable)
      • Set playerColor[1] = |c00ff0303
      • Set playerColor[2] = |c000042ff
      • Set playerColor[3] = |c001CE6B9
      • Set playerColor[4] = |c00540081
      • Set playerColor[5] = |c00FFFC01
      • Set playerColor[6] = |c00FE8A0E
  • FloatingText
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Set textTagHandleID = (Key (Picked unit))
          • Floating Text - Destroy (Load 0 of textTagHandleID in textTagTableIf the label is not found, this function returns NULL.)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Picked unit)) Greater than or equal to 0.40
              • (Owner of (Picked unit)) Not equal to Neutral Hostile
              • (Owner of (Picked unit)) Not equal to Neutral Passive
              • ((Picked unit) is hidden) Equal to False
            • Then - Actions
              • Floating Text - Create floating text that reads playerColor[((Player number of (Owner of (Picked unit))) + ((Integer((Name of (Owner of (Picked unit))))) + (Integer(|r))))] above (Picked unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Hashtable - Save Handle Of(Last created floating text) as 0 of textTagHandleID in textTagTable
            • Else - Actions
doesnt work.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
My version:

(playerColor[(Player number of (Owner of (Picked unit)))] + ((Name of (Owner of (Picked unit))) + |r))


Your version:

playerColor[((Player number of (Owner of (Picked unit))) + ((Integer((Name of (Owner of (Picked unit))))) + (Integer(|r))))]


I don't even know how you managed to convert "Name of {player}" to an integer, but apparently you did. (And "|r" is also an integer in your trigger?)
 
Level 9
Joined
Apr 7, 2010
Messages
480
My version:

(playerColor[(Player number of (Owner of (Picked unit)))] + ((Name of (Owner of (Picked unit))) + |r))


Your version:

playerColor[((Player number of (Owner of (Picked unit))) + ((Integer((Name of (Owner of (Picked unit))))) + (Integer(|r))))]


I don't even know how you managed to convert "Name of {player}" to an integer, but apparently you did. (And "|r" is also an integer in your trigger?)

T_T..... there is no choices "Player - Player Name" without converting to integer. lol. @_@ confused...
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
T_T..... there is no choices "Player - Player Name" without converting to integer. lol. @_@ confused...
Woah, I understand where you went wrong...
You put the entire string in the array! Only the player number is meant to go inside it...

You have to use concatenate strings, set the first value to playerColor[(Player number of (Owner of (Picked unit)))] and use concatenate strings on the second value again.
 
Level 9
Joined
Apr 7, 2010
Messages
480
oh lol!! now i seeee : )) huge mistake. sorry

{EDIT} now working. lol, i can't give rep right now, need to spread some more : ))
 
Last edited:
Status
Not open for further replies.
Top