SALESup to -75%Sales are live in the shop: see the deals
← All scripts

NC Rift — Monsters & Bosses

Monsters with weapons and spells, levels, packs, bosses with phases, portals (rifts) and an in-game editor to place it all. The server decides everything (health, damage, mob brain): players cannot cheat.

  • Works with Qbox, QBCore, ESX or without a framework (detected by itself at start).
  • 9 languages: Italian, English, German, French, Spanish, Portuguese, Chinese, Japanese, Korean.
  • 5 visual styles for bars, notifications, speech bubbles, boss bar and editor: fantasy, scifi, horror, steampunk, dieselpunk.
  • Light: about 0.08-0.25 ms on the client during a fight with 15 mobs.

Full config guide (what to fill in to start, recipes, every option): CONFIG_GUIDE.md.

Requirements

  • FiveM server with OneSync on (the server creates the mobs).
  • Optional: ox_lib (notifications), ox_inventory / qb-inventory (reward items), a framework (money, language, downed players). Without them the resource uses its own functions.

Installation

  1. Copy the nc_rift and nc_rift_assets folders into resources/.
  2. In server.cfg, after the framework and the inventory:
ensure nc_rift_assets
ensure nc_rift
add_ace group.admin nc_rift.admin allow
  1. Restart the server and look at the console: it must print config check: 0 warning(s).
  2. Open the config guide and fill in the zones, mobs, rifts and bosses of your server (section "Quick start").

nc_rift_assets holds the monster peds, the weapons (props in the hand) and the animations. config_assets.lua gives them to the mobs by itself; without nc_rift_assets the mobs use GTA models. Start nc_rift_assets only with the server: never ensure/restart it with players inside, the clients crash. nc_rift instead can be restarted whenever you want.

Your own mods (peds, weapons, animations): put them in a separate resource started before nc_rift and write their names in config_custom.lua (a copy of config_custom.lua.example): it is loaded after config_assets.lua and wins over it.

What is inside

PartWhat it does
MobsTypes with model, weapon (prop attached to the hand, never GTA weapons), hits, spells, levels, resistances, EXP and loot. Sight, hearing, memory, patrol around home, leash, fleeing.
PacksGroups with a leader: they surround you, pick the lonely or hurt prey, run away when the leader dies.
SpellsFire, grab and throw, earthquake, projectiles (lightning, fireball, frost, void), meteor, heal, summoning other mobs, invisibility. States: burn, shock, freeze, slow.
ZonesWhere mobs spawn: circle, polygon or GTA zones, interiors, routing buckets, density, red zones, safe zones, spawn points.
RiftsPortals you can hit that spawn mobs; fixed, timed or random. Reward split by the damage done.
BossesArena, phases, bar at the top of the screen, lines, minimap icon, timed respawn.
RewardsEXP, money and items for mobs, bosses and rifts (to everyone, to the best one or by damage share).
VisualsHealth bars over the mobs, notifications, mob speech bubbles, boss bar, editor: all in the chosen style.
Editor/rift_editor: place mobs, bosses, rifts and zones inside the game, with presets and layers.

Admin commands

Permission: nc_rift.admin (see Installation; it is changed in open/server/hooks.lua → IsAdmin). From the server console they all work except the ones that use the player position.

CommandWhat it does
/rift_editoropens and closes the editor (see below)
/rift_spawn <type> [level] [count]creates mobs in front of you (at most 10 at a time); without a type it lists the types
/rift_pack <type>creates a pack with its leader
/rift_boss <type>spawns a boss in front of you (it replaces the one already alive)
/rift_open <type>opens a rift in front of you
/rift_randomstarts a random rift right now
/rift_close [id]closes a rift (no id: all of them)
/rift_clearremoves every mob
/rift_nuke [radius]kills the mobs near you (default 30 m, at most 200) giving EXP and loot
/rift_counthow many mobs are alive (list in the server console)
/rift_god [on|off]mobs do no damage to you (also automatic while the editor is open)
/rift_blackout [on|off]turns the city lights off or on again
/rift_point add [zone] | del | listadds a spawn point where you stand, removes the nearest one, lists the points per zone
/rift_pedscounts the peds within 150 m per resource that created them (to find who turns pedestrians off)
/rift_weapon x y z rx ry rz [bone] | backtunes in game the weapon of the nearest armed mob; the line to copy into the config goes to chat and console
/rift_exportsquick test of every export
/rift_debug [on|off]writes every step to data/debug.log (off it costs nothing)
/rift_devtest [all|config|anims|peds|props]tests in game the models, animations and effects of the config: result in data/devtest.txt

