Script Compile errors bugging?

Sim

Forum Administrator
Staff member
Reaction score
534
Ok I think my WE is bugging... I made a script a WHILLLE ago that looks like this (without the events) :

Code:
function Trig_Vanish_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Vanish_Actions takes nothing returns nothing
    set udg_Vanish_Loc[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = GetUnitLoc(GetSpellAbilityUnit())
    [B]local unit DUMMY[/B]        [i]Expected a code statement[/i]
    [B]local unit DUMMYY[/B]          [i]Expected a code statement[/i]
    [B]local unit zeratul=GetTriggerUnit()[/B]           [i]Expected a code statement[/i]
    [B]call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(zeratul), GetUnitLoc(zeratul), bj_UNIT_FACING )[/B]         [i]Expected a name[/i]
    [B]set DUMMY = GetLastCreatedUnit()[/B]        [i]Expected a variable name[/i]
    [B]call UnitApplyTimedLifeBJ( 5.00, 'BTLF', DUMMY )[/B]       [i]Expected a name[/i]
   [B] call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(zeratul), GetSpellTargetLoc(), bj_UNIT_FACING )[/B]        [i]Expected a name[/i]
    [B]set DUMMYY = GetLastCreatedUnit()[/B]       [i]Expected a variable name[/i]
    [B]call UnitApplyTimedLifeBJ( 5.00, 'BTLF', DUMMYY )[/B]      [i]Expected a name[/i]
    [B]call ShowUnitHide(zeratul)[/B]      [i]Expected a name[/i]
    call TriggerSleepAction( 5.00 )
    [B]call ShowUnitShow(zeratul)[/B]       [i]Expected a name[/i]
    [B]call SelectUnitAddForPlayer( zeratul, GetOwningPlayer(zeratul) )        [/b]       [i]Expected a name[/i]
endfunction

But it worked very well. It worked like 1 hour ago when I tested my map and did it. But now, I tried to save my map and I got an error on each of the bolded lines and I can't even play the map ! I tried restarting and even the comp but nothing works out ! It bugged since I add the udg_Vanish_Loc[INDEX] = GetUnitLoc thingy (for later use in another trigger)

The explanations of the errors are in italics next to the bolded line.

Any ideas or solutions I might do to restore this ? I can't even test the map since these errors occured !
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
You should have all of the local variables set before any of the code. In other words, put this:
Code:
set udg_Vanish_Loc[GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))] = GetUnitLoc(GetSpellAbilityUnit())

after the local variables.

Also, there is no variable called zeratul in your code. It's only used.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Lmao. I shouldn't have added this line while on the phone :cool:

It works out perfect now haha. I just had to set the variable after the locals, that's commonsense.

You know what ? I wrote GUI all day so I kind of forgot about Locals having teh priority ! :eek:

Damn that GUI !

grumbles something about people here requesting triggers... :D

EDIT :
Darthfett said:
Also, there is no variable called zeratul in your code. It's only used.

Actually, it is set as the last local ! Look carefully :p
 

SFilip

Gone but not forgotten
Reaction score
634
off-topic
you can simplify this condition
Code:
function Trig_Vanish_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
        return false
    endif
    return true
endfunction
by changing it this way
Code:
function Trig_Vanish_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00M'
endfunction
 

Sim

Forum Administrator
Staff member
Reaction score
534
For spell conditions I usually convert only. Why ? Because I'm too lazy to go check which ID is the matching one :p

But yea I'll simplify it. thx :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top