Jump to content
Existing user? Sign In

Sign In



Sign Up
Search In
  • More options...
Find results that contain...
Find results in...

Pre-RS3 NPC Half-speed Walking Movement Type


Makar
 Share

Recommended Posts

Now I'm sure tons of you have seen ganodermic beasts, new chickens, and grotworms sliding around in a T-Pose when they should be animating while walking. 

I am sure some of you have seen this wonky hardcode fix going around (this example is from Matrix 3's polypore npc code)

@Override
public void processMovement() {
    super.processMovement();
    if (realId == 14696 && getNextWalkDirection() != -1) {
        this.setNextAnimation(new Animation(15465));
        this.setNextForceMovement(new NewForceMovement(this, 1, null, 0, Utils.getAngle(Utils.DIRECTION_DELTA_X[getNextWalkDirection()], Utils.DIRECTION_DELTA_Y[getNextWalkDirection()])));
    }
}

Basically forcing a movement animation using forcemovement. Well the render animation definitions of the monster hold animations for a third movement type. Not walking, not running.It seems to be used for monsters that move either half speed of normal monsters, or monsters that move 2 squares in one direction at a time such as ganodermic beasts.

The correct way to trigger this animation to be used directly from the render animation of the npc is to just have an exception inside where it updates an npc to be "running".

As you can see in the client code here where the client determines which render animation to use, there is a "teleport" animation type. I only call it teleport because it's the same movement type id that players use in player update as a teleport movement. Should probably rename it to SPECIAL or something instead.

Here is where the client determines if the NPC uses this specific type of movement so you can update your NPC update methods accordingly: NPCUpdate.java

If you're using Matrix's crazy ass control flow for NPC updating, here's where you'd make the change:

if (n.getNextRunDirection() == -1) {
    if (n.getDefinitions().walksSpecial()) {
        stream.writeBits(2, 2);
        stream.writeBits(1, 0);
        stream.writeBits(3, Utils.getNpcMoveDirection(n.getNextWalkDirection()));
    } else {
        stream.writeBits(2, 1);
        stream.writeBits(3, Utils.getNpcMoveDirection(n.getNextWalkDirection()));
    }
} else {
    stream.writeBits(2, 2);
    stream.writeBits(1, 1);
    stream.writeBits(3, Utils.getNpcMoveDirection(n.getNextWalkDirection()));
    stream.writeBits(3, Utils.getNpcMoveDirection(n.getNextRunDirection()));
}

Link to comment
Share on other sites

  • 2 years later...
  • 3 months later...

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
 Share

Contact

ltlimes

RSPS Partners

RedemptionRSPS

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

oldschoolrsps Runewild RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex, rune-server and runelocus in any way & exists solely for educational purposes.

×
×
  • Create New...