Aloha, a bit stuck on Jass atm(maybe since I recently started ;P) and I am trying to make an ability that when you use it, it'll create a dummy-bullet and also start a timer that moves the bullet. The timer function also has "if then else" function, that should check wether or not there is a destructible or unit(except the casting) colliding with it/within radius, And this is what I kinda got to atm, please correct me and/or give me advices if I have misunderstood some Jass functions/things/whatever ^^
I hope the title of my threads aren't too confusing =P
edit: I forgot to mention also what I was trying to do with the two //<--- STUCK lines.
Well, the line with call EnumDestructables....etc. is that since I am used to GUI, I was trying to make some "pick all dest" and then "pick all units except casting unit & bullet" and check if there's any picked unit within radius of the 'bullet' - condition. Hope it made it clearer ^^
JASS:
//=======Condition = True?=======================
function Shoot_Cond takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
//=======Action - Timer===============================================================================================================
function Shoot_TimerAction takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit caster = GetHandleUnit(t, "caster")
local unit bullet = GetHandleUnit(t, "bullet")
call EnumDestructablesInRectAll( GetPlayableMapRect(), //<------------ STUCK
if Condition(---TheCondition---)==true //<------------ STUCK
then
call UnitDamagePointLoc(caster, 0.15, 80.00, GetUnitLoc(bullet), GetRandomReal(80.00, 120.00), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)
call KillUnit(bullet)
else
call SetUnitPositionLoc(bullet, PolarProjectionBJ(GetUnitLoc(bullet), +15.00, GetUnitFacing(bullet))
endif
endfunction
//======Action - Start===============================================================================
function Shoot_Action takes nothing returns nothing
local timer t
local unit caster
local unit bullet
set caster = GetTriggerUnit()
call CreateNUnitsAtLoc(1, 'a001', GetOwningPlayer(caster), GetUnitLoc(caster), GetUnitFacing(caster))
set bullet = GetLastCreatedUnit()
set t = CreateTimer()
call TimerStart(t, 0.04, true, function Shoot_TimerAction)
call TriggerSleepAction(2.00)
call DestroyTimer(t)
set t = null
set caster = null
set bullet = null
endfunction
//======Trigger Events etc.======================================
function InitTrig_ShootSpell takes nothing returns nothing
local trigger t
set t = CreateTrigger()
call TriggerRegisterUnitEvent(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition(function Shoot_Cond))
call TriggerAddAction(t, Shoot_Action)
endfunction
I hope the title of my threads aren't too confusing =P
edit: I forgot to mention also what I was trying to do with the two //<--- STUCK lines.
Well, the line with call EnumDestructables....etc. is that since I am used to GUI, I was trying to make some "pick all dest" and then "pick all units except casting unit & bullet" and check if there's any picked unit within radius of the 'bullet' - condition. Hope it made it clearer ^^
Last edited: