You might notice when you start moving you will start to glide. This is mainly because the animation process is done at the python level server side (so there is a bit of return time and in particular if you using the server setup). Applying this is a first step to getting this going. I do not have a lot of this setup anymore, so I will need some people to do some testing. I think there is a walk/run animation as well that will need to be factored in on the client.
In player.cpp (might be rpgplayer.cpp in TGE) add the following code to updateMove near the bottom. I put it after the statements follow this comment
// If we are not touching anything and have sufficient -z vel,
if (isClientObject() && (move->x != 0 || move->y != 0))
{
if (mTwoHanded)
changeSequenceIf(0, "idle", "2hrun");
else
changeSequenceIf(0, "idle", "1hrun");
changeSequenceIf(0, "flyidle", "fly");
changeSequenceIf(0, "swimidle", "swim");
}
In shapeBase.h find updateThread and below that add this
// Checks to see if a certian sequence is playing and if it is it will play the requested one bool changeSequenceIf(U32 slot, const char *checkseq, const char *playseq);
In shapeBase.cpp find setThreadSequence and before it add this.
//Checks to see if a sequence is currently playing and if it is play the requested one
bool ShapeBase::changeSequenceIf(U32 slot, const char *checkseq, const char *playseq)
{
S32 seq = getShape()->findSequence(playseq);
S32 idleseq = getShape()->findSequence(checkseq);
if (seq != -1 && idleseq != -1)//Valid sequences
{
Thread& st = mScriptThread[slot];
if (st.thread && st.sequence == idleseq && st.state == Thread::Play)
{
setThreadSequence(slot,seq);
return true;
}
}
return false;
}
The two handed check will not work because it is not network aware (it is sitting on the server not being sent to the client). To fix that make the following changes.
In player.cpp make the following changes
Find the following bit of code
stream->write(mFlyingMod);
Immediately after it add this.
stream->writeInt(mTwoHanded, 2);
A bit further down find this
stream->read(&mFlyingMod);
After it add
mTwoHanded = stream->readInt(2);
This should work with no python changes as the way this is rigged it gets changed and the rpg flag gets tagged on updating all of these values. Or at least it was for me, if not take a look at setFlyingMod and copy that for twohanded.
