A dynamic territory system for RedM that creates dangerous zones with mounted NPC bandits who patrol and defend their territory.
Description
Dangerous Zones adds a dynamic territory system to your RedM server, creating hostile areas patrolled by aggressive mounted NPCs. When players enter these zones, they’ll be confronted by bandits who will pursue and attack them. The system features smart NPC behavior, territory management, and configurable danger zones.
Demo
Features
-
Dynamic Territory System
- Define custom dangerous zones and districts
- Visual map indicators for dangerous territories
- Configurable zone coloring and boundaries
-
Intelligent NPC System
- Smart mounted bandits that patrol territories
- Dynamic spawn and pursuit mechanics
- Realistic horse-mounted combat
- Configurable NPC behavior and attributes
-
Advanced Combat Features
- Strategic NPC positioning and tactics
- Customizable weapons and difficulty
- Dynamic pursuit and engagement ranges
- Smart repositioning during combat
-
Performance Optimized
- Efficient resource management
- Smart cleanup systems
- Configurable spawn limits and distances
- Minimal performance impact
Usage
Once installed and configured:
- Players will see marked dangerous territories on their map
- Entering these zones triggers a warning notification
- After a brief delay, mounted bandits will appear and engage
- Players must either fight or escape the territory
- Leaving the zone will cause NPCs to become passive
Configuration
The script is highly configurable through the config.lua file:
Config = {}
-- Enable/disable debug messages in console
Config.debug = false
Config.NPCAttack = {
-- Distance from player at which NPCs will spawn (in game units)
spawnDistance = 50.0,
-- Maximum distance NPCs will chase player before repositioning
followDistance = 100.0,
-- Distance at which NPCs will return to their original position when player leaves danger zone
returnDistance = 150.0,
-- Distance at which NPCs will be completely removed from the world after player leaves danger zone
cleanupDistance = 100.0,
-- Time in milliseconds before NPCs start attacking after entering danger zone
timeBeforeAttack = 2000,
-- Time in milliseconds to wait before spawning a replacement for dead NPCs
respawnDelay = 1000,
-- Maximum number of NPCs that can be active at once
maxActiveNPCs = 10,
onDeath = function ()
-- Custom code here, will be excuted when player die durig the fight in zone.
end,
-- List of weapons that NPCs can spawn with
-- These must be valid weapon hash names from the game
weapons = {
"WEAPON_REPEATER_CARBINE",
"WEAPON_REVOLVER_CATTLEMAN",
"WEAPON_RIFLE_BOLT"
},
-- NPC and horse model configurations
models = {
-- Ped models that will be used for the attackers
peds = {
"G_M_M_UniBanditos_01",
"G_M_M_UNIGRAYS_01",
"G_M_M_UNIMOUNTAINMEN_01"
},
-- Horse models that the NPCs will ride
horses = {
"a_c_horse_appaloosa_blacksnowflake",
"a_c_horse_kentuckysaddle_grey",
"A_C_Horse_Morgan_Bay",
'a_c_horse_morgan_bayroan',
}
}
}
Config.Colors = {
-- Color/style used for marking dangerous zones on the map
-- Must be a valid blip style hash from the game
ZONE = 'BLIP_STYLE_WANTED_REGION'
}
Config.T = {
enterZoneTitle = "~red~Warning!",
enterZoneDescription = "You have entered a dangerous territory. Leave now or face the consequences!",
enterAgainTitle = "~red~Danger!",
enterAgainDescription = "The bandits have spotted you again!",
leftZoneTitle = "~#ffcc00~Escaped!",
leftZoneDscription = "You have left the dangerous area. The bandits have stopped pursuing you.",
}
-- Configuration for dangerous zones on the map
Config.DangerousZones = {
["New Austin"] = { -- State name
state = {
zoneHash = 0x79E6A26B, -- Hash used for state zone detection
mapZoneHash = 0x41759831 -- Hash used for coloring the state on the map
},
-- Districts within the state that are considered dangerous
districts = {
{
name = "DISTRICT_CHOLLA_SPRINGS",
zoneHash = -108848014, -- Hash for district zone detection
mapZoneHash = 0x99B6A1E6 -- Hash for coloring the district on the map
},
{
name = "DISTRICT_GAPTOOTH_RIDGE",
zoneHash = -2066240242, -- District zone detection hash
mapZoneHash = 0x3AC128F9 -- District map coloring hash
},
{
name = "DISTRICT_HENNIGANS_STEAD",
zoneHash = 892930832, -- District zone detection hash
mapZoneHash = 0x33D88587 -- District map coloring hash
},
{
name = "DISTRICT_RIO_BRAVO",
zoneHash = -2145992129, -- District zone detection hash
mapZoneHash = 0xD428627B -- District map coloring hash
}
}
}
}
-- for adding more zone
-- zoneHash : https://github.com/femga/rdr3_discoveries/blob/master/zones/README.md
-- mapZoneHash : https://github.com/femga/rdr3_discoveries/tree/master/graphics/minimap/wanted_regions
Dependencies
Get it Now
Code is accessible | No |
Subscription-based | No |
Lines (approximately) | 700+ |
Requirements | bln_notify |
Support | Yes |