- Joined
- Aug 4, 2012
- Messages
- 193
I want to make a shockwave ability based on hero stats. Can I know why this code is not working? Thanks for the help.
JASS:
function Trig_Shockwave_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A001')
endfunction
function Shockwave_IsEnemy takes nothing returns boolean
return(IsUnitEnemy(GetEnumUnit(),GetOwningPlayer(ShockwaveCaster)))
endfunction
function Shockwave_Damage takes nothing returns nothing
call UnitDamageTarget(ShockwaveCaster,GetEnumUnit(),GetHeroStr(ShockwaveCaster,true)*3,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endfunction
function Trig_Shockwave_Actions takes nothing returns nothing
local location CasterLoc
local real TravelledDistance
local unit Dummy
local location DummyLoc
local group EnemyGroup=CreateGroup()
set ShockwaveCaster=GetSpellAbilityUnit()
set CasterLoc=GetUnitLoc(ShockwaveCaster)
set Dummy=CreateUnitAtLoc(GetOwningPlayer(ShockwaveCaster),'h000',CasterLoc,AngleBetweenPoints(CasterLoc,GetSpellTargetLoc()))
loop
exitwhen TravelledDistance>=1200
set TravelledDistance=TravelledDistance+63
call TriggerSleepAction(0.06)
set DummyLoc=GetUnitLoc(Dummy)
call SetUnitPositionLoc(Dummy,PolarProjectionBJ(DummyLoc,63,GetUnitFacing(Dummy)))
call GroupEnumUnitsInRangeOfLoc(EnemyGroup,DummyLoc,200,Condition(function Shockwave_IsEnemy))
call ForGroup(EnemyGroup,function Shockwave_Damage)
endloop
call RemoveLocation(DummyLoc)
call RemoveUnit(Dummy)
call RemoveLocation(CasterLoc)
call DestroyGroup(EnemyGroup)
endfunction
//===========================================================================
function InitTrig_Shockwave takes nothing returns nothing
set gg_trg_Shockwave=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Shockwave,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Shockwave,Condition(function Trig_Shockwave_Conditions))
call TriggerAddAction(gg_trg_Shockwave,function Trig_Shockwave_Actions)
endfunction
Last edited: