Wandering NPC

From Off Grid Wiki
Jump to navigation Jump to search

A Wandering NPC is a simplified Agent that you can use to populate your levels with. They do not have a character profile and can not be explicitly controlled via scripts, their sole purpose is to add some life to your scene!

Options on Wandering NPCs

Wandering NPC Table
Name Type Description
spawnPointNames table A list of position strings at which the wandering NPCs should be spawned. Similar to when spawning agents the strings of the table correspond to game objects in the scene with the "Mission Object" script attached and the type set to "Spawn".
spawnNum number The number of NPCs to spawn with this configuration.
wanderNPCsCharacters string The character prefabs used to spawn the NPCs. It is recommended to use a single string to guarantee good results with the head props and textures. If multiple are used, a random entry is chosen. Default value is "Masculine_Med_BomberJacket_NPC".
headProps table A list of head props. Each NPC is assigned a random entry. null can be used to use no head props.
colorTextures table A list of charactor colors. Each NPC is assigned a random entry. "Default" can be used to use the character prefabs default.
metalTextures table A list of metalic values. Each NPC is assigned a random entry. "Default" can be used to use the character prefabs default.
gestures table A list of AI gestures. NPCs perform them with a 10% chance when they stop at a location. Default value is "LookAtPhone".

Note that colour and metal texture are not linked together and are separately chosen at random.

Wandering NPC behaviour

Wandering NPCs are spawned in randomly within a ~25m sphere around the spawn points on valid locations. The NPCs then start wandering to a random reachable spot within the spawning sphere that is at least 10m away using the navmesh. At the location, there is a 10% chance to play a gesture, then the wandering cycle repeats. Since these NPCs are used primarily for giving a visual feeling of the world being alive, they do not drop data points and won't interact with the environment or the player.


Here are some examples to get you started!

function MissionSetup_Always()
    -- Example 1
        {"WanderNPCPoint"}, -- spawnPointNames
        10, -- spawnNum
        {"Feminine_Med_Vest_NPC", "Feminine_Med_SmartJumper_NPC"}, -- wanderNPCsCharacters
        {"F_Lrg_Hair-Long-Fringe_01", "F_Lrg_Glasses-Reading_03"}, -- headProps
        {"Default", "LongJacket_Col_HotelClerk_S1H6.png", "Vest_Col_Col_TruckerBlue.png"}, -- colorTextures
        {"Default", "Waistcoat_Met_Docker.png"}, -- metalTextures
        {"LookAtPhone", "LookingAround" } -- gestures
    -- Example 2
        {"WanderNPCPoint1", "WanderNPCPoint2" },
        {null, "M_Med_Glasses-Reading_03", "M_Med_Glasses-Reading_02", "M_Med_Hat-Sunvisor_01", "M_Med_Beard-Moustache_02"},
        {"Default", "LongJacket_Col_Reporter_S2H3.png", "LongJacket_Col_RemovalPerson_S5H6.png", "LongJacket_Col_Soldier_S5H6.png"},
        {"Default", "Waistcoat_Met_Docker.png"},
        {"LookAtPhone", "Yawn", "Shouting" }