Progress 2.

This commit is contained in:
JezuzLizard
2023-07-09 17:57:55 -07:00
parent 845b377eff
commit 8343d597c7
6 changed files with 442 additions and 435 deletions

View File

@ -822,6 +822,11 @@ ReverseHeap( item, item2 )
return item < item2; return item < item2;
} }
HeapPriority( item, item2 )
{
return item.priority > item2.priority;
}
/* /*
A heap invarient comparitor, used for traces. Wanting the trace with the largest length first in the heap. A heap invarient comparitor, used for traces. Wanting the trace with the largest length first in the heap.
*/ */

View File

@ -12,14 +12,10 @@ bot_post_think_common( state )
case "completed": case "completed":
self bot_objective_print( obj.group, obj.id, "Bot <" + self.playername + "> objective was completed", "bot_post_think_common" ); self bot_objective_print( obj.group, obj.id, "Bot <" + self.playername + "> objective was completed", "bot_post_think_common" );
break; break;
case "postponed":
self bot_objective_print( obj.group, obj.id, "Bot <" + self.playername + "> objective was postponed Reason: " + self.obj_postponed_reason, "bot_post_think_common" );
break;
case "canceled": case "canceled":
self bot_objective_print( obj.group, obj.id, "Bot <" + self.playername + "> objective was canceled Reason: " + self.obj_cancel_reason, "bot_post_think_common" ); self bot_objective_print( obj.group, obj.id, "Bot <" + self.playername + "> objective was canceled Reason: " + self.obj_cancel_reason, "bot_post_think_common" );
break; break;
} }
self.obj_postponed_reason = "";
self.obj_cancel_reason = ""; self.obj_cancel_reason = "";
self thread ClearScriptGoal(); self thread ClearScriptGoal();
self ClearScriptAimPos(); self ClearScriptAimPos();
@ -43,10 +39,7 @@ bot_grab_powerup()
self bot_set_objective( "powerup", powerup_obj_ent ); self bot_set_objective( "powerup", powerup_obj_ent );
self bot_set_objective_owner( "powerup", powerup_obj_ent ); self bot_set_objective_owner( "powerup", powerup_obj_ent );
self bot_objective_print( "powerup", powerup_obj.id, "Bot <" + self.playername + "> starts objective", "bot_grab_powerup" ); self bot_objective_print( "powerup", powerup_obj.id, "Bot <" + self.playername + "> Attempting to grab powerup", "bot_grab_powerup" );
while ( true )
{
wait 1;
self SetPriorityObjective(); self SetPriorityObjective();
self SetScriptGoal( powerup_obj_ent.origin ); self SetScriptGoal( powerup_obj_ent.origin );
@ -54,8 +47,9 @@ bot_grab_powerup()
if ( result != "goal" ) if ( result != "goal" )
{ {
self bot_objective_print( "powerup", powerup_obj.id, "Bot <" + self.playername + "> bad path", "bot_grab_powerup" ); self.obj_cancel_reason = "Bad path/new goal";
continue; self notify( "powerup_cancel" );
return;
} }
//Wait to see if the bot was able to grab the powerup //Wait to see if the bot was able to grab the powerup
wait 0.5; wait 0.5;
@ -63,13 +57,13 @@ bot_grab_powerup()
if ( isDefined( powerup_obj_ent ) ) if ( isDefined( powerup_obj_ent ) )
{ {
height_difference = powerup_obj_ent.origin[ 2 ] - self.origin[ 2 ]; height_difference = powerup_obj_ent.origin[ 2 ] - self.origin[ 2 ];
if ( height_difference > 0 && height_difference < 49 ) if ( height_difference > 0 && height_difference < 39 )
{ {
self BotJump(); self BotJump();
wait 0.5; wait 0.5;
waittillframeend; waittillframeend;
//Check if bot was able to grab the powerup by jumping //Check if bot was able to grab the powerup by jumping
if ( self bot_has_objective() || isDefined( powerup_obj_ent ) ) if ( isDefined( powerup_obj_ent ) )
{ {
//Mark objective as bad so bots will ignore it from now on //Mark objective as bad so bots will ignore it from now on
powerup_obj.bad = true; powerup_obj.bad = true;
@ -82,16 +76,11 @@ bot_grab_powerup()
if ( powerup_obj.bad ) if ( powerup_obj.bad )
{ {
self bot_objective_print( "powerup", powerup_obj.id, "Bot <" + self.playername + "> objective was marked as bad", "bot_grab_powerup" ); self.obj_cancel_reason = "Obj was marked as bad";
break; self notify( "powerup_cancel" );
return;
} }
} }
}
}
bot_powerup_process_order()
{
return 0;
} }
bot_powerup_init() bot_powerup_init()
@ -143,7 +132,7 @@ bot_should_grab_powerup()
{ {
continue; continue;
} }
if ( !isDefined( generatePath( self.origin, powerup.origin, self.team, level.bot_allowed_negotiation_links ) ) ) if ( self GetPathIsInaccessible( powerup.origin ) )
{ {
continue; continue;
} }
@ -172,19 +161,9 @@ bot_powerup_should_cancel()
return goal_canceled; return goal_canceled;
} }
bot_powerup_should_postpone()
{
return false;
}
bot_powerup_priority() bot_powerup_priority()
{ {
if ( !isDefined( self.available_powerups ) ) return 3;
{
return 0;
}
//return self.available_powerups[ 0 ].target_ent.priority;
return 0;
} }
//TODO: Possibly add the ability to circle revive? //TODO: Possibly add the ability to circle revive?
@ -204,12 +183,7 @@ bot_revive_player()
player_to_revive = player_to_revive_obj.target_ent; player_to_revive = player_to_revive_obj.target_ent;
self bot_set_objective( "revive", player_to_revive ); self bot_set_objective( "revive", player_to_revive );
self bot_set_objective_owner( "revive", player_to_revive ); self bot_set_objective_owner( "revive", player_to_revive );
self bot_objective_print( "revive", player_to_revive_obj.id, "Bot <" + self.playername + "> objective started", "bot_revive_player" ); self bot_objective_print( "revive", player_to_revive_obj.id, "Bot <" + self.playername + "> Attempting to revive " + player_to_revive.playername, "bot_revive_player" );
//If player is no longer valid to revive stop trying to revive
//If bot doesn't have an objective anymore or the objective has changed stop trying to revive
while ( true )
{
wait 1;
//Constantly update the goal just in case the player is moving(T5 or higher only) //Constantly update the goal just in case the player is moving(T5 or higher only)
self ClearScriptAimPos(); self ClearScriptAimPos();
self SetPriorityObjective(); self SetPriorityObjective();
@ -219,17 +193,22 @@ bot_revive_player()
if ( result != "goal" ) if ( result != "goal" )
{ {
self bot_objective_print( "revive", player_to_revive_obj.id, "Bot <" + self.playername + "> bad path", "bot_revive_player" ); self.obj_cancel_reason = "Bad path/new goal";
continue; self notify( "revive_cancel" );
return;
} }
if ( !isDefined( player_to_revive.revivetrigger ) ) if ( !isDefined( player_to_revive.revivetrigger ) )
{ {
continue; self.obj_cancel_reason = "No revive trigger";
self notify( "revive_cancel" );
return;
} }
//Check if the bot is reviving the player already and also that the player isn't being revived already //Check if the bot is reviving the player already and also that the player isn't being revived already
if ( player_to_revive.revivetrigger.beingrevived ) if ( player_to_revive.revivetrigger.beingrevived )
{ {
continue; self.obj_cancel_reason = "Player is already being revived";
self notify( "revive_cancel" );
return;
} }
self SetScriptAimPos( player_to_revive.origin ); self SetScriptAimPos( player_to_revive.origin );
@ -241,20 +220,22 @@ bot_revive_player()
} }
self thread BotPressUse( time ); self thread BotPressUse( time );
while ( self maps\_laststand::is_reviving( player_to_revive ) ) self thread knocked_off_revive_watcher();
}
knocked_off_revive_watcher( revivee )
{
while ( self maps\_laststand::is_reviving( revivee ) )
{ {
wait 0.05; wait 0.05;
} }
//Wait to see if we cleared the objective by successfully reviving the player if ( isDefined( revivee.revivetrigger ) )
waittillframeend; {
self.obj_cancel_reason = "Knocked off revive";
self notify( "revive_cancel" );
} }
} }
bot_revive_process_order()
{
return 0;
}
bot_revive_player_init() bot_revive_player_init()
{ {
self.successfully_revived_player = false; self.successfully_revived_player = false;
@ -280,6 +261,11 @@ bot_should_revive_player()
for ( i = 0; i < downed_players_objs.size; i++ ) for ( i = 0; i < downed_players_objs.size; i++ )
{ {
obj = downed_players_objs[ obj_keys[ i ] ]; obj = downed_players_objs[ obj_keys[ i ] ];
player = obj.target_ent;
if ( player == self )
{
continue;
}
if ( isDefined( obj.owner ) ) if ( isDefined( obj.owner ) )
{ {
continue; continue;
@ -288,7 +274,7 @@ bot_should_revive_player()
{ {
continue; continue;
} }
if ( !isDefined( generatePath( self.origin, obj.target_ent.origin, self.team, level.bot_allowed_negotiation_links ) ) ) if ( self GetPathIsInaccessible( player.origin ) )
{ {
continue; continue;
} }
@ -320,14 +306,9 @@ bot_revive_player_should_cancel()
return goal_canceled; return goal_canceled;
} }
bot_revive_player_should_postpone()
{
return false;
}
bot_revive_player_priority() bot_revive_player_priority()
{ {
return 0; return 2;
} }
bot_magicbox_purchase() bot_magicbox_purchase()
@ -345,77 +326,75 @@ bot_magicbox_purchase()
magicbox = magicbox_obj.target_ent; magicbox = magicbox_obj.target_ent;
self bot_set_objective( "magicbox", magicbox ); self bot_set_objective( "magicbox", magicbox );
self bot_set_objective_owner( "magicbox", magicbox ); //self bot_set_objective_owner( "magicbox", magicbox );
self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> objective started", "bot_magicbox_purchase" ); self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> Attempting to purchase magicbox", "bot_magicbox_purchase" );
magicbox_obj.magicbox_weapon_spawn_time = undefined; magicbox_obj.magicbox_weapon_spawn_time = undefined;
magicbox_obj.magicbox_weapon_string = undefined;
while ( true ) lookat_org = magicbox.origin + ( 0, 0, 35 );
{ goal_org = magicbox.bot_use_node;
wait 1;
self ClearScriptAimPos(); self ClearScriptAimPos();
self SetPriorityObjective(); self SetScriptGoal( goal_org, 32 );
self SetScriptGoal( magicbox.bot_use_node, 32 );
result = self waittill_any_return( "goal", "bad_path", "new_goal" ); result = self waittill_any_return( "goal", "bad_path", "new_goal" );
if ( result != "goal" ) if ( result != "goal" )
{ {
self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> bad path", "bot_magicbox_purchase" ); self.obj_cancel_reason = "Bad path/new goal";
continue; self notify( "magicbox_cancel" );
return;
} }
self SetScriptAimPos( magicbox.origin ); self SetScriptAimPos( lookat_org );
wait randomFloatRange( 0.5, 1.5 );
self thread BotPressUse( 0.1 ); self thread BotPressUse( 0.2 );
wait 0.1; wait 0.75;
waittillframeend; waittillframeend;
//self ClearScriptAimPos();
//self ClearScriptGoal();
if ( !magicbox._box_open ) if ( !magicbox._box_open )
{ {
self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> magicbox didn't open", "bot_magicbox_purchase" ); self.obj_cancel_reason = "Failed to open";
continue; self notify( "magicbox_cancel" );
} return;
// self ClearScriptGoal();
// self ClearScriptAimPos();
// self ClearPriorityObjective();
break;
} }
while ( !isDefined( magicbox.weapon_spawn_org ) ) if ( !isDefined( magicbox.weapon_spawn_org ) )
{ {
wait 0.05; self.obj_cancel_reason = "No weapon spawn org";
self notify( "magicbox_cancel" );
return;
} }
magicbox.weapon_spawn_org waittill( "randomization_done" ); magicbox.weapon_spawn_org waittill( "randomization_done" );
self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> randomization_done", "bot_magicbox_purchase" );
magicbox_obj.magicbox_weapon_spawn_time = getTime(); magicbox_obj.magicbox_weapon_spawn_time = getTime();
magicbox_obj.magicbox_weapon_string = magicbox.weapon_string;
//Pickup logic if ( self bot_should_reject_magicbox_weapon( magicbox.weapon_string ) )
while ( true )
{ {
wait 1; self.obj_cancel_reason = "Rejected magicbox weapon: " + magicbox.weapon_string;
self notify( "magicbox_cancel" );
return;
}
self ClearScriptAimPos(); self ClearScriptAimPos();
self SetPriorityObjective(); self SetPriorityObjective();
self SetScriptGoal( magicbox.bot_use_node, 32 ); self SetScriptGoal( goal_org, 32 );
result = self waittill_any_return( "goal", "bad_path", "new_goal" ); result = self waittill_any_return( "goal", "bad_path", "new_goal" );
if ( result != "goal" ) if ( result != "goal" )
{ {
self bot_objective_print( "magicbox", magicbox_obj.id, "Bot <" + self.playername + "> bad path on pickup", "bot_magicbox_purchase" ); self.obj_cancel_reason = "Bad path/new goal on pickup";
continue; self notify( "magicbox_cancel" );
return;
} }
self SetScriptAimPos( magicbox.origin ); self SetScriptAimPos( lookat_org );
wait randomFloatRange( 0.5, 1.5 );
self thread BotPressUse( 0.1 ); self thread BotPressUse( 0.2 );
wait 0.1;
waittillframeend;
}
}
bot_magicbox_purchase_process_order()
{
return 0;
} }
bot_magicbox_purchase_init() bot_magicbox_purchase_init()
@ -456,12 +435,17 @@ bot_should_purchase_magicbox()
self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it has an owner", "bot_should_purchase_magicbox" ); self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it has an owner", "bot_should_purchase_magicbox" );
continue; continue;
} }
if ( isDefined( magicbox.chest_user ) )
{
self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it has a user", "bot_should_purchase_magicbox" );
continue;
}
if ( self.score < magicbox.zombie_cost ) if ( self.score < magicbox.zombie_cost )
{ {
self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it is unaffordable", "bot_should_purchase_magicbox" ); self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it is unaffordable", "bot_should_purchase_magicbox" );
continue; continue;
} }
if ( !isDefined( generatePath( self.origin, magicbox.bot_use_node, self.team, level.bot_allowed_negotiation_links ) ) ) if ( self GetPathIsInaccessible( magicbox.bot_use_node ) )
{ {
self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it cannot be pathed to", "bot_should_purchase_magicbox" ); self bot_objective_print( "magicbox", obj.id, "Bot <" + self.playername + "> not purchasing this magicbox box because it cannot be pathed to", "bot_should_purchase_magicbox" );
continue; continue;
@ -486,17 +470,14 @@ bot_magicbox_purchase_should_cancel()
obj = self bot_get_objective(); obj = self bot_get_objective();
goal_canceled = false; goal_canceled = false;
/*
if ( !self bot_is_objective_owner( "magicbox", obj.target_ent ) ) if ( !self bot_is_objective_owner( "magicbox", obj.target_ent ) )
{ {
self.obj_cancel_reason = "No longer the obj owner"; self.obj_cancel_reason = "No longer the obj owner";
goal_canceled = true; goal_canceled = true;
} }
else if ( isDefined( obj.magicbox_weapon_string ) && self bot_should_reject_magicbox_weapon( obj ) ) */
{ if ( isDefined( obj.magicbox_weapon_spawn_time ) && ( getTime() >= ( obj.magicbox_weapon_spawn_time + 12000 ) ) )
self.obj_cancel_reason = "Rejected magicbox weapon: " + obj.magicbox_weapon_string;
goal_canceled = true;
}
else if ( isDefined( obj.magicbox_weapon_spawn_time ) && ( getTime() >= ( obj.magicbox_weapon_spawn_time + 12000 ) ) )
{ {
self.obj_cancel_reason = "Weapon timed out"; self.obj_cancel_reason = "Weapon timed out";
goal_canceled = true; goal_canceled = true;
@ -504,11 +485,6 @@ bot_magicbox_purchase_should_cancel()
return goal_canceled; return goal_canceled;
} }
bot_magicbox_purchase_should_postpone()
{
return false;
}
bot_magicbox_purchase_priority() bot_magicbox_purchase_priority()
{ {
/* /*
@ -530,3 +506,126 @@ bot_magicbox_purchase_priority()
*/ */
return 0; return 0;
} }
bot_perk_purchase()
{
if ( !isDefined( self.available_perks ) || self.available_perks.size <= 0 )
{
return;
}
self endon( "disconnect" );
self endon( "perk_end_think" );
level endon( "end_game" );
perk_obj = self.available_perks[ 0 ];
perk_ent = perk_obj.target_ent;
self bot_set_objective( "perk", perk_ent );
self bot_objective_print( "perk", perk_obj.id, "Bot <" + self.playername + "> Attempting to purchase " + perk_ent.script_noteworthy, "bot_perk_purchase" );
lookat_org = perk_ent.origin + ( 0, 0, 35 );
goal_org = perk_ent.bot_use_node;
self SetPriorityObjective();
self ClearScriptAimPos();
self SetScriptGoal( goal_org, 32 );
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
if ( result != "goal" )
{
self.obj_cancel_reason = "Bad path/new goal";
self notify( "perk_cancel" );
return;
}
self SetScriptAimPos( lookat_org );
wait randomFloatRange( 0.5, 1.5 );
self thread BotPressUse( 0.2 );
}
bot_perk_purchase_init()
{
self.successfully_bought_perk = false;
}
bot_perk_purchase_post_think( state )
{
self bot_post_think_common( state );
self.successfully_bought_perk = false;
}
bot_should_purchase_perk()
{
perk_objs = get_all_objectives_for_group( "perk" );
if ( perk_objs.size <= 0 )
{
return false;
}
if ( isDefined( level.enable_magic ) && !level.enable_magic )
{
return false;
}
self.available_perks = [];
perk_objs_keys = getArrayKeys( perk_objs );
perk_objs_keys = array_randomize( perk_objs_keys );
for ( i = 0; i < perk_objs.size; i++ )
{
obj = perk_objs[ perk_objs_keys[ i ] ];
perk_ent = obj.target_ent;
perk = perk_ent.script_noteworthy;
if ( !level._custom_perks[ perk ].powered_on )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because its not powered on", "bot_should_purchase_perk" );
continue;
}
if ( self hasPerk( perk ) )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because we already have it", "bot_should_purchase_perk" );
continue;
}
if ( ( isDefined( self.is_drinking ) && self.is_drinking > 0 ) && self getCurrentWeapon() == level._custom_perks[ perk ].perk_bottle )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because we are already drinking the perk we want", "bot_should_purchase_perk" );
continue;
}
if ( self.score < level._custom_perks[ perk ].cost )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because we can't afford it", "bot_should_purchase_perk" );
continue;
}
if ( self GetPathIsInaccessible( perk_ent.bot_use_node ) )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because it cannot be pathed to", "bot_should_purchase_perk" );
continue;
}
self.available_perks[ self.available_perks.size ] = obj;
}
return self.available_perks.size > 0;
}
bot_check_complete_perk_purchase()
{
return self.successfully_bought_perk;
}
bot_perk_purchase_should_cancel()
{
obj = self bot_get_objective();
goal_canceled = false;
perk = obj.target_ent.script_noteworthy;
if ( self hasPerk( perk ) )
{
self bot_objective_print( "perk", obj.id, "Bot <" + self.playername + "> not purchasing " + perk + " because we already have it", "bot_should_purchase_perk" );
goal_canceled = true;
}
return goal_canceled;
}
bot_perk_purchase_priority()
{
return 1;
}

