Jump to content
nolanri

HOW TO Send updated player facing direction to server

Recommended Posts

Don't see it being used anywhere in the game's code or within Lua, so I assume there's a different function that is actually transmitted to the server in IsoPlayer's update(). Maybe setDir(IsoDirections directions).

Share this post


Link to post
Share on other sites
10 minutes ago, Butter Bot said:

Don't see it being used anywhere in the game's code or within Lua, so I assume there's a different function that is actually transmitted to the server in IsoPlayer's update(). Maybe setDir(IsoDirections directions).

 

Oh first off, my mistake i am using gameCharacter:setAngle(vector) to rotate the player. 

setDir() only has the 8 angle options such as North nothwest etc.  And since you can see other players in MP turn gradually as they aim. Im sure thats not it. 

Share this post


Link to post
Share on other sites

Ah, looks like the server checks these variables to determine the facing angle:

        player.setDir(dir);
        player.angle.set(player.dir.ToVector());


These, I think, are sent to the server with IsoPlayer.update(); specifically, the GameClient.instance.sendPlayer(this) function.

 

Not sure where it's getting around the 8 directions, though.

Share this post


Link to post
Share on other sites
16 minutes ago, Butter Bot said:

Ah, looks like the server checks these variables to determine the facing angle:

        player.setDir(dir);
        player.angle.set(player.dir.ToVector());


These, I think, are sent to the server with IsoPlayer.update(); specifically, the GameClient.instance.sendPlayer(this) function.

soo can i just force sendPlayer(getPlayer()); through game cleint?

 

how do i call that in LUA?

 

getGameClient():sendPlayer(getPlayer());
getGameClient():sendPlayer(getPlayer());

GameClient.instance():sendPlayer(getPlayer());

GameClient.instance():sendPlayer(getPlayer());

 

?

Share this post


Link to post
Share on other sites

temp.png

 

if(getGameClient()) then getGameClient():sendPlayer(getPlayer()); end
hmm but this is on single player. maybe it would still work in MP?  but how to make it at least NOT error in sp if that is the case

Edited by nolanri

Share this post


Link to post
Share on other sites

well took me absolutely forever  to figure this out but for the record:

IsoPlayer:setAngle() must be a method being phased out or something because even though setting it does change the direction your local player faces, whatever values it is setting NEVER get updated to the server in MP.  Simply put it is not used in MP. 

I even made a servercmd that sends clientcommands to clinets to try and use setAngle() to turn all the other players in each persons client side.  but this method only works on localplayer. 

 

taking the vector from getAngle() after setting it and putting it into :

player:DirectionFromVector(vector)

then it started syncing the facing direction in MP
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...