Skip to content

Exports & events ​

See the source API reference for complete parameter shapes and trust boundaries. Common server exports:

lua
exports.np_needs:get(serverId, 'hunger')
exports.np_needs:getAll(serverId)
exports.np_needs:set(serverId, 'thirst', 75)
exports.np_needs:add(serverId, 'stress', 5, 'robbery')
exports.np_needs:consume(serverId, 'burger', slot, metadata)

exports.np_needs:registerEffect('my_resource.focus', {
    duration = 120,
    tags = { 'stimulant' },
    modifiers = { stamina = 0.15 },
})
local id = exports.np_needs:applyEffect(serverId, 'my_resource.focus', {
    intensity = 0.5,
    duration = 60,
})

Other useful server exports include addAlcohol, GetBAC, GetBodyState, getDependence, addDose, addStress, relieveStress, getOverdoseLoad and resolveOverdose. Client exports expose a cosmetic local snapshot, comfort setting and local-only effects.

The server emits np_needs:changed, np_needs:threshold, np_needs:consumed, effect lifecycle events, np_needs:overdose, np_needs:overdoseCollapse and np_needs:breathTest. Mutating exports clamp values and use caller/player rate limits. Effect and item registrations belong to the calling resource and are removed when it stops.