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

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! I want to create a floating text that show after X 0.10 seconds the spell will cast. I have created the following :
  • Time till cast
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Casting unit) Equal to Lich 0000 <gen>
    • Actions
      • Floating Text - Create floating text that reads 3.0 above Lich 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Wait 0.10 game-time seconds
      • Floating Text - Destroy (Last created floating text)
      • Floating Text - Create floating text that reads 2.9 above Lich 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Wait 0.10 game-time seconds
      • Floating Text - Destroy (Last created floating text)
      • Floating Text - Create floating text that reads 2.8 above Lich 0000 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Destroy (Last created floating text)
And that repeating 30 times at all till reach zero. The problem is that when the floating text goes somewhere around 1.7 sec my hero has already casted the spell. (i've maked sure that the castung time of my spell is 3 sec) Why?! :cry:
 
Level 8
Joined
Oct 31, 2010
Messages
238
Okay. Few comments. Like what defskull said, don't use waits.
Next, having a Destroy(Last Created Floating Text) after 0.1 second could interfere.
Because if there was another floating text created, this would be destroyed instead of the one you wanted to remove. I suggest using a variable.

By the way, use Unit - A unit Finishes casting an ability
instead. That should solve the problem.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Change the Lifespan to 0.05 seconds
For Frostbolt, Use Concatenate string
String 1 is Frost bolt (text) (space here)
String 2 is Timer (Real variable) (Convert Real to String action)

I can't trigger it right now, in DotA game >.<
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
I hate to put in my maps triggers that i don't understand, so i've been watching all that triggers and after 10 min i have tried to make them and i actually made it :
  • first trig
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
    • Actions
      • Set Caster = (Triggering unit)
      • Set Timer = 3.00
  • second trig
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Timer Greater than 0.00
        • Then - Actions
          • Floating Text - Create floating text that reads (Flame Strike in + ((String(Timer)) + sec.)) above Caster with Z offset 30.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 0.15 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.10 seconds
        • Else - Actions
          • Floating Text - Destroy (Last created floating text)
      • Set Timer = (Timer - 0.10)
  • third trig
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • Timer Greater than 0.01
    • Actions
      • Game - Display to (All players) the text: Player 1's Flame St...
      • Set Timer = 0.00
:wink: but i have a tiny little problem - the floating text is a little bit in the right and i want it right above the caster. Please help :D And i want to ask a thing - what means
  • Floating Text - Change (Last created floating text): Disable permanence
???
 
Level 8
Joined
Oct 31, 2010
Messages
238
The floating text is already on top of the caster. Because it is directly on top, and that whatever text is from left to right reading order. So when the text is created, it continues on in the right direction.

E.g. The below: [The 3.00 is the text, the . is the point of caster]
----------------------
3.00
.
----------------------
See now?

  • Floating Text - Change (Last created floating text): Disable permanence
Means that the floating text is not permanent; allowing you to do changes to it.
A permanent floating text cannot be removed.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
The floating text is already on top of the caster. Because it is directly on top, and that whatever text is from left to right reading order. So when the text is created, it continues on in the right direction.

E.g. The below: [The 3.00 is the text, the . is the point of caster]
----------------------
3.00
.
----------------------
See now?

  • Floating Text - Change (Last created floating text): Disable permanence
Means that the floating text is not permanent; allowing you to do changes to it.
A permanent floating text cannot be removed.
Ok. But how i can make it be from the left of the caster, so when it is writed from the left to right it will just gonna be what i want?
 
Level 8
Joined
Oct 31, 2010
Messages
238
Instead of creating the floating text above the unit, I create the floating text above the unit, with the offset towards left, so when the left to right reading order applies, the floating text looks centralized.

Here's a test map.

Btw, if you need it in MUI, I can do it, if you want.
 

Attachments

  • timer.w3x
    13.9 KB · Views: 45
Level 37
Joined
Mar 6, 2006
Messages
9,240
Sorry for the really delayed map, was busy. Anyway, here's it! :D

Code review here, read if you're interested :)


There's no need for this. You never have to store/load the unit like this. You need the unit's handle to load something from a hashtable, and if you have the handle, you already have another reference to the unit.
  • Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Triggering unit)) in Timer_Hash
You don't need to load the value, just set it to a real value:
  • Floating Text - Create floating text that reads (String((Load 1 of (Key (Triggering unit)) from Timer_Hash))) at TempPoint with Z offset 150.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Update trigger is always on. turn it off when the group is empty, and on when the unit count goes from 0 to 1. Same with stop trigger, it shouldn't be always on.

You're doing both these checks during every loop, which is not needed.
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Equal to 0.00
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Less than or equal to 0.10
You don't flush child hashtables.

You are leaking. Position of a unit is one point, the offset point is another. You are not removeing them.
  • Set TempPoint = ((Position of (Triggering unit)) offset by 110.00 towards 180.00 degrees)
 
Level 8
Joined
Oct 31, 2010
Messages
238
Code review here, read if you're interested :)


There's no need for this. You never have to store/load the unit like this. You need the unit's handle to load something from a hashtable, and if you have the handle, you already have another reference to the unit.
  • Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Triggering unit)) in Timer_Hash
You don't need to load the value, just set it to a real value:
  • Floating Text - Create floating text that reads (String((Load 1 of (Key (Triggering unit)) from Timer_Hash))) at TempPoint with Z offset 150.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Update trigger is always on. turn it off when the group is empty, and on when the unit count goes from 0 to 1. Same with stop trigger, it shouldn't be always on.

You're doing both these checks during every loop, which is not needed.
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Equal to 0.00
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Less than or equal to 0.10
You don't flush child hashtables.

You are leaking. Position of a unit is one point, the offset point is another. You are not removeing them.
  • Set TempPoint = ((Position of (Triggering unit)) offset by 110.00 towards 180.00 degrees)

Haha, thanks for reviewing! Anyways, this is the first few times I am sing hashtables.. So.. Maybe about what flushing thing I don't get it:)

Can you edit that map and show me the better way of doing it? :D
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Code review here, read if you're interested :)


There's no need for this. You never have to store/load the unit like this. You need the unit's handle to load something from a hashtable, and if you have the handle, you already have another reference to the unit.
  • Hashtable - Save Handle Of(Triggering unit) as 2 of (Key (Triggering unit)) in Timer_Hash
You don't need to load the value, just set it to a real value:
  • Floating Text - Create floating text that reads (String((Load 1 of (Key (Triggering unit)) from Timer_Hash))) at TempPoint with Z offset 150.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Update trigger is always on. turn it off when the group is empty, and on when the unit count goes from 0 to 1. Same with stop trigger, it shouldn't be always on.

You're doing both these checks during every loop, which is not needed.
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Equal to 0.00
  • (Load 1 of (Key (Picked unit)) from Timer_Hash) Less than or equal to 0.10
You don't flush child hashtables.

You are leaking. Position of a unit is one point, the offset point is another. You are not removeing them.
  • Set TempPoint = ((Position of (Triggering unit)) offset by 110.00 towards 180.00 degrees)

I've finded hashtable tutorial and i read it. Now i will practice! Thanks!!!
 
Last edited:
Status
Not open for further replies.
Top