The time has come for me too to start learning Jass, but my knowledge of it is... lets say, limited
Anyway, im trying to write my first spell in Jass, and thats what i got right now:
I got stuck at the loop and the set TempPoint2 action, which is giving me some errors all the time (expecting name, etc). Although i can deal with the action by trying other ways of setting the location, i have no idea how to continue my spell at the loop.
The spell is supposed to create a dummy unit every time the caster uses the ability. The dummy starts to float around the caster, dealing damage to nearby enemy units (done it using Immolation). Up to 8 dummies can be summoned.
Now, the problem is, i have no idea how to let the function spawn new dummies without starting new loop/interrupting the already running one.
Note that im not requesting anyone to do this spell for me, i want tips on what to add/change.
Anyway, im trying to write my first spell in Jass, and thats what i got right now:
JASS:
function Trig_Kni_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A000' ) then
return true
endif
return false
endfunction
function Trig_Kni_Actions takes nothing returns nothing
local location TempPoint
local location TempPoint2
local unit Caster = GetTriggerUnit()
local group Knives
local integer KniNo
local integer KniNoMax = 2 + ( 2 * GetUnitAbilityLevelSwapped('A000', Caster ) )
local boolean KniActivated = false
local integer Counter = 0
set TempPoint = GetUnitLoc(Caster)
set TempPoint2 = PolarProjectionBJ( TempPoint, RandomReal(0, 300), RandomReal(0, 360) )
if ( CountUnitsInGroup(Knives) < KniNoMax ) then
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(Caster), TempPoint, bj_UNIT_FACING )
call GroupAddUnitSimple( GetLastCreatedUnit(), Knives )
set KniNo = CountUnitsInGroup(Knives)
endif
loop
exitwhen Counter > 375 // 1 : 0.04 = 25 | 25 * 15(max duration in seconds) = 375
set TempPoint = GetUnitLoc(Caster)
set Counter = ( Counter + 1 )
call TriggerSleepAction(0.04)
endloop
endfunction
//===========================================================================
function InitTrig_Storm_of_Knives takes nothing returns nothing
set gg_trg_Storm_of_Knives = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Storm_of_Knives, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Storm_of_Knives, Condition( function Trig_Kni_Conditions ) )
call TriggerAddAction( gg_trg_Storm_of_Knives, function Trig_Kni_Actions )
endfunction
I got stuck at the loop and the set TempPoint2 action, which is giving me some errors all the time (expecting name, etc). Although i can deal with the action by trying other ways of setting the location, i have no idea how to continue my spell at the loop.
The spell is supposed to create a dummy unit every time the caster uses the ability. The dummy starts to float around the caster, dealing damage to nearby enemy units (done it using Immolation). Up to 8 dummies can be summoned.
Now, the problem is, i have no idea how to let the function spawn new dummies without starting new loop/interrupting the already running one.
Note that im not requesting anyone to do this spell for me, i want tips on what to add/change.