Making a Sandbox NPC

From The KillerJim Mod Wiki

Sandbox NPCs

Modiverse allows you to create NPC's and AI's for any game-mode or sandbox environment. This tutorial takes you through creating a simple NPC which will effectively follow the player at a distance of around 5 meters / units.

If you have already created NPC's in UE4 you should still read this guide; certain subtle differences exist due to the sandbox nature of the game.

Collision Setup

Normally UE4 set's characters up as invisible to the tools (such as the Physgun, Remover, etc.) by making them not block Visibility traces. There's been various discussions on why they do this but as yet there are no replies from Unreal. If you wish to have your character affected by the tools you must alter the collision to make it "visible" to them.

The "Capsule Component (inherited)") component

We need to adjust this just setting the collision preset to "Custom" and then enabling the blocking on visibility traces (tick the "block" check box under Visibility). You're collision panel should now look like this:

Check EACH and EVERY collision parameters below; if you get it wrong your NPC will fly off into space when grabbed by the physics guns or do similar strange things when it if ragdolled

CapsuleCollision.png

Skeletal Mesh component

You should ensure that the skeletal mesh is settup up to the Collision Preset of "Ragdoll".

MeshCollision.png

Playing

Developers

Developer Reference