JASS:
function Trig_Ranged_Attack_Filter takes nothing returns boolean
return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetFilterUnit())) and GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
function Trig_Ranged_Attack_Condition2 takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
function Trig_Ranged_Attack_Loop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = GetHandleInt(t, "i")
local unit a = GetHandleUnit(t, "a")
local unit r = GetHandleUnit(t, "r")
local boolexpr d = Condition(function Trig_Ranged_Attack_Filter)
local unit f
local group g = CreateGroup()
call GetUnitsInRangeOfLocMatching(100, GetUnitLoc(r), d)
set g = GetLastCreatedGroup()
if CountUnitsInGroup(g) >= 1 then
loop
set f = FirstOfGroup(g)
exitwhen f == null
call UnitDamageTargetBJ(a, f, (100+(I2R(GetHeroStatBJ(bj_HEROSTAT_STR, a, true)))*2.50), ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL)
call AddSpecialEffectTargetUnitBJ("head", GetEnumUnit(), "Objects\\Spawnmodels\\Critters\\Albatrosse\\CritterBloodAlbatross.mdl")
call GroupRemoveUnit(g, f)
endloop
set f = null
set g = null
set d = null
else
call SetUnitPositionLoc(r, PolarProjectionBJ(GetUnitLoc(r), 15.00, GetUnitFacing(r)))
endif
call SetHandleInt(t, "i", i+1)
if i >= 40 then
call FlushHandleLocals(t)
call DestroyTimer(t)
set t = null
endif
endfunction
function Trig_Ranged_Attack_Actions takes nothing returns nothing
local timer t
local location p = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 600.00, GetUnitFacing(GetSpellAbilityUnit()))
local real i = 1.00
if GetSpellAbilityId() == 'A002' then
set t = CreateTimer()
call CreateNUnitsAtLocFacingLocBJ( 1, 'e000', GetOwningPlayer(GetSpellAbilityUnit()), GetUnitLoc(GetSpellAbilityUnit()), p )
call SetHandleHandle(t, "r", GetLastCreatedUnit())
call SetHandleHandle(t, "a", GetSpellAbilityUnit())
call SetHandleInt(t, "i", R2I(i))
call TimerStart(t, i, true, function Trig_Ranged_Attack_Loop)
endif
endfunction
//===========================================================================
function InitTrig_Ranged_Attack takes nothing returns nothing
set gg_trg_Ranged_Attack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ranged_Attack, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Ranged_Attack, Condition(function Trig_Ranged_Attack_Condition2))
call TriggerAddAction( gg_trg_Ranged_Attack, function Trig_Ranged_Attack_Actions )
endfunction
So what it should do is create a projectile and then send it off to 600 in front of a unit. It worked a while ago, but I tried to make it multiinstanceable, and now it works not so well. I removed the parts of the trigger that remove the projectile, and now it just makes an arrow above the shooters head for maybe 1 second...
Erm... help? Where do I place the dummy unit (projectile) removal, why isn't it working, will this actually do damage?
EDIT: Made a few minor edits, now when a unit uses the ability, the projectile dummy appears over the targets head... so... thats not much of an improvement. And it still doesnt do damage. And I still don't know when to remove it...
EDIT2: Actually it is just putting the arrows 600 infront of whatever is getting shot...
EDIT3: Oh, I'm fairly certain that the problem is that I don't want a loop so much as I want to use timers, so I need to recode a lot of this...
And now I don't know what I'm going to do. I need to make the loop stuff happen every 0.05 seconds... but I don't really know how to do that. Time for more research...
EDIT4: Ok... updated what I have now... the old code isnt here anymore, I still have it if you want to look at it, but it doesn't make sense. I would like to test it but it crashes my editor... so I don't really know what to do...
EDIT5: Updated to latest version of code.
EDIT6: After a lot of help, another updated version of the code. Still need a lot more help. Still doesn't work. Its back to making the arrow dummy at the caster...
EDIT7: Okay big changes, I was way off. I think its closer to making sense, but still doesn't work...
EDIT8: Most recent version, I recoded it from mostly scratch. Still doesn't work
Last edited: