Infected.lua
The file is still named infected.lua due to the scripts’ initial name. However the correct name would be entities.lua.
StateBags
Entities spawned by mega_entities will have some StateBag values associated to detect which kind of entity type they are and which chunk / zone they belong to depending on the spawn strategy that spawned them.
So far the values that you can find inside an entity spawned by mega entities are those:
To fetch those values you can do the following:
Client-Side:
Server-Side:
Configuration parameters
- displayName: Display name shown in the PROMPT LOCK ON action (holding right mouse button).
- model: Entity ped model
- group: Group tag for the entity check (groups page)[./scripts/entities/configuration/groups] for more info
Example entity
Let’s say we wanted to create a new entity. This entity is a militia man, it will attack infects and attack only hostile players.
Let’s edit the entity types config together:
Entity config parameters
Let’s talk about each of these parameters:
displayName
Type: string
Display name for the entity, it will be shown in prompts, etc.
model
Type: hash
Model hash, a list can be found here.
group
Type: hash
Group hash, refer to the groups guide for more info.
scale
Type: number
Ped scale for size.
outfits
Type: table
If set to nil
, it will choose a random ped outfit across all the vanilla ones. Otherwise, you can pass a list with the outfit “numbers” you want to allow.
maxHealth
Type: number
Max health that the entity will have.
walkStyle
Type: string
The entity walk style. If set to nil
, the default one will be preserved. You can find a list here.
accuracy
Type: number
Ped’s shooting accuracy from 0-100.
seeingRange
Type: number
Ped’s sight detection range.
hearingRange
Type: number
Ped’s hearing detection range.
combatAbility
Type: number
Ped’s combat ability from 0 to 2.
combatMovement
Type: number
Ped’s combat movement type from 0 to 3.
- 0 -> Stationary (Will just stand in place)
- 1 -> Defensive (Will try to find cover and very likely to blind fire)
- 2 -> Offensive (Will attempt to charge at enemy but take cover as well)
- 3 -> Suicidal Offensive (Will try to flank enemy in a suicidal attack)
combatAttributes
Type: table Ped’s combat attributes, in the key part [xxx] there will be the combat attribute we want to enable or disable (true/false). You can find a list (here)[https://github.com/femga/rdr3_discoveries/tree/master/AI/COMBAT_ATTRIBUTES]
equipment
Type: table
Ped’s equipment, these are the weapons the ped will be carrying, and the ammo that they have.
Example: ['weapon'] = ammoQuantity
lootProbability
Type: number Ped’s probability to spawn loot when killed
lootTable
Type: table Ped’s loot table, it’s defined in the following format:
If the item will spawn then a random quantity will be chosen between the minQuantity and maxQuantity range. Metadata can be used for specific frameworks allowing metadata suppport.