HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Omnislash problem

10-21-2007, 01:10 AM#1
Qurilion
Hello everyone,

I'm woefully new to JASS (and scripting in general), but since a scripting class in school (as well as a lot of playing Enfo) have renewed my interest in scripting. I have some basic knowledge about programming in C++ and some scripting experience in Ogier (for Riddick: Escape from Butcher's Bay), but I'm totally new to JASS.

So I went through the very helpful tutorials here on the forum and just went through darkwulfv and wyrmlord's collection of lessons, and just got to the last challenge to make the omnislash spell; which is to make the hero run to 5 targets within range, inflict damage on each of them, then run back to the original position.

I've managed to knock the compilation errors down from 48 to 2 now, but I can't shake these last two. Since I'm mainly interest in learning to script than learning how to solve this specific problem, I was wondering if you could give me some clues how to deal with these sort of compilation errors?

Here's my script:

Collapse JASS:
function Slash_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' 
endfunction

function Slash_Actions takes nothing returns nothing
 local unit caster = GetSpellAbilityUnit()
 local location start_position = GetUnitLoc(caster)
 local group enemies = CreateGroup()
 local unit temp
 local integer count = 5
    call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 500.0, null)
    loop
        set temp = FirstOfGroup(enemies)
        exitwhen temp == null or count == 0
        if IsUnitEnemy(temp, GetOwningPlayer(caster)) then 
            set temp_loc = GetUnitLoc(temp)
            call SetUnitPositionLoc(caster, temp_loc)
            call UnitDamageTarget(caster, temp, 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
            set count = count - 1
        endif
        call GroupRemoveUnit(enemies, temp)
    endloop
endfunction
function InitTrig_Slash takes nothing returns nothing
 set gg_trg_Slash = CreateTrigger() 
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Slash, Condition(function Slash_Condition))
    call TriggerAddAction(gg_trg_Slash, function Slash_Actions)
endfunction

The compilation errors I'm getting:

On line 40 (which is set temp_loc = GetUnitLoc(temp) ) = 'Expected a variable name'
On line 41 (call SetUnitPositionLoc(caster, temp_loc)) = 'Expected a name'


I've tried to add like 'set location temp_loc", but it hasn't helped, and I'm not quite sure how to fix it.

Any hints or so would be very appriciated. Thanks.

/Q
10-23-2007, 03:25 AM#2
Vexorian
You are not ever declaring temp_loc

Your prior knowledge of C++ and other scripting languages will make you get disappointed at Jass... For example, the only place you can declare local variables is the top of the funciton, you can't do it later,.
10-23-2007, 07:28 AM#3
sinners_la_b
just add this under your variable local unit temp

Collapse JASS:
 local location temp_loc 
10-24-2007, 11:30 AM#4
Qurilion
Quote:
Originally Posted by Vexorian
You are not ever declaring temp_loc

Your prior knowledge of C++ and other scripting languages will make you get disappointed at Jass... For example, the only place you can declare local variables is the top of the funciton, you can't do it later,.


Doh! Thank you. I will correct it and give it a try, then try to improve on it.


Quote:
Originally Posted by sinners_la_b
just add this under your variable local unit temp

Thank you, I'll give it a try as soon as I get home!