• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Texttag Velocity Problem

Status
Not open for further replies.
Level 14
Joined
Nov 18, 2007
Messages
1,084
Main Problem: How would I make a text tag move in a parabola?

This can be done as I've seen it in EotA. (On some spells, a texttag shows how much damage/healing it's done and some of the texttags move in parabolas.)

I've made an example picture showing what I want to do in case my explanation wasn't enough. The example picture is what the texttag would look like at bird's eye view, like the normal WC3 camera.

Optional Problem: I would appreciate it if someone could explain or point out what SetTextTagVelocity does in mathematical terms.
 

Attachments

  • texttag problem.PNG
    texttag problem.PNG
    4.3 KB · Views: 67
  • Actions
  • Set Points[1] = (Position of (Triggering unit))
  • Set Points[2] = (Position of (Target unit of ability being cast))
  • Unit - Create 1 Unit for (Owner of (Triggering unit)) at Points[1] facing default building degrees
  • Floating Text - Create floating text that reads (String(0.00)) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Hashtable - Save Handle Of(Last created floating text) as (Key floatingtext) of (Key (Last created unit)) in (Hashtable)
  • Hashtable - Save (Distance between Points[1] and Points[2]) as (Key(distance)) of (Key(Last created unit)) in (Hashtable)
  • Hashtable - Save 200.00 as (Key(maxheight)) of (Key(Last created unit)) in (Hashtable)
  • Hashtable - Save 0.00 as (Key(parabolac)) of (Key(Last created unit)) in (Hashtable)
  • Unit Group - Add (Last created unit) in (Temp_Group)
  • Hashtable - Save (Target unit of ability being cast) as (Key(target)) of (Key(Last created unit)) in Hashtable
  • Trigger - Turn on (Trigger2 <gen>)
  • Custom script: call RemoveLocation (udg_Points[1])
  • Custom script: call RemoveLocation (udg_Points[2])
  • Trigger2
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Temp_Group is empty) Equal to False
      • Then - Actions
        • Set ParabolaCounter = (Load (Key(parabolac)) of (Key(Picked unit)) from Hashtable)
        • Set Distance = (Load (Key(distance)) of (Key(Picked unit)) from Hashtable
        • Set MaxHeight = (Load (Key(maxheight)) of (Key(Picked unit)) from Hashtable
        • Hashtable - Save ((ParabolaCounter) + 30.00) as (Key(parabolac)) of (Key(Picked unit)) in Hashtable
        • Set Points[3] = (Position of (Picked unit))
        • Set Points[4] = (Position of (Load (Key(target)) of (Key(Picked unit)) from (Hashtable)))
        • Set Points[5] = (Points[3] offset by 13.00 towards (Angle between (Points[3]) and (Points[4]))
        • Unit - Move (Picked unit) to (Points[5])
        • Set Parabola = ((((4*(MaxHeight)) / (Distance)) * ((Distance) - (ParabolaCounter)) * ((ParabolaCounter) / (Distance)))
        • Floating Text - Change the position of (Load (Key(floatingtext)) of (Key(Picked unit)) from Hashtable) to (Picked unit) with Z offset Parabola
        • Custom script: call RemoveLocation (udg_Points[3])
        • Custom script: call RemoveLocation (udg_Points[4])
        • Custom script: call RemoveLocation (udg_Points[5])
Well, this is the general idea. Work this trigger further, adding the condition that checks distance between the dummy unit and the target unit, to remove the dummy and the floating text and also add the floating text actions to fading age, if you like.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
So the basic idea is to have an invisible dummy unit and have the text tag attached to it. Then move the dummy unit in the direction the text tag is supposed to go and change z accordingly to a parabola function.

That's a good idea, let me test it.
Edit: It works, though I just used coordinates instead of a dummy unit.
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
I think he means the default offset a floating text has. If you do it on a unit, like I suggested, you would mess up with the default text height (Z), so your own solution was better (creation on point), because it prevents the text from having a default height offset.
Oh I see. Well, your trigger helped me realize a way to manually set a texttag's z coordinate, so I thank you for that. =D
 
Status
Not open for further replies.
Top