- Joined
- Mar 9, 2023
- Messages
- 75
Hi! I'm pretty wack at Jass, but I tried to make a trigger in it. Problem is that despite it's being "approved" by the system, it doesn't actually do anything. The intent is to deal damage to the caster's HP based on its maximum life * 0.1 per ability level.
Edit: Solved with some help! Abandoned the idea of keeping it to be based off max health. Final code looked like:
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
function BerserkRampage_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A07G'
endfunction
function BerserkRampage_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local real lvl = 0.1 * (GetUnitAbilityLevel(u,'A07G'))
call SetUnitState(u,UNIT_STATE_LIFE,GetUnitState(u,UNIT_STATE_LIFE) - lvl)
set u = null
endfunction
//===========================================================================
function InitTrig_BerserkRampage takes nothing returns nothing
set gg_trg_BerserkRampage = CreateTrigger( )
call TriggerAddAction( gg_trg_BerserkRampage, function BerserkRampage_Actions )
endfunction
Edit: Solved with some help! Abandoned the idea of keeping it to be based off max health. Final code looked like:
JASS:
function BerserkRampage_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A07G'
endfunction
function BerserkRampage_Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local real lvl = (GetUnitAbilityLevel(u,'A07G')) * 0.1
call SetUnitState(u,UNIT_STATE_LIFE,(GetUnitState(u,UNIT_STATE_MAX_LIFE) * (1 - lvl)))
set u = null
endfunction
//===========================================================================
function InitTrig_BerserkRampage takes nothing returns nothing
set gg_trg_BerserkRampage = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_BerserkRampage,EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_BerserkRampage, Condition( function BerserkRampage_Conditions ) )
call TriggerAddAction( gg_trg_BerserkRampage, function BerserkRampage_Actions )
endfunction
Last edited: