This is a package that can provide you with a number of options for using NPC’s without needing to code!
Package Name: NPC System
Feel free to reach out on Discord with any questions or drop a comment here!
Package Contents
- NPC - The NPC primitive with attached logic in script folders
- NPC Path Node - A locator with logic used with the movement system
- NPC Action Trigger - A trigger used to trigger actions on a given set of NPC’s
NPC
The NPC template is the primitive NPC but with added logic already defined. This allows you to control NPC’s via the various script properties without needing to write and code.
NPCAction
- Script = npcBaseActionsScript
- Properties
- Crouch on Init - When enabled the NPC will crouch when the server starts
-
Emote on Init - When enabled the NPC will emote when the server starts
- Emote To Play - The emote that the NPC should perform
-
Looping - When enabled it will perform the emote in a loop
- Loop Time - How long should the NPC wait between performing the emote again
-
Look on Init - When enabled the NPC will look at a given target
-
Look At Target Type - Dropdown for target type between entity and position
- Target Entity - The instance of an entity that the NPC will look at (if target type is entity)
- Target Position - The position (Vector3) that the NPC will look at (if the target type is position)
-
Look At Target Type - Dropdown for target type between entity and position
NPCMovement
- Script = npcMovementScript
- Properties
- Path Nodes - The instances of “NPC Path Node” that form the route for this NPC
- Loop - When enabled the NPC will loop back to the start, otherwise they’ll stop at the end
- Include Start Position - When enabled the spawn location for the NPC will form a position in the route
- Move on Init - When enabled the NPC will move straight away, otherwise they’ll need triggering from elsewhere
- Debug - When enabled the script will output data to the console for debugging with
NPCInventory
- Script = npcInventoryViewScript
- Properties
- Held Template - The template the NPC should start with (item requires inventoryItemSpecScript from the stock Inventory Package)
- On Held Item - An event that is called when the NPC is given an item to hold
NPC Path Node
The path nodes are the “checkpoints” that form an NPC’s pre-determined route. At these nodes there are options for what the NPC should do at these points. When placed in the world these nodes can be assigned to the Path Nodes property in the NPCMovement script folder. Each node comes with the following properties…
-
Should Pause - When enabled the NPC will pause here before continuing
- Pause Length - How long should the NPC pause for
- Should Pause First - When enabled the NPC will pause BEFORE performing actions otherwise they’ll do the actions first.
-
Should Give Item - When enabled the NPC will receive an item (template) via the inventory system
- Item to Give - The template that the NPC should receive at this node
-
Actions - An array of pre-determined actions that the NPC can perform
- Clear Inventory - Clears what they are holding
- Reset Inventory - Resets the inventory back to the state it was in when the server started (according to NPCInventory properties)
- Jump - NPC will jump
- Stand - NPC will stand
- Crouch - NPC will crouch
- Stop Looking - NPC will stop looking at their target
-
Should Emote - When enabled the NPC will emote at this node
- Emote To Play - The emote the NPC will perform at this node
NPC Action Trigger
The action trigger allows you to trigger certain actions on a given set of NPC’s when a player enters the trigger zone. The properties of this trigger are…
- NPCs - An array of instances of NPCs that this trigger affects
-
Trigger Emote - Trigger an emote on the NPCs
-
Trigger Random Emote - When enabled the NPC will play a random emote from an array
- Emotes To Trigger - An array of emotes to play randomly (if “Trigger Random Emote” checked)
- Emote To Trigger - A dropdown of the emote to play (if “Trigger Random Emote” not checked)
-
Trigger Random Emote - When enabled the NPC will play a random emote from an array
-
Look At Player - When enabled the NPC will look at (and track) the latest player to enter the trigger (Note that on exiting the trigger the NPC will check to see about looking at anyone else still in there, otherwise they’ll revert to looking at no-one)
- Socket To Focus On - Which socket on the player should the NPC look at specifically (‘None’ will look at the player root)