- Joined
- Sep 29, 2006
- Messages
- 447
I'm trying to create a basic jump spell where the blademaster leaps to a target point and does damage in an area. The hero never does any damage, but he jumps and slides appropriately. The function ClimFilter() is never entered for whatever reason (it is called by the GroupEnumUnitsInRange() function).
Please note that I CANNOT use any third party programs, I'm on a mac. This needs to be resolved using the vanilla editor only.
Here's the trigger:
Help is appreciated.
Please note that I CANNOT use any third party programs, I'm on a mac. This needs to be resolved using the vanilla editor only.
Here's the trigger:
JASS:
function ClimhazzardConditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00D'
endfunction
function ClimFilter takes nothing returns boolean
local unit caster = udg_globalCaster
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local unit target = GetFilterUnit()
local real x2 = GetUnitX(target)
local real y2 = GetUnitY(target)
local real physDmg = 150. + I2R(50 + GetUnitAbilityLevel(caster, 'A00D'))
local real mgcDmg = 50. + I2R(50 + GetUnitAbilityLevel(caster, 'A00D'))
local real dist = Distance(x, y, x2, y2)
call BJDebugMsg("ClimFilter entered") //debugging /* text is never displayed, therefore function never entered! */
if (GetUnitState(target, UNIT_STATE_LIFE) > 0 and IsUnitType(target, UNIT_TYPE_GROUND) and IsUnitEnemy(target, GetOwningPlayer(caster))) then
call UnitDamageTarget(caster, target, mgcDmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
if (dist <= 100.) then
call UnitDamageTarget(caster, target, physDmg, true, false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endif
endif
set target = null
set caster = null
return false
endfunction
function ClimCallback takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit caster = LoadUnitHandle(udg_hash, id, 0)
local real distance = LoadReal(udg_hash, id, 1)
local real angle = LoadReal(udg_hash, id, 2)
local real count = LoadReal(udg_hash, id, 3)
local real slideDist = 30.
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real flyHeight = GetUnitFlyHeight(caster)
local group g
if (count < distance/2.) then
call SaveReal(udg_hash, id, 3, count + slideDist)
call SlideKeepOrder(caster, slideDist, angle, "")
call SetUnitFlyHeight(caster, flyHeight + 50., 0.)
elseif (count > distance/2. and count < distance) then
call SaveReal(udg_hash, id, 3, count + slideDist)
call SlideKeepOrder(caster, slideDist, angle, "")
call SetUnitFlyHeight(caster, flyHeight - 50., 0.)
else
call PauseTimer(t)
call DestroyTimer(t)
set udg_globalCaster = caster
call SetUnitFlyHeight(caster, 0., 0.)
call SetUnitTimeScale( udg_globalCaster, 1.00 )
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", caster, "origin"))
call MoveRectTo(udg_destructibleRect, x, y)
call EnumDestructablesInRect(udg_destructibleRect, Filter(function KillDestructables), null)
call GroupEnumUnitsInRange(g, x, y, 300., Filter(function ClimFilter))
call BJDebugMsg("enemies should be grouped") //debugging /* this function isn't entered! */
call FlushChildHashtable(udg_hash, id)
endif
call DestroyGroup(g)
set g = null
set t = null
set caster = null
endfunction
function ClimhazzardActions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local real x2 = GetSpellTargetX()
local real y2 = GetSpellTargetY()
local real distance = Distance(x, y, x2, y2)
local real angle = GetAngle(x, y, x2, y2)
local real count = 0
local timer t = CreateTimer()
local integer id = GetHandleId(t)
call UnitAddAbility(caster, 'Amrf')
call UnitRemoveAbility(caster, 'Amrf')
call SetUnitTimeScale( udg_globalCaster, 0.65 )
call SaveUnitHandle(udg_hash, id, 0, caster)
call SaveReal(udg_hash, id, 1, distance)
call SaveReal(udg_hash, id, 2, angle)
call SaveReal(udg_hash, id, 3, count)
call TimerStart(t, .02, true, function ClimCallback)
set caster = null
set t = null
endfunction
//===========================================================================
function InitTrig_Climhazzard takes nothing returns nothing
local trigger trigClimhazzard = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( trigClimhazzard, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( trigClimhazzard, Condition( function ClimhazzardConditions ) )
call TriggerAddAction( trigClimhazzard, function ClimhazzardActions )
set trigClimhazzard = null
endfunction
Help is appreciated.