Another problem.. :(

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.

JASS:
scope GreaterHeal

private function Conds takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
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.
 

Darg

Administrator
Reaction score
49
When in doubt, debug further I say ....

1) Trace what "GetUnitState(t, UNIT_STATE_LIFE)" is returning
2) Trace what "(3000 + c) * r)" is returning
3) Add a "call UnitAddIndicatorBJ( t, 100, 100, 100, 0 )" and see if the target unit gets a white speech circle flashing around it

Question: any particular reason you did

Code:
call SetUnitState(t, UNIT_STATE_LIFE, GetUnitState(t, UNIT_STATE_LIFE) + ((3000 + c) * r))
set h = (3000 + c) * r

instead of

Code:
set h = (3000 + c) * r
call SetUnitState(t, UNIT_STATE_LIFE, GetUnitState(t, UNIT_STATE_LIFE) + h)

?
 

Terrabull

Veteran Member (Done that)
Reaction score
38
If you think it's a problem w/ the unit, make a debug message that displays which unit it is, maybe pings the map to make sure it's that unit.
Let us know what that does.
Maybe this spell does not target a unit, maybe it targets a point.
 

Roku

New Member
Reaction score
3
Ok, well i didn't quite get what "call UnitAddIndicatorBJ( t, 100, 100, 100, 0 )" does, since i applied it both to my target and my casting unit and didnt see anything happen. I traced what "h" is returning, it's ok, returning what i need. When i added an action, that pings the location of the target unit ( t ) on the minimap, and i used the spell, it just pinged the center of the map.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top