- Joined
- May 28, 2007
- Messages
- 365
I'm trying to create a way for floating text to follow a unit and display it's percentage of health.
( It's a dungeon map )
The problem is, I'm almost positive the strings leak or something, and it's lagging my map. There must be a way to fix this, since I know Fate ORPG has similar kind of systems...
The global variable are declared once, at map init. This is probably where the leak is. The event is periodic at 0.05 seconds.
( It's a dungeon map )
The problem is, I'm almost positive the strings leak or something, and it's lagging my map. There must be a way to fix this, since I know Fate ORPG has similar kind of systems...
The global variable are declared once, at map init. This is probably where the leak is. The event is periodic at 0.05 seconds.
JASS:
function Trig_Floating_Text_Actions takes nothing returns nothing
set udg_StringLeak = udg_StringLeak + 1
call SetTextTagPos( udg_HPText[0], GetUnitX(udg_PartyUnit[1])-10, GetUnitY( udg_PartyUnit[1])+20, 0 )
call SetTextTagText( udg_HPText[0], I2S(R2I(GetUnitState(udg_PartyUnit[1], UNIT_STATE_LIFE)/GetUnitState(udg_PartyUnit[1], UNIT_STATE_MAX_LIFE)*100))+"%", 0.023)
call SetTextTagPos( udg_HPText[1], GetUnitX(udg_PartyUnit[2])-10, GetUnitY( udg_PartyUnit[2])+20, 0 )
call SetTextTagText( udg_HPText[1], I2S(R2I(GetUnitState(udg_PartyUnit[2], UNIT_STATE_LIFE)/GetUnitState(udg_PartyUnit[2], UNIT_STATE_MAX_LIFE)*100))+"%", 0.023)
call SetTextTagPos( udg_HPText[2], GetUnitX(udg_PartyUnit[3])-10, GetUnitY( udg_PartyUnit[3])+20, 0 )
call SetTextTagText( udg_HPText[2], I2S(R2I(GetUnitState(udg_PartyUnit[3], UNIT_STATE_LIFE)/GetUnitState(udg_PartyUnit[3], UNIT_STATE_MAX_LIFE)*100))+"%", 0.023)
call SetTextTagPos( udg_HPText[3], GetUnitX(udg_PartyUnit[4])-10, GetUnitY( udg_PartyUnit[4])+20, 0 )
call SetTextTagText( udg_HPText[3], I2S(R2I(GetUnitState(udg_PartyUnit[4], UNIT_STATE_LIFE)/GetUnitState(udg_PartyUnit[4], UNIT_STATE_MAX_LIFE)*100))+"%", 0.023)
call SetTextTagPos( udg_HPText[4], GetUnitX(udg_PartyUnit[5])-10, GetUnitY( udg_PartyUnit[5])+20, 0 )
call SetTextTagText( udg_HPText[4], I2S(R2I(GetUnitState(udg_PartyUnit[5], UNIT_STATE_LIFE)/GetUnitState(udg_PartyUnit[5], UNIT_STATE_MAX_LIFE)*100))+"%", 0.023)
endfunction
Last edited: