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:
Copy
entityType: string -- represents the entity type-- If spawned with zone strategyzoneID?: string -- (optional) refers to the zoneID in which they spawned-- If spawned with worldgrid strategychunkRow?: number -- (optional) refers to the chunkRow in which they spawnedchunkCol?: number -- (optional) refers to the chunkCol in which they spawned
To fetch those values you can do the following:Client-Side:
Copy
Entity(entityID).state['entityType'] -- for example: "militia"
Server-Side:
Copy
-- Safe way to get entityID since netID never changes-- but entityID could change for the same entity during timelocal entityID = NetworkGetEntityFromNetworkId(netID)Entity(entityID).state['entityType']
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:
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.
Type: table
Ped’s loot table, it’s defined in the following format:
Copy
['exampleItem'] = { itemId = 'exampleItem', -- used for displaying which item you got in the notifications displayName = 'Example Item', minQuantity = 1, maxQuantity = 5, probability = 1.0, metadata = nil}
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.