GetPlayerId(p) Why do sometimees do i have to add +1 to work?

Time

New Member
Reaction score
0
I was wondering why do I have to add +1 next to GetPlayerId(p) to work? Can you tell me so I'll know when to put the +1..
 

TheLegend

New Member
Reaction score
10
GetPlayerId() gets the jass id of the player where Player one's id is 0
to get it work as the GUI version just use this
GetConvertedPlayerId(p)
that will get the gui player id where Player one's id is 1
 

Time

New Member
Reaction score
0
The thing is im trying to stay away from gui.. thats why always use this
local player p = GetTriggerPlayer()
local integer i = GetPlayerId(p)+1
 

RedOrb

You can change this now in User CP.
Reaction score
14
You should get used to the first element being 0. Applies to all arrays.
 

Inflicted

Currently inactive
Reaction score
63
GUI just makes it simpler by adding the extra one.
In GUI: Players are 1-12
in Jass: Players are 0-11
(with the exception of neutrals etc)

If you convert the default GUI code you will see that the interface automatically adds the 1 to make it more user-friendly.
Basically its always 0-11, in the cases of Player Numbers and Arrays; as mentioned above.

If you are going to continue working in Jass, just try and remember to almost always use 0-11.
 
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