Editor (/rift_editor)

A free camera opens with the library on the left (tabs Mob, Boss, Rift, Preset) and the properties on the right. While the editor is open mobs do no damage to you. Everything is saved in data/editor/ and the mobs spawn from the placed points when a player gets near (Config.Editor).

ToolHow to use it
Placeclick = place the chosen preset, wheel = rotate
Brushhold = paint many points; wheel = radius, Shift+wheel = density, Ctrl+wheel = minimum distance, Alt = erase inside the circle
Selectclick = select (Shift = add/remove), drag = move, wheel = rotate, Del = delete, Ctrl+Z / Ctrl+Y = undo / redo
Eraseclick on a point = deletes it
Zonecircle (click = center, wheel = radius) or polygon (click = corner, Backspace = remove the last one); normal, red or safe zones

Camera: WASD = move, Space / Q = up / down, Shift = fast, right button held = look.

  • Preset: a mob, boss or rift with its properties (level, health, spells, weapon, EXP, loot, drop chance, seconds to respawn after death: empty = Config.Editor).
  • Layers: groups of points and zones you turn on and off (e.g. a Halloween event).
  • Try now: spawns the real preset once in front of you, without saving it.

Open code (open/) and editable files

The core of the resource is protected (Cfx escrow). These stay readable and editable: config.lua, config/, config_assets.lua, config_custom.lua, locales/, bridge/ (framework, notifications, inventory, party, usable items), items/ (items for ox_inventory), the style of the visuals (web/style.css) and the open/ folder (table below). nc_rift_assets instead is fully protected: only its fxmanifest.lua can be read.

FileWhat you change there
open/server/hooks.luaadmin permission (IsAdmin), who mobs can attack (CanTarget), mob/boss/rift killed events
open/server/xp.luawhere EXP is saved (Config.Xp.Provider = 'custom')
open/server/rewards.luahow to give money and items with your own system
open/server/blackout.luayour weather/lights script (Config.Blackout.Provider = 'custom')
open/client/hooks.lua, open/client/hud.luaclient side notifications and HUD

Details in CONFIG_GUIDE.md, section 4.

Languages

