• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] First jass spell need help

Status
Not open for further replies.
Level 2
Joined
May 7, 2010
Messages
21
Hi, recently I decided to move from GUI to JASS (mainly because of my inability to create a MUI spel using GUI). So I started coding my first spell. When I paste it into the WorldEditor it disables it because of many errors, the problem is that I cant fix those.
Spell idea : spell based on storm bolt (or any single target spell) dummy casts a firebolt and if target dies dummy casts another firebolt on an enemy unit within 500 of position of dying unit.
So basically I dont know if the code is correct at all, any help or advice would be appreciated :)
JASS:
function trigger_actions takes nothing returns nothing
local unit victim = GetSpellTargetUnit () 
local unit caster = GetTriggerUnit ()
local unit dummy = CreateUnitAtLoc (GetOwningPlayer (caster), h000, GetUnitLoc (victim), 0.00)
local group nextgroup
local location temploc = GetUnitLoc (victim)
call IssueTargetOrderBJ (dummy, A001, victim)
call UnitApplyTimedLifeBJ (2, 0, dummy)
if IsUnitDeadBJ (victim) then 
set nextgroup = GetUnitsInRangeOfLocAll (500, temploc)
endif
set victim = FirstOfGroup (nextgroup)
if IsUnitEnemy (victim, GetOwningPlayer (caster)) then
call IssueTargetOrderBJ (dummy, A001, victim)
endif
set victim = null
set caster = null
set nextgroup = null
set temploc = null 
endfunction
function trigger_conditions takes nothing returns boolean
return GetSpellAbilityId = A000
endfunction
function spelltrigger takes nothing returns nothing
set gg_trg_spelltrigger = CreateTrigger ()
call TriggerRegisterAnyUnitEventBJ ( gg_trg_spelltrigger, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition ( gg_trg_spelltrigger, Condition( trigger_conditions ) )
call TriggerAddAction ( gg_trg_spelltrigger, trigger_actions )
endfunction
 
Status
Not open for further replies.
Top