Warcraft III resources & community, 2003–2006 · archived

Need help with overhead damage displays

6 posts
#1

Need help with overhead damage displays

I'm making an RPG and i want an option where when a player hero attacks, the damage amount will be shown with TextTags above the hero. However, I can't figure out how to make the game register the amount of damage that the hero actually did. The function GetEventDamage() only works with the "specific unit takes damage" event, which wouldn't be practical to use, and every other event i've tried always fires the trigger AFTER the damage is done, so there is no way to use arithmetic to figure out the damage. If somebody could help me with this i would really appreciate it.
#2
there is a way without using jass and have it perfectly timed, but it uses a normal ability slot. make a critical strike based spell and set damage multiplier to 1.00.
#3
That's pretty smart, but I would prefer to have the text be independent of critical strike notifications.
#4
ah i found it, use 'conversion - convert real to string => event response - damage taken (at create floating text)
#5
That will not work as "damage taken" is linked to "takes damage" which he does not want to use.

Let us see...

You want the text to show up over the hero instead over the damaged unit...

This is a short solution. It may be enhanced:

trigger "aquireTarget":
function Trig_showText_Actions takes nothing returns nothing
  local texttag tempText = CreateTextTag()
  call SetTextTagText(tempText,R2S(GetEventDamage()),0.023)
  call SetTextTagColor(tempText,255,127,127,0)
  call SetTextTagPosUnit(tempText, - Here your Hero must be put in - ,10)
  call DestroyTextTag(tempText)
  set tempText = null
endfunction

function Trig_aquireTarget_Actions takes nothing returns nothing
  local unit tempUnit = GetEventTargetUnit()
  local trigger trg_showText = CreateTrigger()
  call TriggerRegisterUnitEvent(trg_showText,tempUnit,EVENT_UNIT_DAMAGED)
  call TriggerAddAction(trg_showText,function Trig_showText_Actions)
  loop
    exitwhen(GetUnitState(tempUnit,UNIT_STATE_LIFE) <= 0 or tempUnit != GetEventTargetUnit())
    call TriggerSleepAction(0.05)
  endloop
  call DestroyTrigger(trg_showText)
  set trg_showText = null
endfunction

function InitTrig_aquireTarget takes nothing returns nothing
  set gg_trg_aquireTarget = CreateTrigger()
  call TriggerRegisterUnitEvent(gg_trg_aquireTarget, - Here your Hero must be put in - ,EVENT_UNIT_ACQUIRED_TARGET)
  call TriggerAddAction(gg_trg_aquireTarget,function Trig_aquireTarget_Actions)
endfunction


If the trigger does not work as appropriated or causes trouble otherways, report to me and I will try to solve the problem.
#6

roflggpwndnore

rofalmo charles j00 g0t t3h pwnag3d!!

btw i finished ur terrain. come to my house w/ ur flash stick to get it.