Can anyone tell me what's wrong with this JASS code? It's a spell, based off of aerial shackles, that's supposed to drag a unit toward the caster. "Slayer's Web".
It has the unit starts the effect of an ability spell, checks to see if it's Slayer's Web, and creates local variables for the caster and the target. It creates a local timer and starts it repeating every 0.05 seconds, calling function web_drag, which checks to see if the target is within 100 units of the caster. If it is, it does nothing, but if it's further away than that, it pulls the target 10 units toward the caster, and deals 3 damage to it. (The effect is supposed to drag the target 200 units per second, and deal 30% of the distance dragged in damage.) There's one compile error, though. It's at the area where web_drag is called in the timer. It's says, "Line 95: Expected '". Anyone know what the problem is?
--------
function web_cond takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0AL' ) ) then
return false
endif
return true
endfunction
function web_drag takes unit web_caster, unit web_target returns nothing
if (DistanceBetweenPoints(GetUnitLoc(web_caster), GetUnitLoc(web_target)) < 100.00) then
call SetUnitPositionLoc( web_target, PolarProjectionBJ(GetUnitLoc(web_caster), ( DistanceBetweenPoints(GetUnitLoc(web_caster), GetUnitLoc(web_target)) - 10.00 ), AngleBetweenPoints(GetUnitLoc(web_target), GetUnitLoc(web_target))) )
call UnitDamageTargetBJ( web_caster, web_target, 3.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_ACID )
else
call DoNothing()
endif
endfunction
function web_action takes nothing returns nothing
local timer t
local unit web_caster
local unit web_target
set web_caster = GetTriggerUnit()
set web_target = GetSpellTargetUnit()
set t = CreateTimer()
call TimerStart(t, 0.05, true, function web_drag( web_caster , web_target ))
call TriggerSleepAction( ( 2.00 + ( 0.38 * I2R(GetUnitAbilityLevelSwapped('A0AL', web_caster)) ) ) )
call DestroyTimer(t)
set web_caster = null
set web_target = null
set t = null
endfunction
//===========================================================================
function InitTrig_Slayer_Web takes nothing returns nothing
local trigger web
set web = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (web, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(web, Condition(function web_cond))
call TriggerAddAction( web, function web_action )
endfunction
It has the unit starts the effect of an ability spell, checks to see if it's Slayer's Web, and creates local variables for the caster and the target. It creates a local timer and starts it repeating every 0.05 seconds, calling function web_drag, which checks to see if the target is within 100 units of the caster. If it is, it does nothing, but if it's further away than that, it pulls the target 10 units toward the caster, and deals 3 damage to it. (The effect is supposed to drag the target 200 units per second, and deal 30% of the distance dragged in damage.) There's one compile error, though. It's at the area where web_drag is called in the timer. It's says, "Line 95: Expected '". Anyone know what the problem is?
--------
function web_cond takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A0AL' ) ) then
return false
endif
return true
endfunction
function web_drag takes unit web_caster, unit web_target returns nothing
if (DistanceBetweenPoints(GetUnitLoc(web_caster), GetUnitLoc(web_target)) < 100.00) then
call SetUnitPositionLoc( web_target, PolarProjectionBJ(GetUnitLoc(web_caster), ( DistanceBetweenPoints(GetUnitLoc(web_caster), GetUnitLoc(web_target)) - 10.00 ), AngleBetweenPoints(GetUnitLoc(web_target), GetUnitLoc(web_target))) )
call UnitDamageTargetBJ( web_caster, web_target, 3.00, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_ACID )
else
call DoNothing()
endif
endfunction
function web_action takes nothing returns nothing
local timer t
local unit web_caster
local unit web_target
set web_caster = GetTriggerUnit()
set web_target = GetSpellTargetUnit()
set t = CreateTimer()
call TimerStart(t, 0.05, true, function web_drag( web_caster , web_target ))
call TriggerSleepAction( ( 2.00 + ( 0.38 * I2R(GetUnitAbilityLevelSwapped('A0AL', web_caster)) ) ) )
call DestroyTimer(t)
set web_caster = null
set web_target = null
set t = null
endfunction
//===========================================================================
function InitTrig_Slayer_Web takes nothing returns nothing
local trigger web
set web = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (web, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(web, Condition(function web_cond))
call TriggerAddAction( web, function web_action )
endfunction