😰 Stress System

Stress System

This is a step-by-step installation guide, configuration preview, and full explanation of all settings for legends_stress.

⚠️

If you lack programming experience, ensure you read each step thoroughly without skipping, as all documentation is essential!

Before submitting a support ticket or following the guides in this documentation, please make sure that you are running the latest version of the resource.

What is legends_stress?

legends_stress is a comprehensive player stress system that adds immersive gameplay effects based on stress levels. Players gain stress from activities like shooting and high-speed driving, and experience visual and audio effects like blur, screen shake, red screen overlay, and heartbeat sounds as stress increases. Stress relief items and yoga mats allow players to reduce their stress levels.

Key Features

  • Multi-Framework Support - Compatible with QB-Core, QBX-Core, and ESX frameworks
  • Multi-Inventory Support - Works with ox_inventory, qb-inventory, and esx_inventory
  • Target System Integration - Supports ox_target and qb-target with auto-detection
  • Visual Stress Effects:
    • Screen blur at various intensities
    • Screen shake with configurable strength
    • Red screen overlay at high stress
    • Fallout/ragdoll effect at 100% stress
  • Audio Stress Effects:
    • Heartbeat sound at high stress (85%+)
    • Custom sound support (builtin NUI, xsound, interact-sound)
  • Stress Gain Sources:
    • Shooting weapons (configurable multiplier)
    • High-speed driving (configurable multiplier)
  • Stress Relief Items:
    • Stress Pills - Medical relief with pill animation
    • Joints - Relaxation item with smoking animation
  • Yoga Mat System:
    • 4 color variants (Blue, Gray, Red, Pro)
    • Place and pick up yoga mats
    • Target interactions for yoga sessions
    • Single-user locking system
    • Auto-despawn timeout
    • Configurable stress relief amount
  • Admin Commands - Set player stress levels directly
  • Exports - Server and client exports for integration

Need help? Join our Discord (opens in a new tab) for support!

FAQ

How do I add a custom stress trigger (e.g. firing a specific weapon or entering an MLO)?

Call exports.legends_stress:AddStress(playerId, amount, reason) from any server script. For client-detected triggers use exports.legends_stress:AddStressClient(amount, reason). Both respect the global cooldown and the per-reason multipliers in config, so you will not double-dip if multiple triggers fire in the same second.

How does the stress decay curve work and can I tune it per player?

Config.Decay.amount points are removed every Config.Decay.interval seconds while the player is not under an active trigger. Override per player with exports.legends_stress:SetDecayRate(playerId, multiplier) to implement buffs (meditation, yoga membership) that speed up natural recovery without disabling the baseline.

How do I add a custom stress-relief item (e.g. herbal tea)?

Register the item in your inventory system, then append Config.ReliefItems = { ["herbal_tea"] = { amount = 15, emote = "drink" } } in config.lua. The server wires up a Use handler for every supported framework (ox_inventory, qb-inventory, ESX) from that table alone, so you do not touch framework code.

How do I tune the escalating visual effects (blur, shake, heartbeat) per threshold?

Config.Effects is an ascending-threshold table: { [20] = { blur = 0.1 }, [50] = { blur = 0.3, shake = 0.2 }, [80] = { heartbeat = true } }. Add, remove or retune thresholds freely. The client applies the highest matching entry each tick, so effects stack cleanly and never pop.

How do I detect a player's current stress from another resource?

exports.legends_stress:GetStress(playerId) returns an integer 0 to 100 on the server. On the client, exports.legends_stress:GetLocalStress() returns the same value for the local player. The value is cached so you can poll it cheaply for scoreboards, status HUDs or custom medical systems.


Legends Store - Premium FiveM Scripts