• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Help with error (local unit u)

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
I'm getting this error (image) when I try to use the custom script: local unit u

can anyone help me, please?
 

Attachments

  • 2017-03-28.png
    2017-03-28.png
    3.8 MB · Views: 115
Corrected syntax, same error:
First, it's not the same error, it's another error.
It's expecting a endif statement after your declaration.
JASS:
[...]
else
    local unit u
endif

I don't want to be rude but, seriously, you really can't read the compilation errors?
 
I didn't saw the difference on them, sorry. I'm using gui and trying to implement a unit recycler on my map but I'm having no success.

See the red square. It's trying to help you with the bugs you're having, that's the use of the compiler, point you syntax errors.
I don't know if you're familiar with programming languages or the problem is with JASS itself. Either way, I suggest you give it a try and read about it a bit.

If you're using GUI these syntax errors don't make much sense. Can you show the whole trigger you're trying to do? Maybe it will make it more easy to help.
 

Attachments

  • Screenshot (3).png
    Screenshot (3).png
    281.5 KB · Views: 87
Also, local variables can only be declared at the top of the functions. Example
Correct:
JASS:
function foo takes nothing returns nothing
    local unit f
    local integer o
    call BJDebugMsg("bar")
endfunction

Incorrect:
JASS:
function foo takes nothing returns nothing
    local unit f
    call BJDebugMsg("bar")
    local integer o //must go before any function calls or if statements
endfunction
 
Status
Not open for further replies.
Back
Top