• 🏆 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 texts disappear

Status
Not open for further replies.
Level 20
Joined
Jul 6, 2009
Messages
1,885
I've got a problem while i was making a custom unit leveling system.
Here's thread that's describing it: http://www.hiveworkshop.com/forums/requests-341/unit-level-system-157818/

The problem is that some levels aren't shown,for example,when unit gains 2nd level, "II" appears above it and disappears immediately after. Also i tried to set that event occurs every second and i've noticed that even levels aren't shown,such as 2nd,4th,6th etc...why is that? :confused:
+rep for help!
  • Floating Text Appearing
    • Event
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Text_Group = (Units in (Playable map area))
      • Unit Group - Pick every unit in Text_Group and do (Actions)
        • Loop - Actions
          • Floating Text - Destroy (Load 1 of (Key (Picked unit)) in Level_HashIf the label is not found, this function returns NULL.)
      • Custom script: call DestroyGroup(udg_Text_Group)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Set Camera_Point = (Target of current camera view)
          • Custom script: endif
          • Set Text_Group = (Units within 800.00 of Camera_Point matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))
          • Unit Group - Pick every unit in Text_Group and do (Actions)
            • Loop - Actions
              • Set Temp_Point1 = (Position of (Picked unit))
              • Set Temp_Point2 = (Temp_Point1 offset by (20.00, 50.00))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 0 of (Key (Picked unit)) from Level_Hash) Less than 4
                • Then - Actions
                  • Floating Text - Create floating text that reads I at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                  • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 4
                    • Then - Actions
                      • Floating Text - Create floating text that reads II at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                      • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 7
                        • Then - Actions
                          • Floating Text - Create floating text that reads III at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                          • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 11
                            • Then - Actions
                              • Floating Text - Create floating text that reads IV at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                              • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 16
                                • Then - Actions
                                  • Floating Text - Create floating text that reads V at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                  • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 22
                                    • Then - Actions
                                      • Floating Text - Create floating text that reads VI at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                      • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 29
                                        • Then - Actions
                                          • Floating Text - Create floating text that reads VII at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                          • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 37
                                            • Then - Actions
                                              • Floating Text - Create floating text that reads VIII at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                              • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 46
                                                • Then - Actions
                                                  • Floating Text - Create floating text that reads IX at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                                  • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 56
                                                    • Then - Actions
                                                      • Floating Text - Create floating text that reads X at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                                      • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                                    • Else - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • (Load 0 of (Key (Picked unit)) from Level_Hash) Equal to 67
                                                        • Then - Actions
                                                          • Floating Text - Create floating text that reads XI at Temp_Point2 with Z offset 0.00, using font size 8.00, color (100.00%, 80.00%, 1.00%), and 0.00% transparency
                                                          • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
                                                        • Else - Actions
              • Custom script: call RemoveLocation(udg_Temp_Point1)
              • Custom script: call RemoveLocation(udg_Temp_Point2)
          • Custom script: call DestroyGroup(udg_Text_Group)
          • Set Text_Group = (Units in (Playable map area))
          • Unit Group - Pick every unit in Text_Group and do (Actions)
            • Loop - Actions
              • Floating Text - Hide (Load 1 of (Key (Picked unit)) in Level_HashIf the label is not found, this function returns NULL.) for (All players matching (((Picked unit) is fogged to (Picked player)) Equal to True))
          • Custom script: call DestroyGroup(udg_Text_Group)
 
You create the floating text and you hide it right after. What do you need to achieve, because this seems like it needs to be optimized a lot. Plus, you don't need the action
  • Hashtable - Save Handle Of(Last created floating text) as 1 of (Key (Picked unit)) in Level_Hash
On every "Then". Just place it in the end of all If/Then/Else's.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
I hide it right after? i hide it just for fogged units and if i hide it,why does floating texts for some levels appear and for some don't?
Also the system looks a bit strange,but that's due to fact that Warcraft can support maximum of 100 texts at a time,so i had to make texts only at areas under each player's view.
So the system works like this: I delete each floating text in the map,then i determine center of each player's view and pick units around 800 range from that target,i create floating text for each picked unit that will depend on the experience of each unit,and finally i hide texts for fogged units. System again deletes each text because if players moved cameras,those that are out of view,must be deleted and repeats the whole procces.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Set Text_Group = (Units within 800.00 of Camera_Point matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))
Why Player 1 and not Picked Player?

I don't think you should be creating and Destroying Text Group all the time. Add and remove units from it when needed.
 
Level 11
Joined
Jan 25, 2009
Messages
572
You are destroying the variable "Text_Group" twice and also, you are leaking the player group. Fix that by using, a BJ or a variable and destroy the variable. I highly recomend you to use a variable and destroy it. =)

EDIT: Nevermind about the player group. t's not eaking. Didn't saw the All players.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
The main problem is why floating texts don't appear.
And i'll explain why i make and destroy "Text_Group" twice - First time i make it,i destroy all the texts on the map,second time i hide texts previously made. So i can't put these functions together because:
-if i put the function where i destroy texts to place where i hide texts,it will immediately destroy them after they've been made thus they won't appear.
-if i put the function where i hide the texts to place where i destroy 'em it won't hide texts because it hides them before they are actually made.
So i have to put those 2 functions separately and that's why i am making the group twice.
 
Status
Not open for further replies.
Top