Page 1 of 1

Getting player index in events like ontick?

Posted: Tue Jul 21, 2015 8:36 pm
by iUltimateLP
So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..

Re: Getting player index in events like ontick?

Posted: Tue Jul 21, 2015 10:04 pm
by ratchetfreak
iUltimateLP wrote:So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..
I think you kinda need to

Each player needs to simulate what every other player does

Re: Getting player index in events like ontick?

Posted: Wed Jul 22, 2015 12:41 pm
by iUltimateLP
ratchetfreak wrote:
iUltimateLP wrote:So I finished my Teleporters Mod but now I need multiplayer support.. So the main teleporting thread is inside the game.on_tick event, but that does not give me the the player index so how do I get the player? I dont want to loop through every player every tick cause that would take lagg I think..
I think you kinda need to

Each player needs to simulate what every other player does
Well thanks!

Re: Getting player index in events like ontick?

Posted: Wed Jul 22, 2015 3:00 pm
by SirRichie
I think the reason is not that every player needs to simulate what every other player does (which is true), but that on_tick is not a player-specific event. It is a global game event, which is not caused by any player action and thus, there is no player to be associated with the event.

So you'll need to loop, or be triggered by an event which supplies the player / player index.