Note: This PRState documentation is out-dated and is for an older (pre-GMS v2.3) version of PRState. For the most up-to-date docs on the latest version of PRState, please refer to this page as well as the documentation included in the PRState package.

Documentation Topics
Article

Debug Verbosity

If you are having some trouble figuring out why and how states are being called for a given object when they shouldn’t be, it may help to turn on debug verbosity using PRStateSetVerbose(true). Doing this within the context of a given object will write state changes and instance information to the output window to help track down bugs.

PRStateAdd(self, “Stand”, soldierStandState, [“Crouch”, “Jump”]); // Only allow Stand state from Crouch and Jump states.
PRStateAdd(self, “Crouch”, soldierCrouchState, [“Stand”]);  // Only allow Crouch state from Stand state.
PRStateAdd(self, “Climb”, soldierClimbState, [“Stand”]);  // Only allow Climb state from Stand state.
PRStateAdd(self, “Jump”, soldierJumpState, [“Stand”]);  // Only allow Jump state from Stand state.
PRStateAdd(self, “Shoot”, soldierShootState, [“Stand”, “Crouch”]]);  // Only allow Shoot from Stand & Crouch states.

With the above states added to an object, issuing the following command would yield nothing:

// Assuming the current state is “Climb”
PRStateSet(self, “Shoot”);  // Nothing happens.

Restricting states is a great way to prevent some really bizarre situations from occurring. It also helps visualize an object’s abilities and state paths, which is a great help when coding your state scripts.