Somatic
You can change this now in User CP.
- Reaction score
- 84
I am making a spell which once casted, will cause enemies in the region to be added with the ability "Fatigue" Based off Tornado (Slow Aura). And when 4 seconds is hit, it will increases the level of that added ability by 1, to a maximun of 5 and then removed from the targeted unit. But after working so long i cant seem to fix it at all.
Problem Faced : Units does get the Spell added, but the level does not get increased.
Could anyone here kindly look at it and see for any mistake? Thx. Its kinda basic jass ill say, coz im just starting to get familar with this whole thing. im foreign to terms of Katana Vars Handler. Cs Cache, VJass, Struct and Global thingi. Thanks
Problem Faced : Units does get the Spell added, but the level does not get increased.
Could anyone here kindly look at it and see for any mistake? Thx. Its kinda basic jass ill say, coz im just starting to get familar with this whole thing. im foreign to terms of Katana Vars Handler. Cs Cache, VJass, Struct and Global thingi. Thanks
JASS:
function Trig_Fatigue_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 039;A05L039; ) ) then
return false
endif
return true
endfunction
constant function Max_Count takes nothing returns integer
return 5
endfunction
function Fatigue_Enemy takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Fatigue_Check takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetFilterUnit(), 039;B01N039;) == true ) ) then
return false
endif
return true
endfunction
function Fatigue_Count takes integer Count returns boolean
if ( not ( Count >= 5 ) ) then
return false
endif
return true
endfunction
function Int_Check takes unit f returns integer
local integer Count = ( GetUnitAbilityLevelSwapped(039;A05W039;, f) + 1 )
return Count
endfunction
function FunctionB takes nothing returns nothing
local unit f = GetEnumUnit()
local integer Count = Max_Count()
if ( Fatigue_Count(Count))then
call SetUnitAbilityLevelSwapped( 039;A05W039;, f, Int_Check(f) )
else
call UnitRemoveAbilityBJ( 039;A05W039;, f)
endif
endfunction
function Trig_Fatigue_Actions takes nothing returns nothing
local unit f
local integer Count
local unit Caster = GetSpellAbilityUnit()
local location Temp_Point = GetSpellTargetLoc()
local group Temp_Group = CreateGroup()
local group Temp_Group2 = CreateGroup()
local real cx = GetLocationX(Temp_Point)
local real cy = GetLocationY(Temp_Point)
call GroupEnumUnitsInRange(Temp_Group, cx, cy, 250, Condition(function Fatigue_Enemy))
loop
set f = FirstOfGroup(Temp_Group)
exitwhen f == null
call UnitAddAbilityBJ( 039;A05W039;, f )
call GroupRemoveUnit(Temp_Group,f)
endloop
set Count = 1
loop
exitwhen Count < 5
call GroupEnumUnitsInRange(Temp_Group2, cx, cy, 5000, Condition(function Fatigue_Check))
call ForGroup(Temp_Group2,function FunctionB)
call TriggerSleepAction( 4.00 )
endloop
set Caster = null
set f = null
call DestroyGroup (Temp_Group)
call RemoveLocation(Temp_Point)
endfunction
//===========================================================================
function InitTrig_Fatigue takes nothing returns nothing
set gg_trg_Fatigue = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Fatigue, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Fatigue, Condition( function Trig_Fatigue_Conditions ) )
call TriggerAddAction( gg_trg_Fatigue, function Trig_Fatigue_Actions )
endfunction