This script provides comprehensive control over AI relationships, spawn frequencies, location restrictions, and visual model replacements to create immersive and optimized server environments.
Features
Relationship Control
Define default AI-to-AI relationships globally, configure group behaviors toward players, and set conditional rules based on time, job, weather, and more.
Spawn Frequency Management
Globally control ped, animal, and traffic spawn density with area-specific overrides for different zones and events.
Volume-Based Restrictions
Define boxes or spheres to control AI spawn types in key locations, blocking specific ped types like dangerous animals, town NPCs, lawmen, and birds.
Model Replacements
Replace the visual appearance of specific peds in defined areas while maintaining original model logic for animations and behavior.
Debugging Tools
Toggle debug mode for verbose logs and define custom conditions as Lua functions directly in the configuration.
Framework Integration
Compatible with VORP Core and RSG Core frameworks with modular framework bridge support.
Installation
1
Download
Get the latest release from our Tebex Store and download it from your Keymaster
2
Extract
Extract the
spooni_ambientPedManager
folder to your server’s resources
directory3
Configure
Add
ensure spooni_ambientPedManager
to your server.cfg
4
Customize
Edit
config.lua
to match your server logic and requirementsConfiguration
The script is highly configurable through theconfig.lua
file. Here are the main configuration sections:
Relationship Types
Define the numeric values for each relationship type:Group Relationships
Set static relationships between two AI groups:Player Relations
Configure how groups behave around the player:Conditional Rules
Dynamic rules based on game context (time, job, weather, etc.):Use
"player"
in conditional rules to dynamically resolve the player’s group. The rel_cop
group maintains persistent relationships via background loop.Spawn Frequency
Set global ambient spawn values (0.0–1.0):Location-Specific Spawn Frequency
Area-specific spawn density overrides:Location Restrictions
Restrict or allow ped types in volumes (box or sphere):Model Replacements
Replace ped appearances visually in a zone:Model types must match (e.g., human with human, horse with horse). Model replacements only affect visual appearance, not base behavior.
Advanced Configuration
Custom Conditions
Define custom conditions as Lua functions directly in the config:Debug Mode
Enable verbose logging for development:Usage Examples
Creating Faction Conflicts
Time-Based Behavior
Event Zones
Performance Considerations
The script is optimized for performance with several key features:
- Conditional Checking: Configurable tick rate via
ConditionCheckTimer
- Volume-Based Restrictions: Efficient area-based ped control
- Selective Spawning: Location-specific spawn density management
- Background Processing: Persistent relationship maintenance for critical groups
Performance Tips
- Check Timer: Increase
ConditionCheckTimer
for less frequent condition checks - Volume Optimization: Use appropriate volume sizes for restrictions
- Spawn Limits: Set reasonable spawn frequencies to prevent performance issues
- Debug Mode: Disable debug mode in production for optimal performance
Troubleshooting
Relationships not working
Relationships not working
Verify group names are correct, check that conditional functions return proper boolean values, and ensure the script is properly started in your server.cfg.
Spawn restrictions not applying
Spawn restrictions not applying
Confirm volume names exist in the game map or are manually created, check coordinate accuracy, and verify spawn frequency values are between 0.0 and 1.0.
Model replacements not visible
Model replacements not visible
Ensure model types match (human with human, animal with animal), verify coordinates and radius are correct, and check that target models exist in your server.
Performance issues
Performance issues
Reduce condition check frequency, limit the number of conditional rules, optimize volume sizes, and disable debug mode in production.
Volume restrictions not working
Volume restrictions not working
Verify volume names are valid, check coordinate positioning, and ensure the volume is properly defined in the game world or created manually.
Framework Integration
The script includes built-in support for multiple frameworks:Limitations
Be aware of the following limitations when configuring the script:
- Volume Names: Volume names must exist in the game map or be manually created
- Model Replacements: Only affect visual appearance, not base behavior
- Relationship Persistence: Only
rel_cop
andplayer
relationships are enforced continuously - Condition Functions: Must return boolean values and be properly formatted