Spell crashes the game

BlueMirage

Trust, but doubt.
Reaction score
39
The following spell crashes the game 1 second after it has been activated.

Spell description:
As long as the skill is toggled on, the hero gains a 15/25/35% MS boost (Done through adding an aura skill), regenerates 10% of its max mana each second, and loses 10% of its current health per second. Also, the hero has no cooldowns on its other skills.

JASS:
function Trig_Adrenaline_Rush_On_Conditions takes nothing returns boolean
    return GetIssuedOrderId() == OrderId("immolation")
endfunction

function Adrenaline_Off_Con takes nothing returns boolean
    return GetIssuedOrderId() == OrderId("unimmolation")
endfunction

function Adrenaline_Off_Actions takes nothing returns nothing
    local trigger trig = GetTriggeringTrigger()
    local integer i = GetHandleId(trig)
    local timer tim = LoadTimerHandle(udg_Hashtable, i, 0)
    local trigger trig2 = LoadTriggerHandle(udg_Hashtable, i, 3)

    call TriggerRemoveCondition(trig, LoadTriggerConditionHandle(udg_Hashtable, i, 1))
    call TriggerRemoveAction(trig, LoadTriggerActionHandle(udg_Hashtable, i, 2))

    call TriggerRemoveCondition(trig2, LoadTriggerConditionHandle(udg_Hashtable, i, 4))
    call TriggerRemoveAction(trig2, LoadTriggerActionHandle(udg_Hashtable, i, 5))

    call SetUnitAbilityLevel(LoadUnitHandle(udg_Hashtable, i, 6), 'A000', 1)

    call PauseTimer(tim)
    call DestroyTimer(tim)
    call FlushChildHashtable(udg_Hashtable, GetHandleId(tim))
    call DestroyTrigger(trig)
    call FlushChildHashtable(udg_Hashtable, i)
    call DestroyTrigger(trig2)
    set tim = null
    set trig = null
    set trig2 = null
endfunction

function Adrenaline_Cast_Con takes nothing returns boolean
    return GetSpellAbilityId() != 'A00G'
endfunction

function Adrenaline_Cast_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local integer spell = GetSpellAbilityId()
    local integer i = GetUnitAbilityLevel(u, spell)
    call UnitRemoveAbility(u, spell)
    call UnitAddAbility(u, spell)
    call SetUnitAbilityLevel(u, spell, i)
    set u = null
endfunction

function AdrenalineLoop takes nothing returns nothing
    local unit u = LoadUnitHandle(udg_Hashtable, GetHandleId(GetExpiredTimer()), 0)
    local real hp = GetUnitState(u, UNIT_STATE_LIFE)
    call SetUnitAbilityLevel(u, 'A000', GetUnitAbilityLevel(u, 'A00G') + 1)

    if hp > 10 then
        call SetUnitState(u, UNIT_STATE_LIFE, hp * 0.9)
    endif

    call SetUnitState(u, UNIT_STATE_MANA, GetUnitState(u, UNIT_STATE_MANA) + GetUnitState(u, UNIT_STATE_MAX_MANA) * 0.10)

    set u = null
endfunction

function Trig_Adrenaline_Rush_On_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local trigger trig = CreateTrigger()
    local trigger trig2 = CreateTrigger()
    local timer tim = CreateTimer()
    local integer i = GetHandleId(trig)

    call TriggerRegisterUnitEvent(trig, u, EVENT_UNIT_ISSUED_ORDER)
    call SaveTriggerConditionHandle(udg_Hashtable, i, 1, TriggerAddCondition(trig, Condition(function Adrenaline_Off_Con)))
    call SaveTriggerActionHandle(udg_Hashtable, i, 2, TriggerAddAction(trig, function Adrenaline_Off_Actions))
    call SaveTimerHandle(udg_Hashtable, i, 0, tim)

    call TriggerRegisterUnitEvent(trig2, u, EVENT_UNIT_SPELL_CAST)
    call SaveTriggerHandle(udg_Hashtable, i, 3, trig2)
    call SaveTriggerConditionHandle(udg_Hashtable, i, 4, TriggerAddCondition(trig2, Condition(function Adrenaline_Cast_Con)))
    call SaveTriggerActionHandle(udg_Hashtable, i, 5, TriggerAddAction(trig2, function Adrenaline_Cast_Actions))

    call SaveUnitHandle(udg_Hashtable, i, 6, u)

    call TimerStart(tim, 1, true, function AdrenalineLoop)    
    call SaveUnitHandle(udg_Hashtable, GetHandleId(tim), 0, u)

    call UnitAddAbility(u, 'A000')
    call SetUnitAbilityLevel(u, 'A000', GetUnitAbilityLevel(u, 'A00G') + 1)
endfunction

//===========================================================================
function InitTrig_Adrenaline_Rush takes nothing returns nothing
endfunction


JASS:
function Start_Hero takes nothing returns nothing
    local trigger t = CreateTrigger()

     //Omitted trigger info

    //udg_TempUnit is set somewhere else.

    call TriggerRegisterUnitEvent(t4, udg_TempUnit, EVENT_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(t4, Condition(function Trig_Adrenaline_Rush_On_Conditions))
    call TriggerAddAction(t4, function Trig_Adrenaline_Rush_On_Actions)

    call UnitAddAbility(udg_TempUnit, 'A000')
endfunction

function InitTrig_Start_Hero takes nothing returns nothing
endfunction
 

Bribe

vJass errors are legion
Reaction score
67
What kind of debugs have you performed?

If the hashtable isn't getting initialized, that might cause a problem.

Since this is vanilla JASS, you can have a wide range of problems that normal WE wouldn't catch, but NewGen would. My guess is the problem lies elsewhere.

I recommend using GetWidgetLife/SetWidgetLife for the health (faster).
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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