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

[Trigger] Floating Text problem

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2015
Messages
171
Hi guys, how to make floating text damage not become stackable when it display damage? my problem is when unit with poison damage attacking me and another unit is attacking too..that poison damage and other unit damage appear at the same time..how do i fix this? thanks
 
Level 6
Joined
Jan 2, 2015
Messages
171
Sorry, can you write the trigger example?

heres my trigger i currently use

Display
Events
Game - GDD_Event becomes Equal to 0.00

Conditions

Actions
Set TempPoint = (Position of GDD_DamagedUnit)
Floating Text - Create floating text that reads (String((Integer(GDD_Damage)))) at (Position of GDD_DamagedUnit) with Z offset 5.00, using font size 12.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 50.00 towards 90.00 degrees
Floating Text - Change the lifespan of (Last created floating text) to 0.50 seconds
Floating Text - Change the fading age of (Last created floating text) to 0.10 seconds
Custom script: call RemoveLocation(udg_TempPoint)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Just save each floating text string in a variable with an array. and simultaneously make a periodic event having the floating texts being shown, and separate them with the time of 0.3 or 0.4 or 1 second as you want. So you need two triggers:
Just a very cool first trigger
  • Events
    • Unit - A Unit is attacked
  • Conditions
    • == Your conditions here
  • Actions
    • Set FloatingTextNumber = (FloatingText Number + 1)
    • Set FloatingText[FloatingTextNumber] = (Damage received by (Attacked Unit))
    • Set FT_Point[FloatingTextNumber] = #Your position#
What about a second trigger?
  • Events
    • Time - Periodic Event : 0.3 seconds
  • Conditions
  • Actions
    • CurrentFLTingText = (CurrentFLTingText + 1)
    • Floating Text - Create floating text that reads (FloatingText[CurrentFLTingText])... in point FL_Point[CurrentFLTingText]...
    • === Your options here ===
    • === You can make it when the CurrentFLTingText integer reaches some value it gets reset, so does every FloatingText string. Just to avoid afaik the op limit of array.
REMARK : You have to save the point in a hashtable for example or just a single variable using the current floating text array and then remove the leak immediately. (included in the triggers EDITED).

ANOTHER SOLUTION : Just set the point where the floating text floats, and distinguish every text which has a distance of the previous attack less than 50. And separate them by 50 for example.
 
I don't recommend neither "collecting" damage over a small time frame nor delaying the floating texts. Both look unintuitive and have an impact on the responsiveness of the combat text.

Instead, I recommend only 'counting' the number of floating texts above that specific unit over a small time span and offsetting the texts by a small X and Y amount depending on the text count on said unit. I did that in Gaias and it works (and looks) great when multiple damage sources hit the target at the same time.
 
Level 6
Joined
Jan 2, 2015
Messages
171
I don't recommend neither "collecting" damage over a small time frame nor delaying the floating texts. Both look unintuitive and have an impact on the responsiveness of the combat text.

Instead, I recommend only 'counting' the number of floating texts above that specific unit over a small time span and offsetting the texts by a small X and Y amount depending on the text count on said unit. I did that in Gaias and it works (and looks) great when multiple damage sources hit the target at the same time.

sorry, can you provide me your trigger on Gaias? Maybe u can help modify my trigger that i post before..
 
I only code jass, so it won't be a much help, I guess. But it's easy. You can do this on your own. Just increment the counter on every damage event and decrease it again by 1 every 0.2 seconds through a periodic timer.

Then, in the damage event response, just check what the counter variable is and offset the texts.
counter == 0 --> x, y remain unchanged
counter == 1 --> set x = x-100
counter == 2 --> set x = x+100
counter == 3 --> set y = y-100
counter >= 4 --> set y = y+100

If you want it more sophisticated, you can have a counter on each unit individually by using a unit indexer, as you usually want the displacement individually for every unit.
 
Status
Not open for further replies.
Top