• 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.

Show change in unit health

Status
Not open for further replies.
Level 1
Joined
Apr 4, 2009
Messages
2
Hey, I've been looking studying Show Damage Systems, and was wondering. What excatly makes the GUI systems leak, and how is it fixed?

And is it by any means possible to detect if a unit gains life, as in being healed by a spell.

Thanks
 
Level 16
Joined
Jun 25, 2008
Messages
1,043
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set YourUnitVar = (Target unit of ability being cast)
      • Set UnitHealth = (Life of YourUnitVar)
      • Wait until ((Life of YourUnitVar) Greater than UnitHealth), checking every 0.10 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of YourUnitVar) Greater than UnitHealth
        • Then - Actions
          • Floating Text - Create floating text that reads ((String((Integer(((Life of YourUnitVar) - UnitHealth))))) above YourUnitVar with Z offset 15.00, using font size 10.00, color (20.00%, 100.00%, 20.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 2.00 seconds
        • Else - Actions
Heal-detection-system.

This isn't made for MUI, though, I just wanted to show, basically, how it's made.

If you need it for a map, I could make it MUI though..

And the floating text-effects aren't anything special, if I'd use it in a map that would be edited as well :p

edit: changed it a bit, now it only triggers when a spell is being cast, so it doesn't show a floating text each time the unit regenerates health :e
 
Level 11
Joined
Apr 6, 2008
Messages
760
Why even make a heal detection? use a function instead 100% safe (and more efficent and yes can be used with GUI)

JASS:
call HealUnit("unit","Amount")

add this to the map's header

JASS:
function HealUnit takes unit target, real amount returns nothing
    local texttag Text = CreateTextTag()
    

    call SetTextTagVelocity(Text, 0, .0277 )
    call SetTextTagColor(Text,0,191,0, 255 )
    call SetTextTagText(Text,I2S(R2I(amount)) ,.019) 
    call SetTextTagPosUnit(Text,target, 0 ) 
    call SetTextTagPermanent(Text, false) 
    call SetTextTagLifespan(Text, 2)
    
    call SetWidgetLife(target,GetWidgetLife(target)+amount)
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl",target,"origin"))

    set Text = null    
    set target = null
endfunction

dansaDisco: when ever you cast a damaging spell ur trigger will start a endless loop since it wont get healed
 

Attachments

  • Heal Detection System WITHOUT HEALS.w3x
    17.6 KB · Views: 35
Last edited:
Level 2
Joined
May 27, 2009
Messages
9
Haha, a long 5 min :p

I forgot about this, I'll try to look into it ASAP ^^

Edit: Rewrote the system. Now everything seems to work fine !
Thanks for help
But see on mk and knights...
 

Attachments

  • Heal Detection System MUI FIX.w3x
    21.6 KB · Views: 50
Last edited:
Status
Not open for further replies.
Top