• 🏆 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] "Expected a Name"

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2007
Messages
1,433
I always seem to attain the error "Expected a name" by WE as a try to save my map :(.

JASS:
function Trig_Upgrade_Item_Func001Func003001 takes nothing returns boolean
    return ( udg_ItemY > 10 )
endfunction

function Trig_Upgrade_Item_Func001C takes nothing returns boolean
return( GetItemTypeId(UnitItemInSlot(udg_UpgradeWeaponHero, 1))==udg_weapons[udg_ItemX])
endfunction

function Trig_Upgrade_Item_Actions takes nothing returns nothing
    if ( Trig_Upgrade_Item_Func001C() ) then
        call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit())), ( "|cffffff00You have upgraded your weapon to level " + ( I2S(udg_ItemY) + "|r" ) ) )
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Items\\TomeOfRetraining\\TomeOfRetrainingCaster.mdl",GetUnitLoc(udg_UpgradeWeaponHero)))
        call RemoveItem( UnitItemInSlotBJ(udg_UpgradeWeaponHero, 1) )
        call UnitAddItemById( udg_UpgradeWeaponHero, udg_Items[(udg_ItemX + 1)] )
    else
        if ( Trig_Upgrade_Item_Func001Func003001() ) then
            set udg_ItemY = 1
        endif
        set udg_ItemX = ( udg_ItemX + 1 )
        set udg_ItemY = ( udg_ItemY + 1 )
        call TriggerExecute( gg_trg_Upgrade_Item )
    endif
endfunction

//===========================================================================
function InitTrig_Upgrade_Item takes nothing returns nothing
    set gg_trg_Upgrade_Item = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Upgrade_Item, function Trig_Upgrade_Item_Actions )
endfunction

JASS:
call UnitAddItemById( udg_UpgradeWeaponHero, udg_Items[(udg_ItemX + 1)] )
Is the line with the error
Note: I know this hasn't been optimized in the least bit, I like to have all my triggers working before optimization.
 
Status
Not open for further replies.
Top