View File

@ -325,137 +325,67 @@ bot_objective_history_get_previous()
/**********Action Section**********/ /**********Action Section**********/
register_bot_action( group_name, action_name, action_func, action_process_order_func, init_func, post_think_func, should_do_func, check_if_complete_func, should_cancel_func, should_postpone_func, priority_func ) register_bot_action( action_name, action_func, init_func, post_think_func, should_do_func, check_if_complete_func, should_cancel_func, priority_func )
{ {
if ( !isDefined( level.zbots_actions ) ) if ( !isDefined( level.zbots_actions ) )
{ {
level.zbots_actions = []; level.zbots_actions = [];
} }
if ( !isDefined( level.zbots_actions[ group_name ] ) ) if ( !isDefined( level.zbots_actions[ action_name ] ) )
{ {
level.zbots_actions[ group_name ] = []; level.zbots_actions[ action_name ] = spawnStruct();
} }
if ( !isDefined( level.zbots_actions[ group_name ][ action_name ] ) ) level.zbots_actions[ action_name ].action = action_func;
{ level.zbots_actions[ action_name ].init_func = init_func;
level.zbots_actions[ group_name ][ action_name ] = spawnStruct(); level.zbots_actions[ action_name ].post_think_func = post_think_func;
} level.zbots_actions[ action_name ].should_do_func = should_do_func;
level.zbots_actions[ group_name ][ action_name ].action = action_func; level.zbots_actions[ action_name ].check_if_complete_func = check_if_complete_func;
level.zbots_actions[ group_name ][ action_name ].init_func = init_func; level.zbots_actions[ action_name ].should_cancel_func = should_cancel_func;
level.zbots_actions[ group_name ][ action_name ].post_think_func = post_think_func; level.zbots_actions[ action_name ].priority_func = priority_func;
level.zbots_actions[ group_name ][ action_name ].should_do_func = should_do_func;
level.zbots_actions[ group_name ][ action_name ].action_process_order_func = action_process_order_func;
level.zbots_actions[ group_name ][ action_name ].check_if_complete_func = check_if_complete_func;
level.zbots_actions[ group_name ][ action_name ].should_cancel_func = should_cancel_func;
level.zbots_actions[ group_name ][ action_name ].should_postpone_func = should_postpone_func;
level.zbots_actions[ group_name ][ action_name ].priority_func = priority_func;
} }
initialize_bot_actions_queue() bot_process_action()
{ {
self.action_queue = [];
group_keys = getArrayKeys( level.zbots_actions );
for ( i = 0; i < group_keys.size; i++ )
{
self.action_queue[ group_keys[ i ] ] = [];
action_keys = getArrayKeys( level.zbots_actions[ group_keys[ i ] ] );
for ( j = 0; j < action_keys.size; j++ )
{
self register_bot_objective_action_for_queue( group_keys[ i ], action_keys[ j ] );
}
}
}
register_bot_objective_action_for_queue( group_name, action_name )
{
if ( !isDefined( self.zbot_actions_in_queue ) )
{
self.zbot_actions_in_queue = [];
}
if ( !isDefined( self.zbot_actions_in_queue[ group_name ] ) )
{
self.zbot_actions_in_queue[ group_name ] = [];
}
if ( !isDefined( self.zbot_actions_in_queue[ group_name ][ action_name ] ) )
{
self.zbot_actions_in_queue[ group_name ][ action_name ] = spawnStruct();
}
self.zbot_actions_in_queue[ group_name ][ action_name ].postponed = false;
self.zbot_actions_in_queue[ group_name ][ action_name ].queued = false;
self.zbot_actions_in_queue[ group_name ][ action_name ].is_current = false;
}
process_next_queued_action( group_name )
{
if ( self.zbot_actions_in_queue[ group_name ][ self.action_queue[ group_name ][ 0 ].action_name ].is_current )
{
return;
}
self.action_queue[ group_name ] = self sort_array_by_priority_field( self.action_queue[ group_name ] );
action_name = self.action_queue[ group_name ][ 0 ].action_name;
self [[ level.zbots_actions[ group_name ][ action_name ].init_func ]]();
self thread [[ level.zbots_actions[ group_name ][ action_name ].action ]]();
self.zbot_actions_in_queue[ group_name ][ action_name ].is_current = true;
self thread wait_for_action_completion( group_name, action_name );
}
wait_for_action_completion( group_name, action_name )
{
self endon( "disconnect" );
self endon( "stop_action_think" ); self endon( "stop_action_think" );
level endon( "end_game" );
action_name = self.bot_action.action_name;
self [[ level.zbots_actions[ action_name ].init_func ]]();
self thread [[ level.zbots_actions[ action_name ].action ]]();
self.running_action = true;
self wait_for_action_completion( action_name );
}
wait_for_action_completion( action_name )
{
action_complete_name = action_name + "_complete"; action_complete_name = action_name + "_complete";
action_cancel_name = action_name + "_cancel"; action_cancel_name = action_name + "_cancel";
action_postpone_name = action_name + "_postpone"; action_postpone_name = action_name + "_postpone";
result = self waittill_any_return( action_complete_name, action_cancel_name, action_postpone_name ); result = self waittill_any_return( action_complete_name, action_cancel_name, action_postpone_name );
save_action = false;
end_state = undefined; end_state = undefined;
if ( ( result == action_complete_name ) ) if ( ( result == action_complete_name ) )
{ {
self.zbot_actions_in_queue[ group_name ][ action_name ].postponed = false;
self.zbot_actions_in_queue[ group_name ][ action_name ].queued = false;
end_state = "completed"; end_state = "completed";
} }
else if ( result == action_cancel_name ) else if ( result == action_cancel_name )
{ {
self.zbot_actions_in_queue[ group_name ][ action_name ].postponed = false;
self.zbot_actions_in_queue[ group_name ][ action_name ].queued = false;
end_state = "canceled"; end_state = "canceled";
} }
else if ( result == action_postpone_name ) else if ( result == action_postpone_name )
{ {
self.zbot_actions_in_queue[ group_name ][ action_name ].postponed = true;
save_action = true;
end_state = "postponed"; end_state = "postponed";
} }
self.zbot_actions_in_queue[ group_name ][ action_name ].is_current = false;
self notify( action_name + "_end_think" ); self notify( action_name + "_end_think" );
self [[ level.zbots_actions[ group_name ][ action_name ].post_think_func ]]( end_state ); self [[ level.zbots_actions[ action_name ].post_think_func ]]( end_state );
if ( save_action ) self.bot_action = undefined;
{
postponed_action = self.action_queue[ group_name ][ 0 ];
postponed_action.priority = self [[ level.zbots_actions[ group_name ][ action_name ].priority_func ]]();
self.action_queue[ group_name ] = array_insert( self.action_queue[ group_name ], postponed_action, 2 );
self.action_queue[ group_name ][ 0 ] = undefined;
}
else
{
self.action_queue[ group_name ][ 0 ] = undefined;
}
self.obj_history[ self.bot_obj_history_index ].end_time = getTime(); self.obj_history[ self.bot_obj_history_index ].end_time = getTime();
end_time = self.obj_history[ self.bot_obj_history_index ].end_time; end_time = self.obj_history[ self.bot_obj_history_index ].end_time;
@ -463,88 +393,52 @@ wait_for_action_completion( group_name, action_name )
self.obj_history[ self.bot_obj_history_index ].time_spent = end_time - start_time; self.obj_history[ self.bot_obj_history_index ].time_spent = end_time - start_time;
self.obj_history[ self.bot_obj_history_index ].bot_end_pos = self.origin; self.obj_history[ self.bot_obj_history_index ].bot_end_pos = self.origin;
self.bot_obj_history_index++; self.bot_obj_history_index++;
self.running_action = false;
} }
pick_actions_to_add_to_queue( group_name ) bot_pick_action()
{ {
action_keys = getArrayKeys( level.zbots_actions[ group_name ] ); action_keys = getArrayKeys( level.zbots_actions );
//TODO: Use process order funcs to determine the order of actions being added to the queue
//For now just randomize the order of the keys
/*
for ( i = 0; i < action_keys; i++ )
{
}
*/
//Reboot the action queue because the last member was deleted which deletes the array
if ( !isDefined( self.action_queue ) || !isDefined( self.action_queue[ group_name ] ) )
{
self.action_queue = [];
self.action_queue[ group_name ] = [];
}
if ( !isDefined( self.action_id ) )
{
self.action_id = 0;
}
possible_actions = NewHeap( ::HeapPriority );
for ( i = 0; i < action_keys.size; i++ ) for ( i = 0; i < action_keys.size; i++ )
{ {
if ( !self.zbot_actions_in_queue[ group_name ][ action_keys[ i ] ].queued && [[ level.zbots_actions[ group_name ][ action_keys[ i ] ].should_do_func ]]() ) if ( self [[ level.zbots_actions[ action_keys[ i ] ].should_do_func ]]() )
{ {
self.action_queue[ group_name ][ self.action_queue[ group_name ].size ] = spawnStruct(); possible_action = spawnStruct();
self.action_queue[ group_name ][ self.action_queue[ group_name ].size - 1 ].action_name = action_keys[ i ]; possible_action.action_name = action_keys[ i ];
self.action_queue[ group_name ][ self.action_queue[ group_name ].size - 1 ].action_id = self.action_id; possible_action.priority = self [[ level.zbots_actions[ action_keys[ i ] ].priority_func ]]();
self.action_queue[ group_name ][ self.action_queue[ group_name ].size - 1 ].priority = self [[ level.zbots_actions[ group_name ][ action_keys[ i ] ].priority_func ]](); possible_actions HeapInsert( possible_action );
self.zbot_actions_in_queue[ group_name ][ action_keys[ i ] ].queued = true; printConsole( "Adding action " + action_keys[ i ] + " to queue of size: " + possible_actions.data.size );
self.action_id++;
} }
} }
if ( !isDefined( possible_actions.data ) || possible_actions.data.size <= 0 )
{
return false;
}
self.bot_action = possible_actions.data[ 0 ];
printConsole( "Picking action " + self.bot_action.action_name + " Priority " + self.bot_action.priority );
return true;
} }
bot_clear_actions_queue() bot_check_action_complete( action_name )
{ {
group_keys = getArrayKeys( level.zbots_actions ); assert( isDefined( level.zbots_actions[ action_name ].check_if_complete_func ) );
for ( i = 0; i < group_keys.size; i++ )
{
self.action_queue[ group_keys[ i ] ] = [];
action_keys = getArrayKeys( level.zbots_actions[ group_keys[ i ] ] );
for ( j = 0; j < action_keys.size; j++ )
{
self register_bot_objective_action_for_queue( group_keys[ i ], action_keys[ j ] );
}
}
}
check_if_action_is_completed_in_group( group_name, action_name ) is_complete = self [[ level.zbots_actions[ action_name ].check_if_complete_func ]]();
{
assert( isDefined( level.zbots_actions[ group_name ][ action_name ].check_if_complete_func ) );
is_complete = self [[ level.zbots_actions[ group_name ][ action_name ].check_if_complete_func ]]();
if ( is_complete ) if ( is_complete )
{ {
self notify( action_name + "_complete" ); self notify( action_name + "_complete" );
self notify( "goal" );
} }
return is_complete; return is_complete;
} }
check_if_action_should_be_postponed_in_group( group_name, action_name ) bot_check_if_action_should_be_canceled_in_group( action_name )
{ {
should_postpone = self [[ level.zbots_actions[ group_name ][ action_name ].should_postpone_func ]](); should_cancel = self [[ level.zbots_actions[ action_name ].should_cancel_func ]]();
if ( should_postpone )
{
self notify( action_name + "_postpone" );
self notify( "goal" );
}
return should_postpone;
}
check_if_action_should_be_canceled_in_group( group_name, action_name )
{
should_cancel = self [[ level.zbots_actions[ group_name ][ action_name ].should_cancel_func ]]();
if ( should_cancel ) if ( should_cancel )
{ {
self notify( action_name + "_cancel" ); self notify( action_name + "_cancel" );
@ -554,20 +448,9 @@ check_if_action_should_be_canceled_in_group( group_name, action_name )
return should_cancel; return should_cancel;
} }
check_if_action_should_be_postponed_globally( group_name, action_name ) bot_check_if_action_should_be_canceled_globally( action_name )
{ {
should_postpone = self action_should_be_postponed_global( group_name, action_name ); should_cancel = self action_should_be_canceled_global( action_name );
if ( should_postpone )
{
self notify( action_name + "_postpone" );
self notify( "goal" );
}
return should_postpone;
}
check_if_action_should_be_canceled_globally( group_name, action_name )
{
should_cancel = self action_should_be_canceled_global( group_name, action_name );
if ( should_cancel ) if ( should_cancel )
{ {
self notify( action_name + "_cancel" ); self notify( action_name + "_cancel" );
@ -576,30 +459,13 @@ check_if_action_should_be_canceled_globally( group_name, action_name )
return should_cancel; return should_cancel;
} }
//TODO: Figure out way of overriding the current action for flee movement action
check_for_forced_action( group_name )
{
action_keys = getArrayKeys( level.zbots_actions[ group_name ] );
action_priorities_array = [];
for ( i = 0; i < action_keys.size; i++ )
{
action_priorities_array[ action_priorities_array.size ] = spawnStruct();
action_priorities_array[ action_priorities_array.size - 1 ].priority = self [[ level.zbots_actions[ group_name ][ action_keys[ i ] ].priority_func ]]();
action_priorities_array[ action_priorities_array.size - 1 ].action_name = action_keys[ i ];
}
action_priorities_array = sort_array_by_priority_field( action_priorities_array );
if ( self.action_queue[ group_name ][ 0 ].priority < action_priorities_array[ 0 ].priority )
{
self notify( self.action_queue[ group_name ][ 0 ].action_name + "_cancel" );
}
}
bot_action_think() bot_action_think()
{ {
self endon( "disconnect" ); self endon( "disconnect" );
self endon( "zombified" ); self endon( "zombified" );
level endon( "end_game" );
self thread bot_action_pump();
while ( true ) while ( true )
{ {
@ -609,65 +475,65 @@ bot_action_think()
} }
else else
{ {
wait 0.05; wait 1;
} }
//Wait until the end of the frame so any variables set by _bot_internal in the current frame will have up to date values //Wait until the end of the frame so any variables set by _bot_internal in the current frame will have up to date values
waittillframeend; waittillframeend;
if ( !maps\so\zm_common\_zm_utility::is_player_valid( self ) ) self.bot_action = undefined;
if ( !self bot_pick_action() )
{ {
if ( getDvarInt( "bot_obj_debug_all" ) != 0 )
{
printConsole( "BOT_ACTION_THINK: " + self.playername + " does not have an action selected" );
}
continue; continue;
} }
group_name = "objective"; self bot_process_action();
self pick_actions_to_add_to_queue( group_name ); while ( !maps\so\zm_common\_zm_utility::is_player_valid( self ) )
//self check_for_forced_action( group_name );
if ( !isDefined( self.action_queue[ group_name ][ 0 ] ) )
{ {
continue; if ( getDvarInt( "bot_obj_debug_all" ) != 0 )
{
printConsole( "BOT_ACTION_THINK: " + self.playername + " is not in a valid state" );
} }
wait 1;
self process_next_queued_action( group_name );
action_name = self.action_queue[ group_name ][ 0 ].action_name;
if ( self check_if_action_is_completed_in_group( group_name, action_name ) )
{
wait 0.1;
continue;
}
if ( self check_if_action_should_be_postponed_globally( group_name, action_name ) )
{
wait 0.1;
continue;
}
if ( self check_if_action_should_be_canceled_globally( group_name, action_name ) )
{
wait 0.1;
continue;
}
if ( self check_if_action_should_be_postponed_in_group( group_name, action_name ) )
{
wait 0.1;
continue;
}
if ( self check_if_action_should_be_canceled_in_group( group_name, action_name ) )
{
wait 0.1;
continue;
} }
} }
} }
action_should_be_postponed_global( primary_group_name, action_name ) bot_action_pump()
{
self endon( "disconnect" );
self endon( "zombified" );
level endon( "end_game" );
while ( true )
{
wait 0.05;
if ( !isDefined( self.bot_action ) )
{
continue;
}
action_name = self.bot_action.action_name;
self bot_check_action_complete( action_name );
self bot_check_if_action_should_be_canceled_globally( action_name );
self bot_check_if_action_should_be_canceled_in_group( action_name );
while ( !maps\so\zm_common\_zm_utility::is_player_valid( self ) )
{
wait 1;
}
}
}
action_should_be_postponed_global( action_name )
{ {
return false; return false;
} }
action_should_be_canceled_global( primary_group_name, action_name ) action_should_be_canceled_global( action_name )
{ {
obj = self bot_get_objective(); obj = self bot_get_objective();

View File

@ -9,36 +9,42 @@ init()
{ {
//maps\bots\script_objectives\_obj_common; //maps\bots\script_objectives\_obj_common;
//maps\bots\script_objectives\_obj_actions; //maps\bots\script_objectives\_obj_actions;
register_bot_action( "objective", "powerup", ::bot_grab_powerup, register_bot_action( "powerup",
::bot_powerup_process_order, ::bot_grab_powerup,
::bot_powerup_init, ::bot_powerup_init,
::bot_powerup_post_think, ::bot_powerup_post_think,
::bot_should_grab_powerup, ::bot_should_grab_powerup,
::bot_check_complete_grab_powerup, ::bot_check_complete_grab_powerup,
::bot_powerup_should_cancel, ::bot_powerup_should_cancel,
::bot_powerup_should_postpone,
::bot_powerup_priority ); ::bot_powerup_priority );
register_bot_action( "objective", "revive", ::bot_revive_player, register_bot_action( "revive",
::bot_revive_process_order, ::bot_revive_player,
::bot_revive_player_init, ::bot_revive_player_init,
::bot_revive_player_post_think, ::bot_revive_player_post_think,
::bot_should_revive_player, ::bot_should_revive_player,
::bot_check_complete_revive_player, ::bot_check_complete_revive_player,
::bot_revive_player_should_cancel, ::bot_revive_player_should_cancel,
::bot_revive_player_should_postpone,
::bot_revive_player_priority ); ::bot_revive_player_priority );
register_bot_action( "objective", "magicbox", ::bot_magicbox_purchase, register_bot_action( "magicbox",
::bot_magicbox_purchase_process_order, ::bot_magicbox_purchase,
::bot_magicbox_purchase_init, ::bot_magicbox_purchase_init,
::bot_magicbox_purchase_post_think, ::bot_magicbox_purchase_post_think,
::bot_should_purchase_magicbox, ::bot_should_purchase_magicbox,
::bot_check_complete_purchase_magicbox, ::bot_check_complete_purchase_magicbox,
::bot_magicbox_purchase_should_cancel, ::bot_magicbox_purchase_should_cancel,
::bot_magicbox_purchase_should_postpone,
::bot_magicbox_purchase_priority ); ::bot_magicbox_purchase_priority );
register_bot_action( "perk",
::bot_perk_purchase,
::bot_perk_purchase_init,
::bot_perk_purchase_post_think,
::bot_should_purchase_perk,
::bot_check_complete_perk_purchase,
::bot_perk_purchase_should_cancel,
::bot_perk_purchase_priority );
register_bot_objective( "magicbox" ); register_bot_objective( "magicbox" );
register_bot_objective( "wallbuy" ); register_bot_objective( "wallbuy" );
register_bot_objective( "wallbuyammo" ); register_bot_objective( "wallbuyammo" );
@ -60,13 +66,11 @@ connected()
{ {
self endon( "disconnect" ); self endon( "disconnect" );
self thread initialize_bot_actions_queue();
self.on_powerup_grab_func = ::bot_on_powerup_grab; self.on_powerup_grab_func = ::bot_on_powerup_grab;
self.on_revive_success_func = ::bot_on_revive_success; self.on_revive_success_func = ::bot_on_revive_success;
self.on_magicbox_weapon_grab_func = ::bot_on_magicbox_weapon_grab; self.on_magicbox_weapon_grab_func = ::bot_on_magicbox_weapon_grab;
self.on_perk_purchase_func = ::bot_on_perk_purchase;
self.obj_postponed_reason = "";
self.obj_cancel_reason = ""; self.obj_cancel_reason = "";
self.obj_history = []; self.obj_history = [];

View File

@ -5,6 +5,22 @@
create_static_objectives() create_static_objectives()
{ {
if ( getDvar( "magicbox_node_forward_size" ) == "" )
{
setDvar( "magicbox_node_forward_size", 55 );
}
if ( getDvar( "magicbox_node_vertical_offset" ) == "" )
{
setDvar( "magicbox_node_vertical_offset", 10 );
}
if ( getDvar( "perk_node_forward_size" ) == "" )
{
setDvar( "perk_node_forward_size", 55 );
}
if ( getDvar( "perk_node_vertical_offset" ) == "" )
{
setDvar( "perk_node_vertical_offset", 1 );
}
weapon_spawns = GetEntArray( "weapon_upgrade", "targetname" ); weapon_spawns = GetEntArray( "weapon_upgrade", "targetname" );
if ( isDefined( weapon_spawns ) && weapon_spawns.size > 0 ) if ( isDefined( weapon_spawns ) && weapon_spawns.size > 0 )
@ -23,6 +39,9 @@ create_static_objectives()
for ( i = 0; i < vending_triggers.size; i++ ) for ( i = 0; i < vending_triggers.size; i++ )
{ {
obj = add_possible_bot_objective( "perk", vending_triggers[ i ], false ); obj = add_possible_bot_objective( "perk", vending_triggers[ i ], false );
model = getEnt( vending_triggers[ i ].target, "targetname" );
vending_triggers[ i ].bot_use_node = get_angle_offset_node( model, ( 0, 0, 0 ), getDvar( "perk_node_forward_size" ), ( 0, 0, getDvar( "perk_node_vertical_offset" ) ) );
vending_triggers[ i ] thread perk_debug();
} }
} }
@ -163,7 +182,7 @@ watch_magicbox_objectives()
cur_magicbox = maps\so\zm_common\_zm_magicbox::get_active_magicbox(); cur_magicbox = maps\so\zm_common\_zm_magicbox::get_active_magicbox();
add_possible_bot_objective( "magicbox", cur_magicbox, true ); add_possible_bot_objective( "magicbox", cur_magicbox, true );
cur_magicbox.bot_use_node = get_angle_offset_node( cur_magicbox maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), 40, ( 0, 0, 1 ) ); cur_magicbox.bot_use_node = get_angle_offset_node( cur_magicbox maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), getDvarInt( "magicbox_node_forward_size" ), ( 0, 0, getDvarInt( "magicbox_node_vertical_offset" ) ) );
cur_magicbox thread magicbox_debug(); cur_magicbox thread magicbox_debug();
@ -174,7 +193,7 @@ watch_magicbox_objectives()
free_bot_objective( "magicbox", old_magicbox ); free_bot_objective( "magicbox", old_magicbox );
level waittill( "new_magicbox", new_magicbox ); level waittill( "new_magicbox", new_magicbox );
add_possible_bot_objective( "magicbox", new_magicbox, true ); add_possible_bot_objective( "magicbox", new_magicbox, true );
new_magicbox.bot_use_node = get_angle_offset_node( new_magicbox maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), 40, ( 0, 0, 1 ) ); new_magicbox.bot_use_node = get_angle_offset_node( new_magicbox maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), getDvarInt( "magicbox_node_forward_size" ), ( 0, 0, getDvarInt( "magicbox_node_vertical_offset" ) ) );
new_magicbox thread magicbox_debug(); new_magicbox thread magicbox_debug();
} }
} }
@ -184,13 +203,28 @@ magicbox_debug()
self notify( "magicbox_debug" ); self notify( "magicbox_debug" );
self endon( "magicbox_debug"); self endon( "magicbox_debug");
level endon( "magicbox_teddy_bear" ); level endon( "magicbox_teddy_bear" );
if ( getDvarInt( "bot_obj_debug_all" ) == 0 && getDvarInt( "bot_obj_debug_perk" ) == 0 )
{
return;
}
while ( true )
{
node = get_angle_offset_node( self maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), getDvarInt( "magicbox_node_forward_size" ), ( 0, 0, getDvarInt( "magicbox_node_vertical_offset" ) ) );
self.bot_use_node = node;
line( self.origin, node, ( 1.0, 1.0, 1.0 ) );
wait 0.05;
}
}
perk_debug()
{
if ( getDvarInt( "bot_obj_debug_all" ) == 0 && getDvarInt( "bot_obj_debug_magicbox" ) == 0 ) if ( getDvarInt( "bot_obj_debug_all" ) == 0 && getDvarInt( "bot_obj_debug_magicbox" ) == 0 )
{ {
return; return;
} }
while ( true ) while ( true )
{ {
node = get_angle_offset_node( self maps\so\zm_common\_zm_magicbox::get_chest_pieces()[ 1 ], ( 0, 90, 0 ), getDvarInt( "magicbox_node_forward_size" ), ( 0, 0, 1 ) ); node = get_angle_offset_node( self, ( 0, getDvarInt( "perk_node_angle" ), 0 ), getDvarInt( "perk_node_forward_size" ), ( 0, 0, getDvarInt( "perk_node_vertical_offset" ) ) );
self.bot_use_node = node; self.bot_use_node = node;
line( self.origin, node, ( 1.0, 1.0, 1.0 ) ); line( self.origin, node, ( 1.0, 1.0, 1.0 ) );
wait 0.05; wait 0.05;
@ -214,3 +248,9 @@ bot_on_magicbox_weapon_grab( magicbox, weapon )
self bot_objective_print( "magicbox", magicbox getEntityNumber(), "bot_on_magicbox_weapon_grab", "Bot <" + self.playername + "> grabbed <" + weapon + "> from the box" ); self bot_objective_print( "magicbox", magicbox getEntityNumber(), "bot_on_magicbox_weapon_grab", "Bot <" + self.playername + "> grabbed <" + weapon + "> from the box" );
self.successfully_grabbed_magicbox_weapon = true; self.successfully_grabbed_magicbox_weapon = true;
} }
bot_on_perk_purchase( trigger, perk )
{
self bot_objective_print( "perk", trigger getEntityNumber(), "bot_on_perk_purchase", "Bot <" + self.playername + "> purchased <" + perk + ">" );
self.successfully_bought_perk = true;
}

View File

@ -38,31 +38,24 @@ setupcallbacks()
killtestoverrideactordamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset ) killtestoverrideactordamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset )
{ {
if ( isDefined( eAttacker ) && isPlayer( eAttacker ) )
{
if ( sWeapon == "zombie_doublebarrel" )
iDamage = 1;
}
setDvar( "aa_player_damage_dealt", 0 ); setDvar( "aa_player_damage_dealt", 0 );
if ( sMeansOfDeath == "MOD_MELEE" ) if ( isPlayer( eAttacker ) && eAttacker isBot() && getDvarInt( "bots_t8_mode" ) )
iDamage = 100000000; {
iDamage += int( self.maxhealth * randomFloatRange( 0.25, 1.25 ) );
}
self [[level.killtestoldoverrideactordamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset ); self [[level.killtestoldoverrideactordamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, iModelIndex, iTimeOffset );
} }
killtestoverrideplayerdamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime ) killtestoverrideplayerdamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime )
{ {
if ( self isBot() ) if ( self isBot() && getDvarInt( "bots_t8_mode" ) )
{ {
if ( isDefined( eAttacker ) && eAttacker == self ) iDamage = int( iDamage * 0.1 );
return;
iDamage = 5;
} }
PrintConsole( self GetPlayerName() + " took " + iDamage ); //PrintConsole( self GetPlayerName() + " took " + iDamage );
self [[level.killtestoldoverrideplayerdamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime ); self [[level.killtestoldoverrideplayerdamage]]( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, modelIndex, psOffsetTime );
} }