S
SixDemonBag
Guest
So, i just got the Jass NewGen Pack and decided to make a simple missle ability.
Problem is, i have no clue how to set the boolexpr filter of the collision detection to NOT detect the caster of the ability. I tried using GetTriggerUnit() but it didnt work at all. Right now it only effects Neutral Hostile units, but i want it to effect(or affect?) units who are enemys of the caster.
Also, the "pickedgroup" is a global variable, and thus there may be some mui problems with the spell.
Heres the code for the spell.
Help would be apreciated
Problem is, i have no clue how to set the boolexpr filter of the collision detection to NOT detect the caster of the ability. I tried using GetTriggerUnit() but it didnt work at all. Right now it only effects Neutral Hostile units, but i want it to effect(or affect?) units who are enemys of the caster.
Also, the "pickedgroup" is a global variable, and thus there may be some mui problems with the spell.
Heres the code for the spell.
JASS:
globals
group pickedgroup = CreateGroup()
endglobals
struct spell
unit missle
unit caster
location end
real angle
endstruct
function Trig_Missle_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 039;A000039; ) ) then
return false
endif
return true
endfunction
function True takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction
function collision takes nothing returns nothing
if ( not ( IsUnitInGroup(GetEnumUnit(), pickedgroup) == true) ) then
call GroupAddUnit(pickedgroup,GetEnumUnit())
call AddSpecialEffect("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" ,GetUnitX(GetEnumUnit()),GetUnitY(GetEnumUnit()))
else
endif
endfunction
function Missle_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local spell data = GetHandleInt(t, "data")
local group collisiongroup = CreateGroup()
if (DistanceBetweenPoints(GetUnitLoc(data.missle),data.end)) > 10.00 then
call SetUnitFacing(data.missle, data.angle)
call SetUnitPosition(data.missle,GetUnitX(data.missle)+Cos(Deg2Rad(GetUnitFacing(data.missle)))*15,GetUnitY(data.missle)+Sin(Deg2Rad(GetUnitFacing(data.missle)))*15)
call GroupEnumUnitsInRange(collisiongroup,GetUnitX(data.missle),GetUnitY(data.missle),150.00, Filter(function True))
call ForGroup(collisiongroup,function collision)
else
call GroupClear(pickedgroup)
set collisiongroup = null
call DestroyGroup(collisiongroup)
call RemoveUnit(data.missle)
call PauseTimer(t)
call DestroyTimer(t)
call data.destroy()
call FlushHandleLocals(t)
endif
endfunction
function Trig_Missle_Actions takes nothing returns nothing
local spell data = spell.create()
local timer t = CreateTimer()
set data.caster = GetTriggerUnit()
set data.missle = CreateUnit(GetOwningPlayer(data.caster),039;h002039;,GetUnitX(data.caster),GetUnitY(data.caster),GetUnitFacing(data.caster))
call SetUnitFlyHeight(data.missle, 100.00, 800.00)
set data.end = GetSpellTargetLoc()
set data.angle = AngleBetweenPoints(GetUnitLoc(data.caster),data.end)
call SetHandleInt(t, "data", data)
call TimerStart(t, 0.03, true, function Missle_Move)
endfunction
//===========================================================================
function InitTrig_Missle takes nothing returns nothing
set gg_trg_Missle = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Missle, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Missle, Condition( function Trig_Missle_Conditions ) )
call TriggerAddAction( gg_trg_Missle, function Trig_Missle_Actions )
endfunction
Help would be apreciated