Roku
New Member
- Reaction score
- 3
Well the Debug messages are running, but when i cast the spell the target isnt getting healed at all, and at the part when im calling the function "call RemoveLocation (loc), it tells me that loc = null. So im guessing that there is something wrong with the "t" variable.
Oh btw, the ability is based of Holy Light.
JASS:
scope GreaterHeal
private function Conds takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
private function Heal takes nothing returns nothing
local unit t = GetSpellTargetUnit()
local unit u = GetSpellAbilityUnit()
local location loc = GetUnitLoc(t)
local integer s = GetHeroInt(u,true) //Store Int
local real c = I2R(s) //Convert to bonus healing
local real r = GetRandomReal(0.95,1.05) //Set healed amount of normal
local real rint //Critical Bonus Heal
local real cm //Critical Multiplier = rint
local real ch //Roll for chance
local real cp = 15 //Chance to crit
local real h //Amount healed normally
local real hc //Amount healed critical
call SetUnitState(t, UNIT_STATE_LIFE, GetUnitState(t, UNIT_STATE_LIFE) + ((3000 + c) * r))
set h = (3000 + c) * r
set rint = GetRandomReal(1.45, 1.55)
set cm = rint
set ch = GetRandomInt(1, 100) //Rolling
call BJDebugMsg("Registered Heal")
if ch <= cp then
call BJDebugMsg("Registered Crit")
set hc = h * cm
call DisableTrigger( GetTriggeringTrigger() )
call SetUnitState(t, UNIT_STATE_LIFE, GetUnitState(t, UNIT_STATE_LIFE) + (hc - h))
call EnableTrigger( GetTriggeringTrigger() )
call CreateTextTagLocBJ( ( I2S(R2I(hc)) + "!" ), loc, 0, 12.00, 10.00, 100.00, 10.00, 0 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 30.00, 270 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
else
call BJDebugMsg("Registered NonCrit")
call CreateTextTagLocBJ( ( I2S(R2I(h)) + "!" ), loc, 0, 10.00, 20.00, 100.00, 20.00, 0 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 40.00, 270 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.50 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
endif
call RemoveLocation(loc)
set loc = null
set t = null
set u = null
endfunction
//===========================================================================
public function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t, Condition( function Conds ) )
call TriggerAddAction( t, function Heal )
set t = null
endfunction
endscope
Oh btw, the ability is based of Holy Light.