vJass Help Syntax Error

Fire-Wolf

S.P.D Smoke Pot Daily, Legalize It!
Ok I need some help with this. I'm making my first vJass spell. Its a basic one, it is just a chain lightning spell. And I'm only getting one syntax error. Here is the code:
JASS:
scope LW

    local Caster = GetSpellAbilityUnit()
    local array Target[0] = GetSpellTargetUnit()
    local array Target[1] = GetSpellTargetUnit()
    local group Targets

private function Trig_LW_Func008Func001002003001 takes nothing returns boolean
    return ( GetFilterUnit() != Caster )
endfunction

private function Trig_LW_Func008Func001002003002001 takes nothing returns boolean
    return ( GetFilterUnit() != Target[0] )
endfunction

private function Trig_LW_Func008Func001002003002002 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

private function Trig_LW_Func008Func001002003002 takes nothing returns boolean
    return GetBooleanAnd( Trig_LW_Func008Func001002003002001(), Trig_LW_Func008Func001002003002002() )
endfunction

private function Trig_LW_Func008Func001002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_LW_Func008Func001002003001(), Trig_LW_Func008Func001002003002() )
endfunction

private function Trig_LW_Actions takes nothing returns nothing
    call AddLightningLoc( "CLPB", GetUnitLoc(Caster), GetUnitLoc(Target[0]) )
    call UnitDamageTargetBJ( Caster, Target[0], 100.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call TriggerSleepAction( 0.10 )
    call DestroyLightningBJ( GetLastCreatedLightningBJ() )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 3
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set local group Targets = GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(Target[0]), Condition(function Trig_LW_Func008Func001002003))
        set local array Target[0] = GroupPickRandomUnit(Targets)
        call AddLightningLoc( "CLPB", GetUnitLoc(udg_Target[1]), GetUnitLoc(udg_Target[0]) )
        call UnitDamageTargetBJ( udg_Caster, udg_Target[0], 100.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
        call TriggerSleepAction( 0.10 )
        call DestroyLightningBJ( GetLastCreatedLightningBJ() )
        set udg_Target[1] = udg_Target[0]
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DestroyGroup( udg_Targets )
endfunction

//===========================================================================
function InitTrig_LW takes nothing returns nothing
    set gg_trg_LW = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_LW, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_LW, function Trig_LW_Actions )
endfunction

endscope
The syntax error is:
set local group Targets = GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(Target[0]), Condition(function Trig_LW_Func008Func001002003))

Please help!
 

_whelp

New Member
Man, you can't make locals out of functions. Use globals:
JASS:
globals
    <VISIBILITY> <TYPE> <NAME> <INITIAL VALUE>
endglobals


Oh, and you can't use 'set local group bla =' syntax, you use 'set bla ='.

EDIT: Aww, you beat me to it.
 

_whelp

New Member
Uhh... stop using GUI coding habits, bj_forLoopAIndex and bj_forLoopAIndexEnd?
Use locals, not blizzard's useless globals for Jass... and remove the GUI generated globals.

One last thing, don't use those useless BJ's like UnitDamageTargetBJ. All it does is removes weapontype and boolean arguments.
For the DestroyLightningBJ, use DestroyLightning(bj_lastCreatedLightning).
 

Romek

Super Moderator
Staff member
This is quite obviously converted GUI.
You'll find writing it from scratch much easier to be honest.

Converted GUI is uglier than Paris Hilton.
 

Fire-Wolf

S.P.D Smoke Pot Daily, Legalize It!
Sorry I'm still just learning vJass so i just made a spell in Gui converted it to Jass then tried to convert it to vJass. But I fail.

EDIT: Here is the new trigger. Im getting 10 Compile errors now though. I think I made the script a bit better.
JASS:
scope LW initializer InitTrig_LW

private function Trig_LW_Func008Func001002003001 takes nothing returns boolean
    return ( GetFilterUnit() != Caster )
endfunction

private function Trig_LW_Func008Func001002003002001 takes nothing returns boolean
    return ( GetFilterUnit() != Target[0] )
endfunction
private function Trig_LW_Func008Func001002003002002 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

private function Trig_LW_Func008Func001002003002 takes nothing returns boolean
    return GetBooleanAnd( Trig_LW_Func008Func001002003002001(), Trig_LW_Func008Func001002003002002() )
endfunction

private function Trig_LW_Func008Func001002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_LW_Func008Func001002003001(), Trig_LW_Func008Func001002003002() )
endfunction

private function Trig_LW_Actions takes nothing returns nothing
    local integer l = 1
    local unit Caster = GetSpellAbilityUnit()
    local unit array Target
    local group Targets
    set Target[0]  = GetSpellTargetUnit()
    set Target[1] = GetSpellTargetUnit()
    call AddLightningLoc( "CLPB", GetUnitLoc(Caster), GetUnitLoc(Target[0]) )
    call UnitDamageTargetBJ( Caster, Target[0], 100.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
    call TriggerSleepAction( 0.10 )
    call DestroyLightning( bj_lastCreatedLightning)
    loop
        exitwhen l > 3
        set Targets = GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(Target[0]), Condition(function Trig_LW_Func008Func001002003))
        set Target[0] = GroupPickRandomUnit(Targets)
        call AddLightningLoc( "CLPB", GetUnitLoc(udg_Target[1]), GetUnitLoc(udg_Target[0]) )
        call UnitDamageTargetBJ( udg_Caster, udg_Target[0], 100.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
        call TriggerSleepAction( 0.10 )
        call DestroyLightning(bj_lastCreatedLightning)
        set udg_Target[1] = udg_Target[0]
        set l = l + 1
    endloop
    call DestroyGroup( Targets )
endfunction

//===========================================================================
private function InitTrig_LW takes nothing returns nothing
    set gg_trg_LW = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_LW, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_LW, function Trig_LW_Actions )
endfunction

endscope
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Chat should show on the sidebar when not logged in now.
  • Ghan Ghan:
    (You'll still need to log in to post messages)
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.
  • Wizard Wizard:
    Going to deploy a fix soon, just had to take some time for myself this weekend.
  • Varine Varine:
    Unbelievable. Time for yourself? How dare you!
  • Wizard Wizard:
    xD
  • tom_mai78101 tom_mai78101:
    Hm, it is now harder to type anything on an Android phone. Pressing Backspace or Enter keys will dismiss the Android keyboard for some reasons.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top