• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Compiling errors..(Drag spell)

Status
Not open for further replies.

TfW

TfW

Level 1
Joined
Jan 13, 2006
Messages
2
I'm really not that great with jass but i'm trying to learn.

Anyway, I copied everything from the drag spell (Variables, etc everything.)
( http://www.wc3sear.ch/index.php?p=Spells&ID=575&sid=210fed1e34d49288b449008d5885f75b )

Everything was smooth until the 2 triggers...

Here's my errors:

Expected a name:
if ( not ( GetTriggerUnit() == gg_unit_Ofar_0001 ) ) then

Expected a code statement:
endif

Expected a name:
call AddLightningLoc( "LEAS", GetUnitLoc(gg_unit_Ofar_0001), GetUnitLoc(udg_SpellTarget[1]) )

Expected a variable name:
set udg_SpellSpecialFX[2] = GetLastCreatedEffectBJ()


Now, I do not know much about jass at the present but i'm guessing my problem lies within this:

gg_unit_Ofar_0001

Seeing as I don't have a farseer in my map like the drag map has might this be what causes the problem? :)

Anywhere heres the FULL triggers if anyone wants them.

Code:
function Trig_Rope_Cast_Conditions takes nothing returns boolean
    if ( not ( GetTriggerUnit() == gg_unit_Ofar_0001 ) ) then
        return false
    endif
    if ( not ( GetSpellAbilityId() == 'A00P' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Rope_Cast_Actions takes nothing returns nothing
    set udg_SpellTarget[1] = GetSpellTargetUnit()
    call AddLightningLoc( "LEAS", GetUnitLoc(gg_unit_Ofar_0001), GetUnitLoc(udg_SpellTarget[1]) )
    set udg_SpellsLightning[0] = GetLastCreatedLightningBJ()
    call AddSpecialEffectTargetUnitBJ( "chest", udg_SpellTarget[1], "Abilities\\Spells\\Human\\AerialShackles\\AerialShacklesTarget.mdl" )
    set udg_SpellSpecialFX[2] = GetLastCreatedEffectBJ()
    call SetUnitPathing( udg_SpellsUnits[1], false )
    call TriggerSleepAction( 0.05 )
    call EnableTrigger( gg_trg_Rope_Recursive )
endfunction

//===========================================================================
function InitTrig_Rope_Cast takes nothing returns nothing
    set gg_trg_Rope_Cast = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Rope_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Rope_Cast, Condition( function Trig_Rope_Cast_Conditions ) )
    call TriggerAddAction( gg_trg_Rope_Cast, function Trig_Rope_Cast_Actions )
endfunction

Code:
function Trig_Rope_Recursive_Func002Func001001 takes nothing returns boolean
    return ( IsUnitInRange(gg_unit_Ofar_0001, udg_SpellTarget[1], 150.00) == true )
endfunction

function Trig_Rope_Recursive_Func002Func009001 takes nothing returns boolean
    return ( UnitHasBuffBJ(udg_SpellTarget[1], 'B001') == true )
endfunction

function Trig_Rope_Recursive_Func002Func009002 takes nothing returns boolean
    return ( UnitHasBuffBJ(udg_SpellTarget[1], 'B002') == true )
endfunction

function Trig_Rope_Recursive_Func002C takes nothing returns boolean
    if ( not GetBooleanOr( Trig_Rope_Recursive_Func002Func009001(), Trig_Rope_Recursive_Func002Func009002() ) ) then
        return false
    endif
    if ( not ( IsUnitAliveBJ(gg_unit_Ofar_0001) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Rope_Recursive_Actions takes nothing returns nothing
    if ( Trig_Rope_Recursive_Func002C() ) then
        if ( Trig_Rope_Recursive_Func002Func001001() ) then
            call DoNothing(  )
        else
            set udg_SpellPoints[2] = PolarProjectionBJ(GetUnitLoc(udg_SpellTarget[1]), 30.00, AngleBetweenPoints(GetUnitLoc(udg_SpellTarget[1]), GetUnitLoc(gg_unit_Ofar_0001)))
        endif
        call SetUnitPositionLoc( udg_SpellTarget[1], udg_SpellPoints[2] )
        call RemoveLocation( udg_SpellPoints[2] )
        call MoveLightningLoc( udg_SpellsLightning[0], GetUnitLoc(gg_unit_Ofar_0001), GetUnitLoc(udg_SpellTarget[1]) )
    else
        call DestroyLightningBJ( udg_SpellsLightning[0] )
        call DestroyEffect( udg_SpellSpecialFX[2] )
        call SetUnitPathing( udg_SpellsUnits[1], true )
        call DisableTrigger( GetTriggeringTrigger() )
    endif
endfunction

//===========================================================================
function InitTrig_Rope_Recursive takes nothing returns nothing
    set gg_trg_Rope_Recursive = CreateTrigger(  )
    call DisableTrigger( gg_trg_Rope_Recursive )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Rope_Recursive, 0.09 )
    call TriggerAddAction( gg_trg_Rope_Recursive, function Trig_Rope_Recursive_Actions )
endfunction
 
Level 6
Joined
Sep 9, 2004
Messages
152
The problem is indeed with gg_unit_Ofar_0001 because it's a GUI generated variable.Therefore it doesn't exist in your map and the spell doesn't work.To tell you honestly this spell is a normal GUI trigger converted in JASS code....
 
Status
Not open for further replies.
Top