Config.Locale picks the default language; each player sees the texts in the language of their GTA when it is there. The texts are in locales/*.lua. For a new language copy locales/en.lua and translate the texts (keys and placeholders %s / %d stay the same). Shown names of the config types: mob_name_<id>, pack_name_<id>, boss_<id>, rift_name_<id>: if you add your own mob, add its line in every language (without it the id is shown).

Exports and events (for other resources)

Full list with the parameters at the top of server/exports.lua and client/exports.lua.

-- server
exports.nc_rift:SpawnMob('skeleton_warrior', vector3(x, y, z), 3, 0, 0.0, function(mobId, err) end)
exports.nc_rift:SpawnBoss('necromancer_lord', nil, 0, function(bossId, err) end)
local riftId = exports.nc_rift:SpawnRift('sandy_rift', nil, nil, 0)
exports.nc_rift:DamageRift(riftId, 500, src)              -- src = player who gets the reward (optional)
exports.nc_rift:DamageRiftAt(vector3(x, y, z), 5.0, 300, src, 0)   -- spell of another resource: rifts within 5 m
TriggerEvent('nc_rift:damageRiftAt', vector3(x, y, z), 5.0, 300, src, 0)   -- the same, as a server side event
exports.nc_rift:UseRiftItem(src, 'rift_bomb')
exports.nc_rift:DeleteRift(riftId)
exports.nc_rift:DeleteMob(mobId)
exports.nc_rift:NoiseEvent(vector3(x, y, z), 40.0, 0)
local id = exports.nc_rift:StartNoise(vector3(x, y, z), 40.0, 0, 5000)
exports.nc_rift:StopNoise(id)
exports.nc_rift:SetProtectionTime(src, 30)
exports.nc_rift:SetLureTime(src, 30)
exports.nc_rift:SetSilentTime(src, 30)
exports.nc_rift:SetHiddenTime(src, 20)
exports.nc_rift:UseStealthItem(src, 'rift_shadow')
exports.nc_rift:IsRiftEntity(entityOrNetId)
exports.nc_rift:GetMobData(mobIdOrEntity)
exports.nc_rift:GetPlayerXP(src)
exports.nc_rift:AddPlayerXP(src, 100, 'quest')

AddEventHandler('nc_rift:onMobKilled', function(ctx) print(ctx.mobType, ctx.killer) end)
-- nc_rift:onBossKilled, nc_rift:onRiftDestroyed, nc_rift:onPlayerHitBySpell
ExportWhat it does
SpawnMob, SpawnBosscreate a mob or a boss (asynchronous: the result arrives in the function)
DeleteMobremoves a mob
SpawnRift, DamageRift, DeleteRiftopen, damage and close a rift (nil = point from the config)
DamageRiftAtdamage to every rift within a radius of a point: for the spells of other resources (also as the server event nc_rift:damageRiftAt)
UseRiftItemuses a rift breaking item from an inventory other than ox / qb / ESX
UseImmunityItemuses an immunity item from an inventory other than ox / qb / ESX
NoiseEvent, StartNoise, StopNoisea noise (once or repeated, e.g. an alarm): the mobs near come to look
SetProtectionTimemobs ignore the player for N seconds (0 = off)
SetLureTimemobs look for the player for N seconds
SetSilentTime, SetHiddenTimethe player's noises do not draw the mobs / the mobs do not see them (if they hit a mob, that one finds them)
UseStealthItemuses a stealth item from an inventory other than ox / qb / ESX
IsRiftEntity, GetMobDatais it an nc_rift mob? its data (type, level, health, boss, state, position)
GetPlayerXP, AddPlayerXPplayer EXP

Items

The resource has 6 usable items. How long they last and what they do is changed in config.lua: Config.Stealth, Config.RiftItems and Config.ImmunityItems.

ItemName in gameWhat it doesConfig
rift_silenceDust of silencefor 30 s your noises (shots, running, cars) do not draw the monstersConfig.Stealth
rift_shadowShadow cloakfor 20 s the monsters do not see or hear you; if you hit one, it finds youConfig.Stealth
rift_bombAnti-rift bombwithin 10 m of an open rift it takes 800 health from it; with no rift near it is not used upConfig.RiftItems
rift_ward_earthEarth sealfor 60 s earthquake and meteor do not hit you and nothing knocks you downConfig.ImmunityItems
rift_ward_stormStorm sealfor 60 s lightning does not hit you and nothing knocks you downConfig.ImmunityItems
rift_ward_frostFrost sealfor 60 s ice does not hit youConfig.ImmunityItems

Immunities last at most Config.ImmunityItems.maxSec seconds (60). Several seals at once add up.

Installing the items

Everything is in the items/ folder of the resource:

  • items/ox_items.lua: the items ready for ox_inventory (name, weight, description, server.export);
  • items/icons/*.png: the inventory icons (256 × 256, transparent background).

With ox_inventory:

  1. copy the items of items/ox_items.lua into ox_inventory/data/items.lua, inside the return { ... } table;
  2. copy the icons of items/icons/ into ox_inventory/web/images/;
  3. restart ox_inventory (or the server).

server = { export = 'nc_rift.<name>' } makes nc_rift use the item; ox_inventory takes it away by itself.

With Qbox / QBCore / ESX without ox_inventory: create in your inventory items with the same names and the same icons. nc_rift makes them usable by itself and takes 1 away at every use.

With another inventory: when the player uses the item call UseStealthItem, UseRiftItem or UseImmunityItem (see above), then remove the item yourself.

At start the server console says which items your inventory does not know.

Modded maps (without the GTA map)

The resource works on a modded map that replaces the GTA one too:

  • mobs and animals spawn on a spot the client finds on the loaded ground (never in water), not on fixed coordinates;
  • the z of rifts and bosses is corrected to the ground by the first player who passes near;
  • zones, points, rifts and bosses are placed in game with /rift_editor, so on the real map.

To change:

  • the coordinates of the default config (config/zones.lua, config/rifts.lua, config/bosses.lua, config/animals.lua) are places of the GTA map: redo them with the editor or remove them;
  • the background zones wild_* and the animal bands cover a large rectangle of coordinates: if your map is elsewhere, it needs its own zone;
  • shape = 'gta' zones use the GTA zone names and do not count on another map;
  • without a navmesh mobs do not walk around obstacles: choose how they move with Config.Movement.NoNavmesh ('straight', 'teleport_short', 'static'); the log says it with the no navmesh lines.

Common problems

ProblemSolution
config check warnings in the consoleread the warning: it says the wrong key and what it expects; fix until 0 warning(s)
A mob does not show up or a GTA ped appearsthe model is not loaded: check with /rift_devtest peds and that the mod resource starts first
Mobs stand still or walk straightthere is no navmesh in that area (modded islands, MLOs): see Config.Movement
No money or items arrivelook for reward: in the console with /rift_debug on; check Config.Rewards and the inventory
Red lines in F8send us the whole line: it helps us fix it

The full guide in 9 languages is also in the resource's docs/ folder.