- Joined
- Jul 14, 2007
- Messages
- 34
Alright, I can't believe I can't figure this out, but all I want to do is create a collision missile that looks like an arrow and have it deal damage to the unit it collides with, so what's wrong with this code? Also, another problem I have although it's purely cosmetic is moving the creation point of the collision missile so that it actually looks like it comes from the tip of the bow, I'm using Shandaris as the archer model right now if any of yall have the free time to make it pretty for me also; Here's the code:
Ak! This needs to be in the spells subsection sorry about that!
JASS:
function Trig_Shoot_Arrow_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Shoot_Arrow_OnImpact takes nothing returns nothing
local unit c = GetSpellAbilityUnit()
local unit u = GetTriggerUnit()
call UnitDamageTarget(c,u,150,false, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_AXE_MEDIUM_CHOP)
set u = null
set c = null
endfunction
function Trig_Shoot_Arrow_Actions takes nothing returns nothing
local location l = GetUnitLoc(GetSpellAbilityUnit())
local location t = GetSpellTargetLoc()
local unit m
set m = CollisionMissile_CreateLoc("Abilities\\Weapons\\Arrow\\ArrowMissile.mdl",l,AngleBetweenPoints(l,t),700,0,850,200,true,200,function Shoot_Arrow_OnImpact)
call RemoveLocation(l)
call RemoveLocation(t)
set l = null
set t = null
set m = null
endfunction
//===========================================================================
function InitTrig_Shoot_Arrow takes nothing returns nothing
set gg_trg_Shoot_Arrow = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shoot_Arrow, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shoot_Arrow, Condition( function Trig_Shoot_Arrow_Conditions ) )
call TriggerAddAction( gg_trg_Shoot_Arrow, function Trig_Shoot_Arrow_Actions )
endfunction
Ak! This needs to be in the spells subsection sorry about that!
Last edited: