MagnaGuard
Active Member
- Reaction score
- 49
JASS:
scope heatstruck
globals
private unit attacked = GetTriggerUnit()
private unit attacking = GetAttacker()
endglobals
private function Trig_Heat_Struck_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(attacking,039;A000039;)>=1
endfunction
private function remove takes nothing returns nothing
call UnitRemoveAbility(attacked,039;A002039;)
endfunction
private function Trig_Heat_Struck_Actions takes nothing returns nothing
local timer t=CreateTimer()
local real level=(GetUnitAbilityLevel(attacking,039;A000039;))*10
local integer random = GetRandomInt(1,100)
if random <= level then
call UnitAddAbility(attacked,039;A002039;)
call TimerStart(t,10,false,function remove)
endif
call DestroyTimer(t)
set attacked = null
set attacking = null
endfunction
//===========================================================================
private function InitTrig_Heat_Struck takes nothing returns nothing
set gg_trg_Heat_Struck = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Heat_Struck, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Heat_Struck, Condition( function Trig_Heat_Struck_Conditions ) )
call TriggerAddAction( gg_trg_Heat_Struck, function Trig_Heat_Struck_Actions )
endfunction
endscope
So basically the trigger is supposed to be, if a certain unit attacks another with a skill, then give the attacked unit an ability to be weak to fire spells. I haven't used timers before so don't quite know if I did it properly.
However it hasn't worked yet, the ability is supposed to put a buff on the enemy to show it is weak.