mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-18 18:11:22 +00:00
Tweaked bandaging code
This commit is contained in:
parent
10d8937803
commit
2c6b13be74
3 changed files with 70 additions and 22 deletions
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.27 2002/06/01 13:37:02 makro
|
||||||
|
// Tweaked bandaging code
|
||||||
|
//
|
||||||
// Revision 1.26 2002/05/30 21:18:28 makro
|
// Revision 1.26 2002/05/30 21:18:28 makro
|
||||||
// Bots should reload/bandage when roaming around
|
// Bots should reload/bandage when roaming around
|
||||||
// Added "pathtarget" key to all the entities
|
// Added "pathtarget" key to all the entities
|
||||||
|
@ -2357,12 +2360,15 @@ AIEnter_Battle_Fight
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void AIEnter_Battle_Fight(bot_state_t *bs, char *s) {
|
void AIEnter_Battle_Fight(bot_state_t *bs, char *s) {
|
||||||
|
float attack_skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||||
BotRecordNodeSwitch(bs, "battle fight", "", s);
|
BotRecordNodeSwitch(bs, "battle fight", "", s);
|
||||||
trap_BotResetLastAvoidReach(bs->ms);
|
trap_BotResetLastAvoidReach(bs->ms);
|
||||||
//Makro - check if the bot has leg damage
|
//Makro - check if the bot has leg damage
|
||||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
if (random() > attack_skill) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||||
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bs->ainode = AINode_Battle_Fight;
|
bs->ainode = AINode_Battle_Fight;
|
||||||
|
@ -2423,11 +2429,13 @@ int AINode_Battle_Fight(bot_state_t *bs) {
|
||||||
if (bs->enemydeath_time) {
|
if (bs->enemydeath_time) {
|
||||||
if (bs->enemydeath_time < FloatTime() - 1.0) {
|
if (bs->enemydeath_time < FloatTime() - 1.0) {
|
||||||
bs->enemydeath_time = 0;
|
bs->enemydeath_time = 0;
|
||||||
//Makro - check if the bot needs to bandage
|
if (random() > 0.3f) {
|
||||||
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
//Makro - check if the bot needs to bandage
|
||||||
if (RQ3_Bot_CheckBandage(bs)) {
|
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
if (RQ3_Bot_CheckBandage(bs)) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||||
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//
|
}//
|
||||||
|
@ -2777,10 +2785,13 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
||||||
//if the enemy is NOT visible for 4 seconds
|
//if the enemy is NOT visible for 4 seconds
|
||||||
if (bs->enemyvisible_time < FloatTime() - 4) {
|
if (bs->enemyvisible_time < FloatTime() - 4) {
|
||||||
//Makro - bot retreating, enemy not in sight - a good time to bandage
|
//Makro - bot retreating, enemy not in sight - a good time to bandage
|
||||||
if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
|
//if (bs->lastframe_health > bs->inventory[INVENTORY_HEALTH]) {
|
||||||
//If not bandaging already
|
if (random() > 0.3f) {
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
if (RQ3_Bot_NeedToBandage(bs)) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
//If not bandaging already
|
||||||
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||||
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
|
AIEnter_Seek_LTG(bs, "battle retreat: lost enemy");
|
||||||
|
@ -2790,18 +2801,20 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
||||||
else if (bs->enemyvisible_time < FloatTime()) {
|
else if (bs->enemyvisible_time < FloatTime()) {
|
||||||
//if there is another enemy
|
//if there is another enemy
|
||||||
if (BotFindEnemy(bs, -1)) {
|
if (BotFindEnemy(bs, -1)) {
|
||||||
//if the bot has leg damage
|
if (random() < 0.5f) {
|
||||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
//if the bot is hurt
|
||||||
//If the bot wants to bandage and not bandaging already
|
if (RQ3_Bot_NeedToBandage(bs)) {
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING && RQ3_Bot_CheckBandage(bs)) {
|
//If the bot wants to bandage and not bandaging already
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING && RQ3_Bot_CheckBandage(bs)) {
|
||||||
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AIEnter_Battle_Fight(bs, "battle retreat: another enemy");
|
AIEnter_Battle_Fight(bs, "battle retreat: another enemy");
|
||||||
return qfalse;
|
return qfalse;
|
||||||
} else {
|
} else {
|
||||||
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
if (RQ3_Bot_NeedToBandage(bs) != 0) {
|
||||||
//If not bandaging already
|
//If not bandaging already
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Log$
|
// $Log$
|
||||||
|
// Revision 1.40 2002/06/01 13:37:02 makro
|
||||||
|
// Tweaked bandaging code
|
||||||
|
//
|
||||||
// Revision 1.39 2002/05/31 18:17:10 makro
|
// Revision 1.39 2002/05/31 18:17:10 makro
|
||||||
// Bot stuff. Added a server command that prints a line to a client
|
// Bot stuff. Added a server command that prints a line to a client
|
||||||
// and everyone who is spectating him
|
// and everyone who is spectating him
|
||||||
|
@ -2710,7 +2713,7 @@ void RQ3_Bot_IdleActions( bot_state_t *bs ) {
|
||||||
|
|
||||||
|
|
||||||
//check if the bot needs to bandage
|
//check if the bot needs to bandage
|
||||||
if (damage == 2 || ((damage == 1) && RQ3_Bot_CheckBandage(bs))) {
|
if (damage && RQ3_Bot_CheckBandage(bs)) {
|
||||||
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
if (bs->cur_ps.weaponstate != WEAPON_BANDAGING) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
bs->idleAction_time = FloatTime() + 4;
|
bs->idleAction_time = FloatTime() + 4;
|
||||||
|
@ -5997,10 +6000,24 @@ void BotCheckEvents(bot_state_t *bs, entityState_t *state) {
|
||||||
case EV_FALL_FAR:
|
case EV_FALL_FAR:
|
||||||
case EV_FALL_FAR_NOSOUND: // Makro - check for falling damage
|
case EV_FALL_FAR_NOSOUND: // Makro - check for falling damage
|
||||||
{
|
{
|
||||||
//Makro - this is the attack skill, we should be using the overall skill
|
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
||||||
int skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
qboolean willBandage = qfalse;
|
||||||
if (random() > (1.0f - skill)) {
|
//Makro - this is the attack skill, we should be using the overall skill
|
||||||
if (RQ3_Bot_NeedToBandage(bs) == 2) {
|
int skill = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_ATTACK_SKILL, 0, 1);
|
||||||
|
//if the bot isn't in the middle of a fight
|
||||||
|
if (bs->enemy == -1) {
|
||||||
|
if (BotFindEnemy(bs, -1)) {
|
||||||
|
//if an enemy is nearby, a smart bot won't bandage
|
||||||
|
willBandage = (random() > skill);
|
||||||
|
} else {
|
||||||
|
//but it will otherwise
|
||||||
|
willBandage = (random() > (1.0f - skill));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//smart bots don't bandage during a fight
|
||||||
|
willBandage = (random() > skill);
|
||||||
|
}
|
||||||
|
if (willBandage) {
|
||||||
Cmd_Bandage( &g_entities[bs->entitynum] );
|
Cmd_Bandage( &g_entities[bs->entitynum] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,15 @@
|
||||||
<pre>
|
<pre>
|
||||||
<h1>Build Log</h1>
|
<h1>Build Log</h1>
|
||||||
<h3>
|
<h3>
|
||||||
|
--------------------Configuration: cgame - Win32 Release--------------------
|
||||||
|
</h3>
|
||||||
|
<h3>Command Lines</h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Results</h3>
|
||||||
|
cgamex86.dll - 0 error(s), 0 warning(s)
|
||||||
|
<h3>
|
||||||
--------------------Configuration: game - Win32 Release--------------------
|
--------------------Configuration: game - Win32 Release--------------------
|
||||||
</h3>
|
</h3>
|
||||||
<h3>Command Lines</h3>
|
<h3>Command Lines</h3>
|
||||||
|
@ -11,6 +20,15 @@
|
||||||
|
|
||||||
<h3>Results</h3>
|
<h3>Results</h3>
|
||||||
qagamex86.dll - 0 error(s), 0 warning(s)
|
qagamex86.dll - 0 error(s), 0 warning(s)
|
||||||
|
<h3>
|
||||||
|
--------------------Configuration: ui - Win32 Release TA--------------------
|
||||||
|
</h3>
|
||||||
|
<h3>Command Lines</h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Results</h3>
|
||||||
|
uix86.dll - 0 error(s), 0 warning(s)
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue