Jump to content

Recommended Posts

Posted

how can i send to server and sync to clients an updated character facing direction, after using player:faceLocation(float x, float y); client side?

Posted

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).

Posted
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. 

Posted

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.

Posted
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());

 

?

Posted

getGameClient():sendPlayer(getPlayer())

 

Should work, I believe. sendPlayer() is a public variable and doesn't appear protected.

Posted (edited)

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
Posted

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
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...