[FREE][ESX] Status & Needs System

Hello! I’ve decided to release a set of resources that I am currently working on as a replacement for ESX’s native status system. I feel that this warrants a “why?” - please refer to the motivation section.

This system is composed of three resources:

Motivation

This resource was made to replace ESX’s native status resources (namely esx_basicneeds, esx_optionalneeds, esx_status, and esx_hud) with a configurable status system. Currently ESX’s provided system is predominantly client-sided whereas this status system operates predominantly on the server and syncs its state with the database.

This is intended to be used with pc-hud and pc-consumables, however, they can be easily be omitted / replaced with some scripting knowledge.

Moving the system to the server allows for:

  • More security / forced server side validation
  • Flexible durations (that either persist or do not persist across disconnects / reboots)
  • Interactable stats that do not need to share their state with clients

Features

Traditional needs

This system supports basic needs that are subject to a time decay (like hunger and thirst) while a player is connected.

Temporary effects

Exports can add temporary or permanent buffs / enfeeblements to players that expire in real time as opposed to tick timing while a player is connected.

RPG / Reputation traits

With this system, you may create and modify relatively static status types that act like traditional RPG traits like strength, intelligence, etc. These kinds of traits also allow for a reputation-style status type.

Skill checks

Exports can be used to make rolls against RPG / reputation-like status types with three levels of difficulty.

Player augmentations

This resource comes with the following augmentations that can trigger based off of status type set up:

  • Player speed (caffeine)
  • Acid effect
  • Drunk effect (plus 5% chance of random outbursts, see config.lua)
  • High effect (thc)
  • Death / overdose

Preview

In this preview, I am using a separate script to remove the minimap health and armor bars based on this thread - this is not the doing of pc-hud. Chat is cc-chat. Minimap here.

Drawbacks

Effect ticks use SQL to correctly store and calculate expiration state. As such, having a large player base alongside a high latency connection to your db may cause server performance issues.

Dependencies

This resource is intended to be used in tandem with pc-consumables / pc-hud in an ox_inventory environment, but you could easily omit pc-consumables or replace pc-hud.

Additionally, you will need ESX. There is also a dependency on rpemotes if you decide to utilize pc-consumables.

Additional credit

pc-hud is my first TypeScript / React project. As such, I heavily referenced (and directly copied with proper licensing / attribution some of) the build and utility scripts used in the graphical components of ox_inventory. I give credit to Linden, Dunak, Luke, and the other contributors of ox_inventory for this.

If you feel that I have not properly credited, or honored the license of, the contributors of ox_inventory then let me know so that I can properly do so.

Exports & Events

Exports and an event are provided so that developers may replace pc-hud as I may no longer make releases for it. Please refer to the GitHub read me for documentation.

All player augmentations are enforced via client events. See client.lua for more information.

License

This resource is licensed under the MIT License - feel free to do as you desire with it so long as the terms of the license are met.

6 Likes

Nicely done Mr NotBinky!

Free = OGs

1 Like

hi bro really nice work man

i just asking if we can see a video something it will be more understable

That’s a good idea! I think I can put something together today that demonstrates how these all look when working together :thinking:

1 Like

Updated post with a preview :slight_smile:

1 Like

I’ve updated pc-needs now that I’ve had a chance to test and flesh out the effect and status roll systems :white_check_mark:

  • Added comments to config to make it more clear
  • Reviewed & tested the effects system (buffs & enfeeblements)
  • Reviewed & tested status rolls at all difficulties
  • Added config values for status roll adjustment so that you can change the check’s threshold and difficulty impact
  • Added /statusRoll command / Config.Debug to help you test status roll config values

This change involves a change to the effect table. If upgrading from 0.0.1, you will need to drop and recreate the effect table using the create statement in the pc-needs.sql file.

The update can be obtained from the latest GitHub release :slight_smile:

I have also updated pc-hud. I fixed an issue with the health display. Previously it was displaying from 50-100% of its fill range instead of 0-100%.

I made a small update for pc-hud - now players can use /hud to toggle the UI.

Hello :slight_smile: I have an exciting update for today!

I’ve managed to make a change to pc-needs that I believe will somewhat mitigate my initial performance concerns - I’ve optimized the most frequently used export, alterStatus, to only use a single SQL query as opposed to the 5 that it was using prior. If you previously used this plugin and had noticeable latency / lag then you may find that the latency / lag is largely reduced.

I have removed my general performance caution for this reason. However, I would still advise some level of caution with using this if you are using a split server / database environment.

Unfortunately I do not currently have a player base to test with this, otherwise I would love to remove this performance caution. It may very well be the case that the design of this plugin is operationally acceptable, but it would be irresponsible of me to remove the caution without confirmation.

If you had a positive OR negative performance experience with this, I would love to hear about it!

Other small changes / QoL improvements for pc-needs can be read about on the latest GitHub release.

I’ve also updated pc-hud with a small change: the /hud command will now also hide the speedometer.

Future updates will primarily be posted to GitHub, but I may occasionally post here for larger / notable updates.

I feel confident with this latest update that this need system is prepared for a formal release at 1.0.0!

In this latest update I have made the need system used a state buffer for the status system rather than have it make SQL queries regularly. I would only recommend using txAdmin restarts to ensure that status values are saved - otherwise player’s states should save on relog / logout.

I have also made the effect system optional since it relies on SQL queries to ensure accurate expiration timing across reboots / triggers SQL queries every tick. In the case that it is enabled, I have made it so that if an effect tick is running while the next tick fires, then the effect tick will continue running without spawning unnecessary SQL queries / workload.

If you are upgrading from a previous version, please drop all tables, statusTypes, status, and effect, and rerun pc-needs.sql.

I also would like to add that I most likely will not be updating pc-hud. I have had documentation on GitHub for the exports and events that one would need to replace it but am mentioning it here as well - check out the README for that information.