Adding NPCs

From Tripwire Interactive Wiki
Jump to navigation Jump to search

Objective mode supports non player characters via the 'KF_StoryNPC' pawn. These pawns can be placed by the level designer and hooked up to Scripted Sequences to do things like walk around, or attack stuff. See this link for a comprehensive tutorial on creating Scripted Sequences and associating them with pawns.


Note that there are two flavors of the StoryNPC : KF_StoryNPC is a 'NoDelete' actor, which means that it cannot be spawned or destroyed at runtime. It is placed in the editor by a level designer and any properties the level designer sets will appear the same to clients in network games. If you want to have an NPC that can be killed / destroyed or spawned at runtime you need to use a KF_StoryNPC_Spawnable. The reason for having these two different flavors of pawn is mainly because of how unreal handles replicating actor properties. Pawns which are spawned at runtime appear on clients with whatever values were assigned in their class default properties. This is perfectly acceptable if you are creating a character who's behavior and appearance is defined in code, but less useful if you want to have a level designer placing large groups of NPCs in his map and changing things like their size or mesh, adding different textures to them, etc etc. If you were creating an RPG style city hub area which had a ton of generic NPCs loitering around, you would probably want to use the KF_StoryNPC NoDelete actor since you could easily tweak their properties in the level editor without having to touch any code.