Skill & Talent System
The Skill & Talent System is a modular framework for FiveM servers that allows you to add, track, and manage player skills and talents. It is designed to be flexible, extensible, and easy to integrate into any roleplay or other gameplay modes.
IMPORTANT: This is a framework for you to implement - you will need to set up and configure skills and talents and then implement them into your own systems.
Features
- Custom Skills & Talents: Define any number of skills (e.g., Hacking, Fishing, Trucking) and talents (e.g., Quick Learner, Night Vision).
- Progression & XP: Players can gain experience and level up skills through actions or events, determined by you.
- Talent Trees: Support for branching talent trees and unlockable abilities.
- Server-Side & Client-Side Hooks: Easily check a players talents and apply their modifiers on both the client & server side.
- Persistence: Player progress is saved and loaded automatically.
- Configurable UI: The frontend is completely open source, feel free to adjust it to your needs.
Possibilities
- Create RPG-style progression for jobs, criminal activities, or hobbies.
- Unlock new abilities, perks, or access to items as players develop their characters.
- Add depth to police, EMS, mechanics, criminals and any other job roles.
- Encourage long-term player engagement and specialization.
- Add as many skills as you like
- Each time a player levels up in a skill, they gain a talent point to be spent on its talent tree
- Create deep and engaging talent trees, with the ability to add forced and optional prerequisites
- Players can plan out their talent points before submitting changes
Dependencies
strp_skills has the following script dependencies:
Installation
- Add this to the end of your server.cfg:
"ensure strp_skills" - Adjust the included config file
- Make sure the Config.SQL details are correct, the script will insert the required column into your database when it starts.
- There are 2 dummy skills included as examples, you should remove these and replace them with the skills you set up yourself.
- Inside the ui/data folder there are 2 json files that are also included as dummy data, again, you should replace these to create the talent trees for your new skills you create.
- To modify the Introduction page, take a look at the ui/index.html file.
Creating a Talent Tree
As players level up in a skill, they gain 1 talent point per level. These points can then be spent on the talent tree to unlock whatever advantages you wish to give them.
Each skill should have a corresponding json file with the same name in the ui/data folder. If a skill name has spaces in it, replace these with underscores (_).
- Talent Object:
- id: Unique name given to this talent (you can reuse ids in other talents, but they should be unique per file)
- column: This determines which column this talent will appear in on your talent tree (don’t go beyond 5)
- row: This determines which row this talent will appear in on your talent tree (go as deep as you like)
- name: This is the name of this talent shown to players on the talent tree
- description: This is the description of the talent shown to players on the talent tree
- unlocked: This should always be false
- icon: This is the url to the image icon of the talent shown on the talent tree
- dependencies:
- If your talent is at the start of your tree, this should simply be []
- If you want the player to unlock another talent(s) before this one, list them here
- For optional dependencies provide a list of options within the list.
Client-Side Exports
OpenSkills
Opens up the Skills & Talent Tree UI for the player.
local skillLevel = exports.strp_skills:openSkills()GetSkillLevel
Returns the current level of the given skill.
- Parameters:
skillName: Name of the skill (string)
- Returns: Players current skill level (integer), Players current XP (integer)
local skillLevel = exports.strp_skills:GetSkillLevel("Trucking")GetSkillTalents
Returns a list of unlocked talents for a given skill and player.
- Parameters:
skillName: Name of the skill (string)
- Returns: All unlocked talents for skill (strings)
local unlockedTalents = exports.strp_skills:GetSkillTalents("Trucking")Server-Side Exports
GetSkillLevel
Returns the current level of the given skill.
- Parameters:
source: Affected players sourceid (integer)skillName: Name of the skill (string)
- Returns: Players current skill level (integer), Players current XP (integer)
local skillLevel = exports.strp_skills:GetSkillLevel(source, "Trucking")GetSkillTalents
Returns a list of unlocked talents for a given skill and player.
- Parameters:
source: Affected players sourceid (integer)skillName: Name of the skill (string)
- Returns: All unlocked talents for skill (strings)
local unlockedTalents = exports.strp_skills:GetSkillTalents(source, "Trucking")UpdateJobSkill
Adjusts a players XP in any given skill by the provided amount, automatically handling any leveling up or down that occurs.
- Parameters:
source: Affected players sourceid (integer)skillName: Name of the skill (string)XP: Amount of XP to adjust by (integer)AddOrRemove: Whether to “Add” or “Remove” XP (string)
exports.strp_skills:UpdateJobSkill(source, "Trucking", 100, "Add") -- Award the player 100xpResetTalents
Completely resets a players talent tree for a skill, allowing them to re-spend their talent points
- Parameters:
source: Affected players sourceid (integer)skillName: Name of the skill (string)
exports.strp_skills:ResetTalents(source, "Trucking")Example Usage
Here is a basic example of how to obtain a list of a users unlocked talents from a specific skill:
-- Obtain the source players Trucking talents
local truckingTalents = exports.strp_skills:GetSkillTalents(source, "Trucking")
-- Setting some base stats
local basePayMultiplier = 1.1
local baseLaunderAmountMultiplier = 1.075
local additionalRate = 0.0
-- Loop through the users trucking talents
for _, talent in ipairs(truckingTalents) do
-- If the talents name begins with "extra_pay", then adjust their bonus payment
if string.sub(talent, 1, 9) == "extra_pay" then
amount = math.ceil(amount * basePayMultiplier)
-- If the talents name begins with "launder_amount", then increase the amount of money laundered
elseif string.sub(talent, 1, 14) == "launder_amount" then
launderedAmount = math.ceil(launderedAmount * baseLaunderAmountMultiplier)
-- If the talents name begins with "launder_rate", then increase the ratio of laundered money
elseif string.sub(talent, 1, 12) == "launder_rate" then
additionalRate = additionalRate + 0.1
end
end
-- <the rest of your code that then implements these adjusted stats>Tebex: Link