Priority5 - manage humanoid properties in multiple scripts without causing conflicts

What is Priority5?

Priority 5 is a priority based state machine, I made this tool to make state management for player characters easier in combat games (I recommend this module for any type of game that has something to do with changing a humanoid property)

→ Priority based state machine sounds fancy, what does it do exactly?

well first you need to know what a state machine is, I’m not going to explain it but if you want examples look at how humanoids have multiple states for each action (example: Idle, Running, Jumping, etc…), Priority5 is basically an state machine but adds priorities to them similar to the priority property of animation objects

→ Example use cases

In a fighting game, you would have states like Walking, Sprinting and Stunned and you wanna be able to transition between the states seamlessly without causing bugs (example: sprinting while being stunned :grimacing:)
sure, you can fix this by doing TONS of if statements in your code but thats not really ideal

With Priority5, you can set a priority number to your states just like how you set the priority property of animations (that’s where I got the idea of priority based state machines from lol), and when a state with a high priority is enabled, all the other states will be deactivated.
image

→ That’s not all!

I’ve recently added a new feature that’s called Weight ← link to the api document
with this, you no longer have to create individual states for every little thing in your game (example: lowering player speed when swinging a sword), it allows you to quickly and temporarily put weight on all the states on the player and remove it whenever you want.

API Documents

Github


did unit testing on the module by using testez to make sure that everything works as expected.

11 Likes

UPDATE:

added server—>client replication

1 Like

UPDATE:

  • Statemachine wont be replicated to player if the player never used it

This update should fix some errors and lower the recv

1 Like

This is very confusing… I would never remember that setting one value could actually set two different ones depending on the value type. I’d rather just set those two properties directly.

I can’t say much else since I don’t know what a state machine is.

2 Likes

UPDATE:

  • Major bug fixes
  • Better error handling
  • Better network performance
  • Integrated BridgeNet2 into the module
1 Like

BIG UPDATE [Version 0.5.0]

  • The API is very developer friendly now
  • New feature called Weight, used for quickly and temporarily modifying properties without the need to create a new state

Github | API Documents

2 Likes

LATEST UPDATE LOGS

[0.5.1]

[0.5.2]

  • Fixed Priority.ActiveStateChanged, didn’t know it was broken in the previous version because I couldn’t get into Roblox Studio to run tests

[0.5.3]

  • Reminder for updating the module (server-only because it uses HttpService)

    Thought it would be useful to have a feature like this since Priority5 is an important part of games and should always be kept up-to-date
1 Like

Im having loads of problems like these when developing my game, im actually going to take a look at this resource to learn from it, very cool resource.

1 Like