mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Add notes on player indices to Lua docs
This commit is contained in:
parent
b3ae635e98
commit
283fbc85a9
1 changed files with 14 additions and 0 deletions
|
@ -26,6 +26,20 @@ Lua scripts you make can be placed either the `mods` folder in the base director
|
|||
|
||||
<br />
|
||||
|
||||
## Important notes on player indices
|
||||
|
||||
Something important to realize is that the `localIndex` for each player is different (unfortunately).
|
||||
|
||||
So the order of `gMarioStates[]`, `gNetworkPlayers[]`, and `gPlayerSyncTable[]` is different for each player.
|
||||
|
||||
Luckily `gPlayerSyncTable[]` will automatically translate the player indices, so setting `gPlayerSyncTable[0].example = 1` will set it for the correct player for everyone.
|
||||
|
||||
The `globalIndex` of each player is consistent among everyone connected. So if you absolutely need to sort things in order you will have to grab it from `gNetworkPlayers[<LOCAL INDEX HERE>].globalIndex`.
|
||||
|
||||
All of this is a holdover from when there were only two players. It was a reasonable idea back then.
|
||||
|
||||
<br />
|
||||
|
||||
## Example Lua mods
|
||||
- [Extended Moveset](../../mods/extended-moveset.lua)
|
||||
- [Character Movesets](../../mods/character-movesets.lua)
|
||||
|
|
Loading…
Reference in a new issue