I have a NPC which is a clone of Barney except that it's hostile and has a shield (also it doesn't speak, meaning it's based on "CSquadMonster" instead of "CTalkMonster").
I have a "shield" animation linked to ACT_EXCITED, the NPC crouch, place it's shield, wait a bit then return to standing and aiming, that animation last for 5,58 seconds.
The shield itself works, the damage is blocked if you shoot it or spam your crowbar at it, the problem is below.
When I "force" the activity to ACT_EXCITED (in other words, I force the NPC to use it's shield), he use it for a second and start shooting at me again (or chase me). I want the NPC to keep shielding himself until he dies or the animation finished, how can I achieve that ?
Here is the code that forces the NPC to use it's shield (in the PrescheduleThink method)
m_IdealActivity = ACT_EXCITED;
m_flShieldTime = gpGlobals->time + 5.58f; // Shield for 5,58 seconds
m_flNextShieldTime = gpGlobals->time + 15.0f; // 15 seconds before using the shield again
In the GetSchedule method:
if ( m_Activity == ACT_EXCITED )
return &slMyNPCShield[ 0 ];
Thank you in advance for your help