mirror of
https://github.com/JezuzLizard/t4sp_bot_warfare.git
synced 2025-04-23 15:05:43 +00:00
Add untested code for every remaining objective(except trap).
This commit is contained in:
parent
8343d597c7
commit
81094096cb
@ -23,6 +23,13 @@ bot_post_think_common( state )
|
||||
self bot_clear_objective();
|
||||
}
|
||||
|
||||
bot_obj_timeout( objective_group, time )
|
||||
{
|
||||
wait time;
|
||||
self.obj_cancel_reason = "Obj timeout";
|
||||
self notify( objective_group + "_cancel" );
|
||||
}
|
||||
|
||||
bot_grab_powerup()
|
||||
{
|
||||
self endon( "disconnect" );
|
||||
@ -218,6 +225,7 @@ bot_revive_player()
|
||||
{
|
||||
time /= 2;
|
||||
}
|
||||
self thread bot_obj_timeout( "revive", time + 1 );
|
||||
self thread BotPressUse( time );
|
||||
|
||||
self thread knocked_off_revive_watcher();
|
||||
@ -392,6 +400,7 @@ bot_magicbox_purchase()
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "magicbox", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
@ -477,7 +486,10 @@ bot_magicbox_purchase_should_cancel()
|
||||
goal_canceled = true;
|
||||
}
|
||||
*/
|
||||
if ( isDefined( obj.magicbox_weapon_spawn_time ) && ( getTime() >= ( obj.magicbox_weapon_spawn_time + 12000 ) ) )
|
||||
if ( isDefined( obj.magicbox_weapon_spawn_time )
|
||||
&& isDefined( obj.target_ent.chest_user )
|
||||
&& obj.target_ent.chest_user == self
|
||||
&& ( getTime() >= ( obj.magicbox_weapon_spawn_time + 12000 ) ) )
|
||||
{
|
||||
self.obj_cancel_reason = "Weapon timed out";
|
||||
goal_canceled = true;
|
||||
@ -527,7 +539,6 @@ 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 );
|
||||
|
||||
@ -541,6 +552,7 @@ bot_perk_purchase()
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "perk", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
@ -629,3 +641,522 @@ bot_perk_purchase_priority()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bot_door_purchase()
|
||||
{
|
||||
if ( !isDefined( self.available_doors ) || self.available_doors.size <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self endon( "disconnect" );
|
||||
self endon( "door_end_think" );
|
||||
level endon( "end_game" );
|
||||
|
||||
door_obj = self.available_doors[ 0 ];
|
||||
|
||||
door_ent = door_obj.target_ent;
|
||||
self bot_set_objective( "door", door_ent );
|
||||
self bot_objective_print( "door", door_obj.id, "Bot <" + self.playername + "> Attempting to purchase " + door_ent.target, "bot_door_purchase" );
|
||||
|
||||
lookat_org = door_ent.origin + ( 0, 0, 35 );
|
||||
goal_org = door_ent.origin;
|
||||
|
||||
self ClearScriptAimPos();
|
||||
self SetScriptGoal( goal_org, 48 );
|
||||
|
||||
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
|
||||
|
||||
if ( result != "goal" )
|
||||
{
|
||||
self.obj_cancel_reason = "Bad path/new goal";
|
||||
self notify( "door_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "door", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
}
|
||||
|
||||
bot_door_purchase_init()
|
||||
{
|
||||
self.successfully_bought_door = false;
|
||||
}
|
||||
|
||||
bot_door_purchase_post_think( state )
|
||||
{
|
||||
self bot_post_think_common( state );
|
||||
self.successfully_bought_door = false;
|
||||
}
|
||||
|
||||
bot_should_purchase_door()
|
||||
{
|
||||
door_objs = get_all_objectives_for_group( "door" );
|
||||
if ( door_objs.size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.available_doors = [];
|
||||
door_objs_keys = getArrayKeys( door_objs );
|
||||
for ( i = 0; i < door_objs.size; i++ )
|
||||
{
|
||||
obj = door_objs[ door_objs_keys[ i ] ];
|
||||
door_ent = obj.target_ent;
|
||||
is_electric_door = isDefined( door_ent.script_noteworthy ) && door_ent.script_noteworthy == "electric_door";
|
||||
if ( is_electric_door )
|
||||
{
|
||||
self bot_objective_print( "door", obj.id, "Bot <" + self.playername + "> not purchasing <" + door_ent.target + "> because it is electric", "bot_should_purchase_door" );
|
||||
continue;
|
||||
}
|
||||
if ( self.score < door_ent.zombie_cost )
|
||||
{
|
||||
self bot_objective_print( "door", obj.id, "Bot <" + self.playername + "> not purchasing <" + door_ent.target + "> because we can't afford it", "bot_should_purchase_door" );
|
||||
continue;
|
||||
}
|
||||
if ( self GetPathIsInaccessible( door_ent.origin ) )
|
||||
{
|
||||
self bot_objective_print( "door", obj.id, "Bot <" + self.playername + "> not purchasing <" + door_ent.target + "> because it cannot be pathed to", "bot_should_purchase_door" );
|
||||
continue;
|
||||
}
|
||||
self.available_doors[ self.available_doors.size ] = obj;
|
||||
}
|
||||
return self.available_doors.size > 0;
|
||||
}
|
||||
|
||||
bot_check_complete_door_purchase()
|
||||
{
|
||||
return self.successfully_bought_door;
|
||||
}
|
||||
|
||||
bot_door_purchase_should_cancel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bot_door_purchase_priority()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bot_debris_purchase()
|
||||
{
|
||||
if ( !isDefined( self.available_debris ) || self.available_debris.size <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self endon( "disconnect" );
|
||||
self endon( "debris_end_think" );
|
||||
level endon( "end_game" );
|
||||
|
||||
debris_obj = self.available_debris[ 0 ];
|
||||
|
||||
debris_ent = debris_obj.target_ent;
|
||||
self bot_set_objective( "debris", debris_ent );
|
||||
self bot_objective_print( "debris", debris_obj.id, "Bot <" + self.playername + "> Attempting to purchase " + debris_ent.target, "bot_debris_purchase" );
|
||||
|
||||
lookat_org = debris_ent.origin + ( 0, 0, 35 );
|
||||
goal_org = debris_ent.origin;
|
||||
|
||||
self ClearScriptAimPos();
|
||||
self SetScriptGoal( goal_org, 48 );
|
||||
|
||||
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
|
||||
|
||||
if ( result != "goal" )
|
||||
{
|
||||
self.obj_cancel_reason = "Bad path/new goal";
|
||||
self notify( "door_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "debris", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
}
|
||||
|
||||
bot_debris_purchase_init()
|
||||
{
|
||||
self.successfully_bought_debris = false;
|
||||
}
|
||||
|
||||
bot_debris_purchase_post_think( state )
|
||||
{
|
||||
self bot_post_think_common( state );
|
||||
self.successfully_bought_debris = false;
|
||||
}
|
||||
|
||||
bot_should_purchase_debris()
|
||||
{
|
||||
debris_objs = get_all_objectives_for_group( "debris" );
|
||||
if ( debris_objs.size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.available_doors = [];
|
||||
debris_objs_keys = getArrayKeys( debris_objs );
|
||||
for ( i = 0; i < debris_objs.size; i++ )
|
||||
{
|
||||
obj = debris_objs[ debris_objs_keys[ i ] ];
|
||||
debris_ent = obj.target_ent;
|
||||
if ( self.score < debris_ent.zombie_cost )
|
||||
{
|
||||
self bot_objective_print( "debris", obj.id, "Bot <" + self.playername + "> not purchasing <" + debris_ent.target + "> because we can't afford it", "bot_should_purchase_debris" );
|
||||
continue;
|
||||
}
|
||||
if ( self GetPathIsInaccessible( debris_ent.origin ) )
|
||||
{
|
||||
self bot_objective_print( "debris", obj.id, "Bot <" + self.playername + "> not purchasing <" + debris_ent.target + "> because it cannot be pathed to", "bot_should_purchase_debris" );
|
||||
continue;
|
||||
}
|
||||
self.available_doors[ self.available_doors.size ] = obj;
|
||||
}
|
||||
return self.available_doors.size > 0;
|
||||
}
|
||||
|
||||
bot_check_complete_debris_purchase()
|
||||
{
|
||||
return self.successfully_bought_debris;
|
||||
}
|
||||
|
||||
bot_debris_purchase_should_cancel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bot_debris_purchase_priority()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bot_wallbuy_purchase()
|
||||
{
|
||||
if ( !isDefined( self.available_wallbuys ) || self.available_wallbuys.size <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self endon( "disconnect" );
|
||||
self endon( "wallbuy_end_think" );
|
||||
level endon( "end_game" );
|
||||
|
||||
wallbuy_obj = self.available_wallbuys[ 0 ];
|
||||
|
||||
wallbuy_ent = wallbuy_obj.target_ent;
|
||||
self bot_set_objective( "wallbuy", wallbuy_ent );
|
||||
self bot_objective_print( "wallbuy", wallbuy_obj.id, "Bot <" + self.playername + "> Attempting to purchase " + wallbuy_ent.zombie_weapon_upgrade, "bot_wallbuy_purchase" );
|
||||
|
||||
lookat_org = wallbuy_ent.origin;
|
||||
goal_org = wallbuy_ent.bot_use_node;
|
||||
|
||||
self ClearScriptAimPos();
|
||||
self SetScriptGoal( goal_org, 24 );
|
||||
|
||||
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
|
||||
|
||||
if ( result != "goal" )
|
||||
{
|
||||
self.obj_cancel_reason = "Bad path/new goal";
|
||||
self notify( "wallbuy_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "wallbuy", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
}
|
||||
|
||||
bot_wallbuy_purchase_init()
|
||||
{
|
||||
self.successfully_bought_wallbuy = false;
|
||||
}
|
||||
|
||||
bot_wallbuy_purchase_post_think( state )
|
||||
{
|
||||
self bot_post_think_common( state );
|
||||
self.successfully_bought_wallbuy = false;
|
||||
}
|
||||
|
||||
bot_should_purchase_wallbuy()
|
||||
{
|
||||
wallbuy_objs = get_all_objectives_for_group( "wallbuy" );
|
||||
if ( wallbuy_objs.size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.available_wallbuys = [];
|
||||
wallbuy_objs_keys = getArrayKeys( wallbuy_objs );
|
||||
wallbuy_objs_keys = array_randomize( wallbuy_objs_keys );
|
||||
for ( i = 0; i < wallbuy_objs.size; i++ )
|
||||
{
|
||||
obj = wallbuy_objs[ wallbuy_objs_keys[ i ] ];
|
||||
wallbuy_ent = obj.target_ent;
|
||||
weapon = wallbuy_ent.zombie_weapon_upgrade;
|
||||
if ( self.score < maps\so\zm_common\_zm_weapons::get_weapon_cost( weapon ) )
|
||||
{
|
||||
self bot_objective_print( "wallbuy", obj.id, "Bot <" + self.playername + "> not purchasing <" + weapon + "> because we can't afford it", "bot_should_purchase_wallbuy" );
|
||||
continue;
|
||||
}
|
||||
if ( self GetPathIsInaccessible( wallbuy_ent.bot_use_node ) )
|
||||
{
|
||||
self bot_objective_print( "wallbuy", obj.id, "Bot <" + self.playername + "> not purchasing <" + weapon + "> because it cannot be pathed to", "bot_should_purchase_wallbuy" );
|
||||
continue;
|
||||
}
|
||||
self.available_wallbuys[ self.available_wallbuys.size ] = obj;
|
||||
}
|
||||
return self.available_wallbuys.size > 0;
|
||||
}
|
||||
|
||||
bot_check_complete_wallbuy_purchase()
|
||||
{
|
||||
return self.successfully_bought_wallbuy;
|
||||
}
|
||||
|
||||
bot_wallbuy_purchase_should_cancel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bot_wallbuy_purchase_priority()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bot_wallbuy_ammo_purchase()
|
||||
{
|
||||
if ( !isDefined( self.available_wallbuyammos ) || self.available_wallbuyammos.size <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self endon( "disconnect" );
|
||||
self endon( "wallbuyammo_end_think" );
|
||||
level endon( "end_game" );
|
||||
|
||||
wallbuy_obj = self.available_wallbuyammos[ 0 ];
|
||||
|
||||
wallbuy_ent = wallbuy_obj.target_ent;
|
||||
self bot_set_objective( "wallbuyammo", wallbuy_ent );
|
||||
self bot_objective_print( "wallbuyammo", wallbuy_obj.id, "Bot <" + self.playername + "> Attempting to purchase " + wallbuy_ent.zombie_weapon_upgrade, "bot_wallbuy_ammo_purchase" );
|
||||
|
||||
lookat_org = wallbuy_ent.origin;
|
||||
goal_org = wallbuy_ent.bot_use_node;
|
||||
|
||||
self ClearScriptAimPos();
|
||||
self SetScriptGoal( goal_org, 24 );
|
||||
|
||||
result = self waittill_any_return( "goal", "bad_path", "new_goal" );
|
||||
|
||||
if ( result != "goal" )
|
||||
{
|
||||
self.obj_cancel_reason = "Bad path/new goal";
|
||||
self notify( "wallbuy_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "wallbuyammo", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
}
|
||||
|
||||
bot_wallbuy_ammo_purchase_init()
|
||||
{
|
||||
self.successfully_bought_wallbuy_ammo = false;
|
||||
}
|
||||
|
||||
bot_wallbuy_ammo_purchase_post_think( state )
|
||||
{
|
||||
self bot_post_think_common( state );
|
||||
self.successfully_bought_wallbuy_ammo = false;
|
||||
}
|
||||
|
||||
bot_should_purchase_wallbuy_ammo()
|
||||
{
|
||||
wallbuy_objs = get_all_objectives_for_group( "wallbuyammo" );
|
||||
if ( wallbuy_objs.size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.available_wallbuyammos = [];
|
||||
wallbuy_objs_keys = getArrayKeys( wallbuy_objs );
|
||||
wallbuy_objs_keys = array_randomize( wallbuy_objs_keys );
|
||||
for ( i = 0; i < wallbuy_objs.size; i++ )
|
||||
{
|
||||
obj = wallbuy_objs[ wallbuy_objs_keys[ i ] ];
|
||||
wallbuy_ent = obj.target_ent;
|
||||
weapon = wallbuy_ent.zombie_weapon_upgrade;
|
||||
if ( !self hasWeapon( weapon ) )
|
||||
{
|
||||
self bot_objective_print( "wallbuyammo", obj.id, "Bot <" + self.playername + "> not purchasing ammo for <" + weapon + "> because we don't have the weapon in our inventory", "bot_should_purchase_wallbuy_ammo" );
|
||||
continue;
|
||||
}
|
||||
if ( self.score < maps\so\zm_common\_zm_weapons::get_ammo_cost( weapon ) )
|
||||
{
|
||||
self bot_objective_print( "wallbuyammo", obj.id, "Bot <" + self.playername + "> not purchasing ammo for <" + weapon + "> because we can't afford it", "bot_should_purchase_wallbuy_ammo" );
|
||||
continue;
|
||||
}
|
||||
if ( self GetPathIsInaccessible( wallbuy_ent.bot_use_node ) )
|
||||
{
|
||||
self bot_objective_print( "wallbuyammo", obj.id, "Bot <" + self.playername + "> not purchasing ammo for <" + weapon + "> because it cannot be pathed to", "bot_should_purchase_wallbuy_ammo" );
|
||||
continue;
|
||||
}
|
||||
self.available_wallbuyammos[ self.available_wallbuyammos.size ] = obj;
|
||||
}
|
||||
return self.available_wallbuyammos.size > 0;
|
||||
}
|
||||
|
||||
bot_check_complete_wallbuy_ammo_purchase()
|
||||
{
|
||||
return self.successfully_bought_wallbuy_ammo;
|
||||
}
|
||||
|
||||
bot_wallbuy_ammo_purchase_should_cancel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bot_wallbuy_ammo_purchase_priority()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bot_packapunch_purchase()
|
||||
{
|
||||
if ( !isDefined( self.available_packapunchs ) || self.available_packapunchs.size <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self endon( "disconnect" );
|
||||
self endon( "packapunch_end_think" );
|
||||
level endon( "end_game" );
|
||||
|
||||
packapunch_obj = self.available_packapunchs[ 0 ];
|
||||
|
||||
packapunch = packapunch_obj.target_ent;
|
||||
self bot_set_objective( "packapunch", packapunch );
|
||||
//self bot_set_objective_owner( "magicbox", magicbox );
|
||||
self bot_objective_print( "packapunch", packapunch_obj.id, "Bot <" + self.playername + "> Attempting to purchase packapunch", "bot_packapunch_purchase" );
|
||||
|
||||
lookat_org = packapunch.origin + ( 0, 0, 35 );
|
||||
goal_org = packapunch.bot_use_node;
|
||||
|
||||
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( "packapunch_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
wait 0.75;
|
||||
waittillframeend;
|
||||
//self ClearScriptAimPos();
|
||||
//self ClearScriptGoal();
|
||||
|
||||
packapunch waittill( "pap_pickup_ready" );
|
||||
self bot_objective_print( "packapunch", packapunch_obj.id, "Bot <" + self.playername + "> pap_pickup_ready", "bot_packapunch_purchase" );
|
||||
|
||||
self ClearScriptAimPos();
|
||||
self SetPriorityObjective();
|
||||
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 on pickup";
|
||||
self notify( "packapunch_cancel" );
|
||||
return;
|
||||
}
|
||||
|
||||
self SetScriptAimPos( lookat_org );
|
||||
self thread bot_obj_timeout( "packapunch", 2 );
|
||||
wait randomFloatRange( 0.5, 1.5 );
|
||||
|
||||
self thread BotPressUse( 0.2 );
|
||||
}
|
||||
|
||||
bot_packapunch_purchase_init()
|
||||
{
|
||||
self.successfully_bought_packapunch = false;
|
||||
}
|
||||
|
||||
bot_packapunch_purchase_post_think( state )
|
||||
{
|
||||
self bot_post_think_common( state );
|
||||
self.successfully_bought_packapunch = false;
|
||||
}
|
||||
|
||||
bot_should_purchase_packapunch()
|
||||
{
|
||||
packapunch_objs = get_all_objectives_for_group( "packapunch" );
|
||||
if ( packapunch_objs.size <= 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.available_packapunchs = [];
|
||||
packapunch_objs_keys = getArrayKeys( packapunch_objs );
|
||||
packapunch_objs_keys = array_randomize( packapunch_objs_keys );
|
||||
for ( i = 0; i < packapunch_objs.size; i++ )
|
||||
{
|
||||
obj = packapunch_objs[ packapunch_objs_keys[ i ] ];
|
||||
packapunch_ent = obj.target_ent;
|
||||
if ( self.score < level._custom_packapunch.cost )
|
||||
{
|
||||
self bot_objective_print( "packapunch", obj.id, "Bot <" + self.playername + "> not purchasing packapunch because we can't afford it", "bot_should_purchase_wallbuy_ammo" );
|
||||
continue;
|
||||
}
|
||||
if ( self GetPathIsInaccessible( wallbuy_ent.bot_use_node ) )
|
||||
{
|
||||
self bot_objective_print( "packapunch", obj.id, "Bot <" + self.playername + "> not purchasing packapunch because it cannot be pathed to", "bot_should_purchase_wallbuy_ammo" );
|
||||
continue;
|
||||
}
|
||||
self.available_packapunchs[ self.available_packapunchs.size ] = obj;
|
||||
}
|
||||
return self.available_packapunchs.size > 0;
|
||||
}
|
||||
|
||||
bot_check_complete_packapunch_purchase()
|
||||
{
|
||||
return self.successfully_bought_packapunch;
|
||||
}
|
||||
|
||||
bot_packapunch_purchase_should_cancel()
|
||||
{
|
||||
obj = self bot_get_objective();
|
||||
|
||||
goal_canceled = false;
|
||||
perk = obj.target_ent.script_noteworthy;
|
||||
if ( isDefined( obj.target_ent.packapunch_weapon_spawn_time )
|
||||
&& isDefined( obj.target_ent.packapunch_user )
|
||||
&& obj.target_ent.packapunch_user == self
|
||||
&& ( getTime() >= ( obj.target_ent_packapunch_weapon_spawn_time + ( level.packapunch_timeout * 1000 ) ) ) )
|
||||
{
|
||||
self.obj_cancel_reason = "Weapon timed out";
|
||||
goal_canceled = true;
|
||||
}
|
||||
return goal_canceled;
|
||||
}
|
||||
|
||||
bot_packapunch_purchase_priority()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -362,9 +362,8 @@ wait_for_action_completion( action_name )
|
||||
{
|
||||
action_complete_name = action_name + "_complete";
|
||||
action_cancel_name = action_name + "_cancel";
|
||||
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 );
|
||||
|
||||
end_state = undefined;
|
||||
|
||||
@ -376,10 +375,6 @@ wait_for_action_completion( action_name )
|
||||
{
|
||||
end_state = "canceled";
|
||||
}
|
||||
else if ( result == action_postpone_name )
|
||||
{
|
||||
end_state = "postponed";
|
||||
}
|
||||
|
||||
self notify( action_name + "_end_think" );
|
||||
|
||||
@ -409,7 +404,7 @@ bot_pick_action()
|
||||
possible_action.action_name = action_keys[ i ];
|
||||
possible_action.priority = self [[ level.zbots_actions[ action_keys[ i ] ].priority_func ]]();
|
||||
possible_actions HeapInsert( possible_action );
|
||||
printConsole( "Adding action " + action_keys[ i ] + " to queue of size: " + possible_actions.data.size );
|
||||
printConsole( self.playername + " Adding action " + action_keys[ i ] + " to queue of size: " + possible_actions.data.size );
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +413,7 @@ bot_pick_action()
|
||||
return false;
|
||||
}
|
||||
self.bot_action = possible_actions.data[ 0 ];
|
||||
printConsole( "Picking action " + self.bot_action.action_name + " Priority " + self.bot_action.priority );
|
||||
printConsole( self.playername + " Picking action " + self.bot_action.action_name + " Priority " + self.bot_action.priority );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -517,9 +512,15 @@ bot_action_pump()
|
||||
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 );
|
||||
if ( self bot_check_action_complete( action_name ) )
|
||||
{
|
||||
}
|
||||
else if ( self bot_check_if_action_should_be_canceled_globally( action_name ) )
|
||||
{
|
||||
}
|
||||
else if ( self bot_check_if_action_should_be_canceled_in_group( action_name ) )
|
||||
{
|
||||
}
|
||||
|
||||
while ( !maps\so\zm_common\_zm_utility::is_player_valid( self ) )
|
||||
{
|
||||
@ -548,6 +549,11 @@ action_should_be_canceled_global( action_name )
|
||||
self.obj_cancel_reason = "Obj entity doesn't exist";
|
||||
canceled_goal = true;
|
||||
}
|
||||
else if ( isDefined( obj.target_ent.player_visibility ) && !obj.target_ent.player_visibility[ self getEntityNumber() + "" ] )
|
||||
{
|
||||
self.obj_cancel_reason = "Trigger wasn't visible";
|
||||
goal_canceled = true;
|
||||
}
|
||||
else if ( !isDefined( obj.target_ent.bot_use_node ) && self GetPathIsInaccessible( obj.target_ent.origin ) )
|
||||
{
|
||||
self.obj_cancel_reason = "Path to ent was inaccessible";
|
||||
|
@ -45,6 +45,51 @@ init()
|
||||
::bot_perk_purchase_should_cancel,
|
||||
::bot_perk_purchase_priority );
|
||||
|
||||
register_bot_action( "door",
|
||||
::bot_door_purchase,
|
||||
::bot_door_purchase_init,
|
||||
::bot_door_purchase_post_think,
|
||||
::bot_should_purchase_door,
|
||||
::bot_check_complete_door_purchase,
|
||||
::bot_door_purchase_should_cancel,
|
||||
::bot_door_purchase_priority );
|
||||
|
||||
register_bot_action( "debris",
|
||||
::bot_debris_purchase,
|
||||
::bot_debris_purchase_init,
|
||||
::bot_debris_purchase_post_think,
|
||||
::bot_should_purchase_debris,
|
||||
::bot_check_complete_debris_purchase,
|
||||
::bot_debris_purchase_should_cancel,
|
||||
::bot_debris_purchase_priority );
|
||||
|
||||
register_bot_action( "wallbuy",
|
||||
::bot_wallbuy_purchase,
|
||||
::bot_wallbuy_purchase_init,
|
||||
::bot_wallbuy_purchase_post_think,
|
||||
::bot_should_purchase_wallbuy,
|
||||
::bot_check_complete_wallbuy_purchase,
|
||||
::bot_wallbuy_purchase_should_cancel,
|
||||
::bot_wallbuy_purchase_priority );
|
||||
|
||||
register_bot_action( "wallbuyammo",
|
||||
::bot_wallbuy_ammo_purchase,
|
||||
::bot_wallbuy_ammo_purchase_init,
|
||||
::bot_wallbuy_ammo_purchase_post_think,
|
||||
::bot_should_purchase_wallbuy_ammo,
|
||||
::bot_check_complete_wallbuy_ammo_purchase,
|
||||
::bot_wallbuy_ammo_purchase_should_cancel,
|
||||
::bot_wallbuy_ammo_purchase_priority );
|
||||
|
||||
register_bot_action( "packapunch",
|
||||
::bot_packapunch_purchase,
|
||||
::bot_packapunch_purchase_init,
|
||||
::bot_packapunch_purchase_post_think,
|
||||
::bot_should_purchase_packapunch,
|
||||
::bot_check_complete_packapunch_purchase,
|
||||
::bot_packapunch_purchase_should_cancel,
|
||||
::bot_packapunch_purchase_priority );
|
||||
|
||||
register_bot_objective( "magicbox" );
|
||||
register_bot_objective( "wallbuy" );
|
||||
register_bot_objective( "wallbuyammo" );
|
||||
@ -70,6 +115,8 @@ connected()
|
||||
self.on_revive_success_func = ::bot_on_revive_success;
|
||||
self.on_magicbox_weapon_grab_func = ::bot_on_magicbox_weapon_grab;
|
||||
self.on_perk_purchase_func = ::bot_on_perk_purchase;
|
||||
self.on_door_purchase_func = ::bot_on_door_purchase_func;
|
||||
self.on_debris_purchase_func = ::bot_on_debris_purchase_func;
|
||||
|
||||
self.obj_cancel_reason = "";
|
||||
|
||||
|
@ -29,6 +29,9 @@ create_static_objectives()
|
||||
{
|
||||
obj = add_possible_bot_objective( "wallbuy", weapon_spawns[ i ], false );
|
||||
obj = add_possible_bot_objective( "wallbuyammo", weapon_spawns[ i ], false );
|
||||
model = getEnt( weapon_spawns[ i ].target, "targetname" );
|
||||
weapon_spawns[ i ].bot_use_node = get_angle_offset_node( model, ( 0, model.angles[ 1 ] - 90, 0 ), getDvarInt( "perk_node_forward_size" ), ( 0, 0, getDvarInt( "perk_node_vertical_offset" ) ) );
|
||||
model thread wallbuy_debug();
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,8 +43,8 @@ create_static_objectives()
|
||||
{
|
||||
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();
|
||||
vending_triggers[ i ].bot_use_node = get_angle_offset_node( model, ( 0, model.angles[ 1 ] - 90, 0 ), getDvarInt( "perk_node_forward_size" ), ( 0, 0, getDvarInt( "perk_node_vertical_offset" ) ) );
|
||||
model thread perk_debug();
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +55,10 @@ create_static_objectives()
|
||||
{
|
||||
for ( i = 0; i < zombie_doors.size; i++ )
|
||||
{
|
||||
if ( isDefined( zombie_doors[ i ].script_noteworthy ) && zombie_doors[ i ].script_noteworthy == "electric_door" )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
obj = add_possible_bot_objective( "door", zombie_doors[ i ], true );
|
||||
}
|
||||
level thread watch_door_objectives( zombie_doors );
|
||||
@ -231,6 +238,21 @@ perk_debug()
|
||||
}
|
||||
}
|
||||
|
||||
wallbuy_debug()
|
||||
{
|
||||
if ( getDvarInt( "bot_obj_debug_all" ) == 0 && getDvarInt( "bot_obj_debug_magicbox" ) == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
while ( true )
|
||||
{
|
||||
node = get_angle_offset_node( self, ( 0, self.angles[ 1 ] - getDvarInt( "wallbuy_node_angle" ), 0 ), getDvarInt( "wallbuy_node_forward_size" ), ( 0, 0, getDvarInt( "wallbuy_node_vertical_offset" ) ) );
|
||||
self.bot_use_node = node;
|
||||
line( self.origin, node, ( 1.0, 1.0, 1.0 ) );
|
||||
wait 0.05;
|
||||
}
|
||||
}
|
||||
|
||||
bot_on_powerup_grab( powerup )
|
||||
{
|
||||
self bot_objective_print( "powerup", powerup getEntityNumber(), "bot_on_powerup_grab", "Bot <" + self.playername + "> grabbed powerup" );
|
||||
@ -254,3 +276,15 @@ 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;
|
||||
}
|
||||
|
||||
bot_on_door_purchase_func( door )
|
||||
{
|
||||
self bot_objective_print( "door", door getEntityNumber(), "bot_on_door_purchase_func", "Bot <" + self.playername + "> purchased door" );
|
||||
self.successfully_bought_door = true;
|
||||
}
|
||||
|
||||
bot_on_debris_purchase_func( debris, entnum )
|
||||
{
|
||||
self bot_objective_print( "debris", debris getEntityNumber(), "bot_on_debris_purchase_func", "Bot <" + self.playername + "> purchased debris" );
|
||||
self.successfully_bought_debris = true;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user