Skip to content

Exports & events ​

Return convention ​

Server exports return the value on success, or false and an error code when a rule refuses the call. Codes are stable strings (insufficient_funds, too_heavy, …); a French text for each is in wf_core/client/locale.lua.

lua
local ok, err = exports.wf_inventory:AddItem(source, "water", 2)
if not ok then print("refused: " .. err) end

In inventory exports, ref is either a player id (that player's loaded character) or an inventory id string ("stash:police_armory", "trunk:ABC_123", "char:12").

wf_core server exports ​

ExportReturns
GetPlayer(source)character view (below) or nil
GetPlayers()ids of players with a loaded character
GetPlayerByCharacter(charId)player id or nil
GetIdentifier(source)"wfx:…" / "guest:…"
GetMoney(source, account)balance (account = "cash" or "bank")
AddMoney(source, account, amount, reason?)new balance
RemoveMoney(source, account, amount, reason?)new balance
SetMoney(source, account, amount, reason?)new balance
TransferBank(from, to, amount, reason?)true
SetJob(source, job, grade?)true
GetJobs()the jobs table
GetStatus(source, name?)one need (0–100) or all of them
SetStatus(source, name, value) / AddStatus(source, name, delta)new value
SetDuty(source, onDuty)new state (false, "no_job" when unemployed)
IsOnDuty(source)boolean
SetGroup(source, name, grade?) / RemoveGroup(source, name)true
HasPermission(source, permission)boolean — WFramework groups or server ACE
AddAccountGroup(source, group) / RemoveAccountGroup(source, group)true
SavePlayer(source)true if the position was saved
GetAppearance(source)appearance object
SetAppearance(source, appearance, merge?)true
AllowAppearanceEdit(source, on?)true — lets the client send its appearance once
Notify(source, text, type?)true

Character view:

lua
{
  id = 12, firstname = "Ana", lastname = "Lopez", dob = "1991-02-03", sex = "f",
  money = { cash = 500, bank = 2500 },
  job = { name = "police", label = "Police de Bolivie", grade = 1, gradeLabel = "Agent", salary = 300, boss = false },
  groups = { cartel_sb = 2 },
  coords = { x = 0.0, y = 0.0, z = 0.0, h = 0.0 },
}

wf_inventory server exports ​

ExportReturns
Items(name?)one item definition, or all
AddItem(ref, name, count, metadata?, slot?)true
RemoveItem(ref, name, count, metadata?, slot?)true
CanCarryItem(ref, name, count, metadata?)boolean
GetItemCount(ref, name, metadata?)number
Search(ref, name)list of slots holding the item
GetSlot(ref, slot)slot data or nil
SetMetadata(ref, slot, metadata)true
ClearInventory(ref)true
GetInventory(ref)inventory view { id, type, label, slots, maxWeight, weight, items }
RegisterStash({ id, label?, slots?, maxWeight?, owner?, groups?, coords? })"stash:<id>"
GetTrunk(plate)"trunk:<PLATE>"
OpenInventory(source, type, id)true — opens it on the player's screen
CloseInventory(source)true
RegisterUsableItem(name, function(source, item, slot) end)true
GetLoadout(source)equipped weapons [{ slot, name, label, weapon, ammo, serial }]
ToggleWeapon(source, slot)true if now equipped

Slot data: { slot, name, label, count, weight, metadata, image, stack, usable } (weight = total of the stack).

Server events (for Lua server scripts) ​

EventArguments
wf:playerLoadedsource, character
wf:playerUnloadedsource, charId
wf:moneyChangedsource, account, balance, delta, reason
wf:jobChangedsource, job, old
wf:dutyChangedsource, onDuty
wf:statusChangedsource, status, changedNames
wf:statusEmptysource, name — a need reached 0
wf:groupChangedsource, name, grade (nil = removed)
wf:appearanceChangedsource, appearance
wf_inventory:loadoutChangedsource, loadout
wf_inventory:usedItemsource, name, slot, data

Client events (for Lua client scripts) ​

EventArguments
wf:client:playerLoadedcharacter
wf:client:playerUnloaded—
wf:client:moneyChangedaccount, balance, delta
wf:client:jobChangedjob
wf:client:dutyChangedonDuty
wf:client:statusChangedstatus
wf:client:loadoutChangedloadout

Client exports ​

They read the client's copy and are for display only: decisions belong to the server.

ExportReturns
wf_core:GetPlayerData()character view (as on the server) or nil
wf_core:IsLoaded()boolean
wf_core:IsOnDuty()boolean
wf_core:GetStatus(name?)one need or all of them
wf_core:GetLoadout()equipped weapons
wf_core:GetAppearance()appearance object
wf_core:UI()the WFramework UI layer (notify(text), list(scene, def), available())
wf_core:ErrorText(code)French text for an error code
wf_inventory:GetPlayerItems()non-empty slots of the player's inventory
wf_inventory:GetItemCount(name)number
wf_inventory:GetDrops()[{ id, coords }]

Network messages ​

Client → server (intentions, all validated):

EventArguments
wf:requestCharacters · wf:logout—
wf:selectCharacter · wf:deleteCharactercharId
wf:createCharacter{ firstname, lastname, dob, sex }
wf:giveCashtarget, amount
wf:saveAppearanceappearance (only after AllowAppearanceEdit)
wf_inventory:ammoserial, rounds (only a decrease is accepted)
wf_inventory:move{ from = "player"|"secondary", fromSlot, to, toSlot, count? }
wf_inventory:givetarget (0 = nearest player, chosen by the server), slot, count?
wf_inventory:dropslot, count?
wf_inventory:useslot
wf_inventory:openNearby · wf_inventory:close · wf_inventory:refresh—

Server → client:

EventArguments
wf:characterslist, maxCharacters
wf:playerLoaded · wf:playerUnloadedcharacter / —
wf:spawn{ coords, appearance, loadout } — strip campaign gear, apply outfit, teleport
wf:applyAppearance · wf:applyLoadoutappearance / loadout
wf:setMoney · wf:setJob · wf:setGroup · wf:setDuty · wf:setStatus{ account, delta, balance } / job / name, grade / onDuty / { hunger, thirst… }
wf:notify{ type, text? , code? }
wf_inventory:init{ inventory, items, drops }
wf_inventory:update{ side, id, weight, maxWeight, slots } — only the changed slots
wf_inventory:open · wf_inventory:closed{ player, secondary } / id
wf_inventory:drops[{ id, coords }]

WildM is an independent community project. It is not affiliated with or endorsed by Ubisoft. Ghost Recon Wildlands is a trademark of Ubisoft Entertainment.