'Expected "takes" '

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
This function:

Code:
function stone wall takes nothing returns boolean
    if ( not ( udg_StoneAmount[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1] == 1 )) then
        return false
    endif
    return true
endfunction
Gives the error, expected "takes". It already says takes. What's the problem?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> What's the problem?

The space between stone and wall.


return udg_StoneAmount[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1] == 1

Also, you sure about the "+ 1" there?
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Yeah, i'm quite sure about the +1. I converted it from GetConvertedPlayerId and appearently it adds 1. I think it got something to do with players starting at 0 or 1.

Also, you're saying I can skip all this and just write "return udg_StoneAmount[GetPlayerId(GetOwningPlayer(GetTriggerUnit())) + 1] == 1" in the function?

Will this work if I have several if in the function?

Thanks for the help anyways
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> apparently it adds 1

In GUI, player numbers start at 1.
In JASS, they start at 0...

> Will this work if I have several ifs in the function?

If you combine them with "and", yes.
return Whatever == true and SomethingElse == false and ...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top