Name | Type | is_array | initial_value |
group | group | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
scope HolyLight initializer Init
//We have a scope now.
globals
private constant integer AbilityID = 'A001' // The raw code (ID) of the abillity that will trigger this.
private constant real TextTagSize = 9.00 // The size of the text tags (floating texts) which show the damage or healing amount.
private constant real TextTagVelocity = 45.00 // The velocity of the text tags (floating texts)
private constant real TextTagFadePoint = 3.00 // At this point the text tag starts fading.
private constant real TextTagDeathPoint = 5.50 // At this point the text tag dies.
private constant real TextTagZoffset = 30.00 // Height of the text tag above the target.
private constant boolean TextTagVisible = true // I guess you want it visible, don't you?
// SET TO "false" FOR NO TEXT TAGS! (without quote marks...)
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == AbilityID
endfunction
private function Actions takes nothing returns nothing
local real r = ( I2R(GetHeroInt(GetSpellAbilityUnit(), true)) * I2R(GetUnitAbilityLevel(GetSpellAbilityUnit(), AbilityID)) )
local texttag tt = CreateTextTag()
call SetTextTagVelocity(tt, 0, TextTagVelocity * 0.071 / 128 ) //The text will only go up. I used ' * 0.071 / 128' to avoid using a BJ.
call SetTextTagPermanent(tt, false )
call SetTextTagFadepoint(tt, TextTagFadePoint )
call SetTextTagLifespan(tt, TextTagDeathPoint )
call SetTextTagVisibility(tt, TextTagVisible )
call SetTextTagPosUnit(tt, GetSpellTargetUnit(), TextTagZoffset)
if ( IsPlayerAlly(GetOwningPlayer(GetSpellTargetUnit()), GetOwningPlayer(GetSpellAbilityUnit())) == true ) then
call SetWidgetLife( GetSpellTargetUnit(), ( GetUnitState( GetSpellTargetUnit(), UNIT_STATE_LIFE ) + r ) )
//---
call SetTextTagText(tt, ( "+" + ( I2S ( R2I (r) ) + " HP" ) ), TextTagSize * 0.023 / 10 ) //Avoided using a BJ.
call SetTextTagColor(tt, 230, 230, 150, 255 )
// R G B Alpha
debug call BJDebugMsg(GetUnitName(GetSpellTargetUnit()) + " has been healed for " + R2S(r) + " HP!")
else
call UnitDamageTarget( GetSpellAbilityUnit(), GetSpellTargetUnit(), r, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS )
//---
call SetTextTagText(tt, ( "-" + ( I2S ( R2I (r) ) + " HP" ) ), TextTagSize * 0.023 / 10 ) //Avoided using a BJ.
call SetTextTagColor(tt, 230, 100, 150, 255 )
// R G B Alpha
debug call BJDebugMsg(GetUnitName(GetSpellTargetUnit()) + " has been damaged for " + R2S(r) + " HP!")
endif
endfunction
//===========================================================================
// Now the basic trigger initialization.
private constant function AntiLeak takes nothing returns boolean
return true
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local filterfunc f = Filter(function AntiLeak)
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, f)
set i = i + 1
exitwhen i >= 16
endloop
call TriggerAddCondition(t, Condition( function Conditions ) )
call TriggerAddAction(t, function Actions )
call DestroyFilter(f)
set f = null
endfunction
endscope