Skills
VORP skill helpers: read a character's level and XP, and award XP. These functions are VORP-only — on RSG they log a warning and return safe defaults rather than crashing.
GetSkillInfo(source, skillName) → table|nilserver
Returns { level = number, xp = number } for the named skill, or nil if unavailable.
| Param | Type | Description |
|---|---|---|
| source | number | Player server source ID. |
| skillName | string | Skill identifier, e.g. 'hunting', 'fishing'. |
GiveSkillXP(source, skillName, amount) → booleanserver
Awards XP to the named skill. Returns true on success.
| Param | Type | Description |
|---|---|---|
| source | number | Player server source ID. |
| skillName | string | Skill identifier. |
| amount | number | XP to award. |
ApplySkillBonus(source, skillName, amount, notifyMsg) → booleanserver
Awards XP and optionally fires a wc_notify SUCCESS notification to the player.
| Param | Type | Description |
|---|---|---|
| source | number | Player server source ID. |
| skillName | string | Skill identifier. |
| amount | number | XP to award. |
| notifyMsg | string | nil | If provided, fires wc_notify SUCCESS with this message. |
example
-- award 25 hunting XP and notify the player
exports.wc_libs:ApplySkillBonus(source, 'hunting', 25, '+25 Hunting XP')
-- read current level
local info = exports.wc_libs:GetSkillInfo(source, 'hunting')
if info then
print('Level: ' .. info.level .. ' | XP: ' .. info.xp)
end
RSG has no equivalent skill system.
GetSkillInfo and GiveSkillXP return defaults and log a warning on RSG — use WCLib.Framework.Is('vorp') to guard calls if your resource targets both frameworks.
Real Wild County example — corn delivery skill reward
wc_corndelivery/server/main.lua
if wc:Framework.Is('vorp') then
wc:ApplySkillBonus(src, 'trading', 15, '+15 Trading XP')
end
Common mistakes
- Calling
GetSkillInfo/GiveSkillXPon an RSG server and expecting real values — always guard withWCLib.Framework.Is('vorp')first if your resource runs on both frameworks. - Calling these from client code — the module is server-only.
- Using a
skillNamethat doesn't exist on the character's VORP skill table —GetSkillInforeturnsnilrather than a zeroed table in that case, so check before indexing.
Troubleshooting
- If every call warns "VORP-only" in console: you're running on RSG — this whole module intentionally has no RSG equivalent.
- If
GiveXPreturnsfalse: check the skill name matches onevorp_coreactually recognizes oncharacter.setSkills.