First, open up wl_state.c and search for the Damage Actor() routine. Look for this block:
- Code:
switch (ob->obclass) // dogs only have one hit point
{
case guardobj:
if (ob->hitpoints&1)
NewState (ob,&s_grdpain);
else
NewState (ob,&s_grdpain1);
break;
case officerobj:
if (ob->hitpoints&1)
NewState (ob,&s_ofcpain);
else
NewState (ob,&s_ofcpain1);
break;
and so on...
Right above that, add this:
- Code:
if (US_RndT()/6<20)
{
Now go down the the } holding the select block, here:
- Code:
case ssobj:
if (ob->hitpoints&1)
NewState (ob,&s_sspain);
else
NewState (ob,&s_sspain1);
break;
}
Right below that }, add another }. Ta da! You're done! Now a little more than half the time the enemies go into their pain states, while in other cases they just receive the damage! Good if you have the blood splat tutorial, so the player can see their still hitting.
Now, getting into the code. Let's say you want them to get into their pain states more/less often. Simple. Look at this code:
- Code:
if (US_RndT()/6<20)
Also, would you like you're knife to cause enemies to always enter pain states? Quite simple. Modify this line:
- Code:
if (US_RndT()/6<20)
- Code:
if (US_RndT()/6<20 || gamestate.weapon==wp_knife)
Now enemies alway enter pain states if stabbed. Hoped you liked the simple tut, and happy wolfing !
EDIT: It could be modified further so diffrent enemies react to shots more/less often - ex. the officer reacts to shots rarely, while the guard does 90% of the time. But I'll leave that up to you.