NPCs can be created from humanoid or generic rigs.
Two types of NPCs can be created by default with two types of behaviour:
- guard behaviour of NPC is standing in place until it sees an
enemy ( enemy team member ) at which it starts to chase him ( if ‘Aggressive’ disposition is set )
- patrol behaviour patrols scene on assigned waypoints until it sees an enemy ( enemy team member ) at which it starts to chase him ( if 'Aggressive' disposition is set ).
- aggressive disposition attacks member of enemy team on sight when in the guard zone.
- defensive disposition is not attacking an enemy on sight but is
just doing its job unless attacked. If attacked, defensive
switches to aggressive and attacker team is added to enemy teams.
Creaton Steps:
- import character model.
- drag it on the scene.
- click on 'Tools/Combat Framework/Third Person Creator/Create Npc' to open NPC creaton window.
- choose one of current behaviours of NPC ( Guard, Patrol ).
- choose NPC disposition ( aggressive, defensive, passive ).
- drag character model to 'Character' field and fll other stats as
wished.
- you can choose to create or skip some NPC components like
trigger management and others.
- at the end click 'Create' to finish.
NOTE: if NPC is of a generic rig, additonal fields need to be filled:
- head and chest transform - needed for player/enemy target positons.
It will choose automatcally if NPC is humanoid from animator
'GetBoneTransform (...)' method.
You can reassign later if needed.
Generic rigs cannot use default provided NPC animator ( can be
found in 'Resources/Animators/NPCAnimator' ) but must be
created for each model separately.
Custom animator for generic NPCs need to have the next
parameters:
'pSide',
'pForward',
'pJump',
'pAtackSpeed',
'pAtackSpeed2',
'pAtackSpeed3',
'pJumpLeg',
'pMatchStart',
'pMatchEnd',
'pTriggerType',
'pCrouch',
'pOnGround',
'pBlock',
'pAtack1',
'pStrafe',
'pDiveRoll'.
If not removed manually from code, the animator will throw
missing parameter errors.
Next, create default locomoton state and call it
'DefaultLocomoton'.
You can start the atack state by using 'pAttack' parameter and you
can combine it with 'pTriggerType' parameter to start different
atacks.
You can look in the code how that work by checking behaviour class method ‘executeAttack(...)’ ( currently it attacks targets by distance ).
Look in the examples in package on how to expand animator for
generics for trigger/acton usage.
Also, animator controller can be assigned in the creation window
or can be created and assigned later.
Optional components are:
- default health indicators. Show the current health of NPC. Its run
by 'HealthUI' component.
You can remove it entrely and use your
own health display system.
- default damage received indicator. Show current damage done
by floating text. Controlled by 'TextUI' component.
You can
remove it and use your own damage indicator system.
- trigger manager ( component 'TriggerManagement' ). It controls
NPC trigger transiton like jumping over obstacles, climbing onto
something, jumping down etc.
*If a rig is humanoid, you get an opton to create ragdoll on
creation.
More on ragdoll in ragdoll secton.
You can add more attacks ( attack animations ) by adding additional attack states.
Add name of state in format of ‘Attack’ + attack number.
( for instance, there is currently 4 attacks in NPC animator ( 0 – 3 ). To add fifth, add new state called ‘Attack4’ ).
Next, in 'NpcAttacks' component add new entry in attacks array and fill up the fields – add range, type, is it unbreakbale etc..