Game Development Community

Variables are not set in ghost side of the same object?

by Kevin Mitchell · in Torque 3D Professional · 01/26/2012 (7:21 pm) · 4 replies

So i have a variable in the player object named isAttacking. When I press the attack button I set it to true. But its only true for the isGhost() = true not the isGhost() = false. How is this even possible? What I'm trying to do is restrict the players movement when attacking. What's happening is that the side that sets the variable apparently does not register on the ghost section? Even if i change the mState to attacking the state on the other side registers as MoveState even though nothing is calling or resetting it... I'm confused.

#1
01/27/2012 (12:19 am)
Maybe try attaching it to the client object instead of the player object? I am headed off to sleep now, but I'll try to look into it over the weekend (busy as a centipede at a toe-counting contest tomorrow).
#2
01/27/2012 (1:19 am)
Umm, Have you networked that Variable? isGhost Means the object has been ghosted (networked)
So any variables that change have to be networked as well.

Example:
Vehicle::writePacketData(...)
{
...
   stream->write(mCameraRot.x);   
   stream->write(mCameraRot.z); 
...

If mCameraRot.x/z was not ghosted, that info would only be known server side.
#3
01/27/2012 (4:33 am)
Awe man I hope it was that simple, now I want to abandon work to try and network those variables... I'll try this and let you know. Thanks so much!
#4
01/27/2012 (6:26 am)
let me clarify...

The variable that needs to be known both client/server sides needs to be networked
if the object is ghosted, OR the server needs to Notify the client of the change
with a command to clients that need to know it..

Its a bit confusing but look at it this way...

Info All clients need to know needs to be added to the network data (written)
Info only a specific client needs to know can be sent with just a cmd function.