• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] My first spell won't work

Status
Not open for further replies.
Level 2
Joined
Jul 8, 2009
Messages
6
Hi, i just browsed through some tutorials and decided I was ready to make my own crappy spell. However, it won't work. What did I do wrong?
JASS:
function SummonSpell_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction
function SummonSpell_Actions takes nothing returns nothing
    local unit temp //the target
    local location target_loc = GetUnitLoc(temp) //the target location
    local integer i = 0 //my loop integer
    local group enemies = CreateGroup() //the selected group in range
    local unit caster = GetTriggerUnit() //the caster, of course
    local location start_position = GetUnitLoc( caster ) //obviously the caster location
    local unit S_created    //My Summoned Unit
    call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 1000.0, null)
    loop
        exitwhen i > 10
        set temp = FirstOfGroup(enemies)
        if IsUnitEnemy(temp, GetTriggerPlayer()) then
            call SetUnitFacingToFaceLocTimed(caster, target_loc, 0.20)
            set S_created = CreateUnitAtLoc(GetTriggerPlayer() , GetUnitTypeId(temp), target_loc, 0.00)
            call SetUnitTimeScale(S_created, 25.0)
            call SetUnitVertexColor(S_created, 255, 0, 0, 30)
            call SetUnitAnimation( caster, "attack" )
            set i = i - 1
        endif
        call GroupRemoveUnit(enemies, temp)
    endloop
endfunction
function InitTrig_SummonSpell takes nothing returns nothing
 set gg_trg_SummonSpell = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_SummonSpell, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_SummonSpell, Condition(function SummonSpell_Condition))
    call TriggerAddAction(gg_trg_SummonSpell, function SummonSpell_Actions)
endfunction
apart from the answer, constructive critisism would be nice (like i even have to ask for it here)
 
Status
Not open for further replies.
Top