• 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] Syntax error

Status
Not open for further replies.
Level 1
Joined
May 24, 2008
Messages
3
Problem solved




JASS:
function JumpJass_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local location start_position = GetUnitLoc(caster)
    local location ziel_position = GetSpellTargetLoc()
 
    local real x_diff =  GetLocationX(start_position) - GetLocationX(ziel_position)
    local real y_diff = GetLocationY(start_position) - GetLocationY(ziel_position)
    
    set x_diff = Betrag(x_diff)
    set y_diff = Betrag(y_diff)
        
    local real temp = x_diff // SYNTAX ERROR
    local real factor = SquareRoot(temp)/200 //UNDECLARED VARIABLE: factor
    call DamageUnit(GetOwningPlayer(caster), factor, caster)

    set udg_Jumpgate_Ziel[GetConvertedPlayerId(GetOwningPlayer(caster))] = GetSpellTargetLoc()
    set udg_Jumpgate_Unit[GetConvertedPlayerId(GetOwningPlayer(caster))] = CreateUnitAtLoc(GetOwningPlayer(caster), 'e001', start_position, 0.00)
           
endfunction

can someone help me?
I just started to use Jass and cant find my mistake
 
Last edited:
Level 9
Joined
Mar 25, 2005
Messages
252
you can't declare locals in a function after you have done something else than declared locals in it

fix:
JASS:
function JumpJass_Actions takes nothing returns nothing
    local unit caster = GetSpellAbilityUnit()
    local location start_position = GetUnitLoc(caster)
    local location ziel_position = GetSpellTargetLoc()

    local real x_diff = Betrag(GetLocationX(start_position) - GetLocationX(ziel_position))
    local real y_diff = Betrag(GetLocationY(start_position) - GetLocationY(ziel_position))

    local real temp = x_diff
    local real factor = SquareRoot(temp)/200
    call DamageUnit(GetOwningPlayer(caster), factor, caster)

    set udg_Jumpgate_Ziel[GetConvertedPlayerId(GetOwningPlayer(caster))] = GetSpellTargetLoc()
    set udg_Jumpgate_Unit[GetConvertedPlayerId(GetOwningPlayer(caster))] = CreateUnitAtLoc(GetOwningPlayer(caster), 'e001', start_position, 0.00)
endfunction
 
Status
Not open for further replies.
Top