HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Displaying Damage with Floating Text

03-05-2006, 05:05 PM#1
paidan_fain
The gist of what I am doing is creating a floating text that displays the damage taken by any unit to only the owner of the damaged unit.

I was initially going to use a 100% critical strike and base all damage (including spells) off of attacks. However, because every unit in my game has a dodgeable attack (I think its artillery or missile), critical strike doesn't display text (though damage is still calculated).

So, I decided to use the following code and if it had work, it would've given me extra functionality with its support of damage over time, spells, and attacks.

Problem: The Text won't show at all. I have / am currently print at every stage but I can't find the problem.

If its not too much trouble, would someone mind helping me?
If you have a suggestion for another way of doing this, speak up!

Intializes pastLife (arraysize 8192):
Trigger:
intialization at 01
Collapse Events
Time - Elapsed game time is 0.01 seconds
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Collapse Loop - Actions
Set tempIEvery = (tempIEvery + 1)
Unit - Set the custom value of (Picked unit) to tempIEvery
Set pastLife[(Custom value of (Picked unit))] = (Max life of (Picked unit))

Continues to reassign pastLife while displaying floating text at any discontinuities.

Trigger:
Setting life
Collapse Events
Time - Every 0.01 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Collapse Loop - Actions
Set tempIEvery = (tempIEvery + 1)
Unit - Set the custom value of (Picked unit) to tempIEvery
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Life of (Picked unit)) Less than pastLife[(Custom value of (Picked unit))]
Collapse Then - Actions
Floating Text - Create floating text that reads (String((pastLife[(Custom value of (Picked unit))] - (Life of (Picked unit))))) at (Position of (Picked unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Show (Last created floating text) for (Player group((Owner of (Picked unit))))
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Else - Actions
Set pastLife[(Custom value of (Picked unit))] = (Life of (Picked unit))
03-05-2006, 05:20 PM#2
RaptorTeak
I would suggest you :

Trigger IniRecordEvent :

Trigger:
IniRecordEvent
Collapse Events
Time - Elapsed time is 0.50 seconds
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Collapse Loop - Actions
Trigger - Add to ShowText <gen> the event (Unit - (Picked Unit) takes damage)



Trigger RecordEvent :
Trigger:
RecordEvent
Collapse Events
Unit - Unit enters (Playable Map Area)
Conditions
Collapse Actions
Trigger - Add to ShowText <gen> the event (Unit - (Entering Unit) Takes damage)

Trigger ShowText :

Trigger:
ShowText
Events
Conditions
Collapse Actions
Set TempPoint = (Position of (Triggering Unit))
Floating Text - Create floating text that reads (String(Event Response - Damage taken)) at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering Unit))))
Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
Custom Script : call RemoveLocation(udg_TempPoint)

Would be easier, mh ?
03-05-2006, 06:59 PM#3
paidan_fain
Yes, I was thinking of doing it that way but I heard rumors that using the event[specific unit] takes damage doesn't work.

Haven't tried it yet, but it looks prospective.

~Thx~
03-05-2006, 07:12 PM#4
Jacek
A unit takes damage event works...
03-05-2006, 07:15 PM#5
RaptorTeak
Lol, it DOES work !

It's the "Any Unit takes damage" from WEU that may bug, not this one, from official editor ;) . haven't tested my triggers, but I don't see why wouldn't they work :) .

Hope I helped.