diff --git a/AutismBotIngame/python/ingamefollowct.py b/AutismBotIngame/python/ingamefollowct.py index 135cc35a..48d00e3c 100644 --- a/AutismBotIngame/python/ingamefollowct.py +++ b/AutismBotIngame/python/ingamefollowct.py @@ -65,7 +65,7 @@ def bot_process_movement(input_line): if bot_stuck: print('bot stuck') strInput += "+jump; wait 15; +duck; wait 15; -jump; wait 15; -duck; wait 3;" - if dist_target > 2.5: + if dist_target > 0.5: strInput += "use weapon_elite; wait 3; " elif targeteam == 3: strInput += "use weapon_p90; wait 3; " @@ -81,8 +81,8 @@ def bot_process_movement(input_line): #make some setup to allow surfing/mimic else: ladder_counter = 0 - min_distance_target_human = 2.0 - min_enemy_distance = 20.0 + min_distance_target_human = 0.3 + min_enemy_distance = 10.0 if bot_on_type == 1: print('bot_on_type water') strInput += "+jump; wait 5;" diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 7ac2062d..eda28716 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -13,7 +13,7 @@ //#pragma newdecls required int present = 0; int targethuman = 0; -int client_mini_stuck_counter[MAXPLAYERS + 1]; +bool client_stuck_g[MAXPLAYERS + 1]; bool round_start_stuck = false; float bot_old_coords[3]; bool bot_stuck_g = false; @@ -50,7 +50,7 @@ public void OnPluginStart() SocketBind(socket, "127.0.0.1", 48475); connect(socket); global_socket = socket; - + round_start_stuck = true; targethuman = 0; bot_presumed_endpoint[0] = 0.0; bot_presumed_endpoint[1] = 0.0; @@ -108,9 +108,8 @@ public Action clients_coordinates(Handle timer, any data) { if (IsValidClient(present) && IsPlayerAlive(present)) { - int min_cap = 15; for (int i = 1; i <= MaxClients; i++) - if (IsValidClient(i) && IsPlayerAlive(i) && i != present && client_mini_stuck_counter[i] < min_cap) + if (IsValidClient(i) && IsPlayerAlive(i) && i != present && !client_stuck_g[i]) GetEntPropVector(i, Prop_Send, "m_vecOrigin", client_old_coords[i]); if (!bot_stuck_g) GetEntPropVector(present, Prop_Send, "m_vecOrigin", bot_old_coords); @@ -140,7 +139,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float int cmdnum, int tickcount, int seed, const int mouse[2]) { if (!IsClientInGame(client)) return; - if (client == targethuman && round_start_stuck) + if (client == targethuman && round_start_stuck && IsValidClient(present)) { char keyinput[generic_length * 5]; if (buttons & IN_JUMP) @@ -150,10 +149,10 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float if (strlen(keyinput) > 0) { float pos[3]; - GetEntPropVector(present, Prop_Send, "m_vecOrigin", pos); - float dist_target = get_power_distance(targethuman, pos); - float dist_cap = 15.0; - if (dist_target <= dist_cap) + GetEntPropVector(targethuman, Prop_Send, "m_vecOrigin", pos); + float dist_target = get_power_distance(present, pos); + float dist_cap = 1.0; + if (dist_target < dist_cap) { Format(keyinput, sizeof(keyinput), "keyinput: %s dist_target: %f", keyinput, dist_target); send_socket_msg(keyinput, strlen(keyinput)); @@ -254,10 +253,10 @@ public Action recursive_pressing(Handle timer, any data) } if (IsValidClient(target_enemy)) { - float min_enemy_distance = 20.0; + float min_enemy_distance = 10.0; GetEntPropVector(target_enemy, Prop_Send, "m_vecOrigin", pos); enemy_distance = get_power_distance(present, pos); - float min_distance_target_human = 2.0; + float min_distance_target_human = 0.3; //human aiming for zombie if (targeteam == 3 && dist_target > 0 && dist_target < min_distance_target_human && enemy_distance > min_enemy_distance) { @@ -276,7 +275,7 @@ public Action recursive_pressing(Handle timer, any data) if (round_start_stuck) bot_stuck = is_bot_stuck(); } - //TODO detect gaps and jump perfectly over them + //TODO detect gaps and jump perfectly over them, trace maybe to judge if avoiding gap or jumpable distance if (IsValidClient(targethuman)) Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f bot_stuck: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, bot_stuck, targeteam); else @@ -288,6 +287,8 @@ public Action recursive_pressing(Handle timer, any data) public bool is_bot_stuck() { + if (!round_start_stuck) + return false; float min_distance_cap = 0.1; float bot_own_distance = get_power_distance(present, bot_old_coords); bot_stuck_g = bot_own_distance < min_distance_cap; @@ -326,16 +327,10 @@ stock bool is_client_stuck_or_afk(int client) { if (!round_start_stuck) return false; - float min_distance_cap = 0.05; - int min_cap = 15; + float min_distance_cap = 0.02; float client_own_distance = get_power_distance(client, client_old_coords[client]); - if (client_own_distance < min_distance_cap) - client_mini_stuck_counter[client]++; - else - client_mini_stuck_counter[client] = 0; - if (client == targethuman) - min_cap = min_cap * 4; - return client_mini_stuck_counter[client] > min_cap; + client_stuck_g[client] = client_own_distance < min_distance_cap; + return client_stuck_g[client]; } public int find_closest_enemy(int entity, int targeteam) @@ -457,7 +452,7 @@ public void OnClientPostAdminCheck(int client) client_old_coords[client][0] = 0.0; client_old_coords[client][1] = 0.0; client_old_coords[client][2] = 0.0; - client_mini_stuck_counter[client] = 0; + client_stuck_g[client] = false; } public OnSocketError(Handle socket, const int errorType, const int errorNum, any args) @@ -483,7 +478,7 @@ public void OnClientDisconnect(int client) client_old_coords[client][0] = 0.0; client_old_coords[client][1] = 0.0; client_old_coords[client][2] = 0.0; - client_mini_stuck_counter[client] = 0; + client_stuck_g[client] = false; } public void bot_send_connected_msg() @@ -552,7 +547,7 @@ public bool Filter_NoPlayers(int entity, int mask) public bool IsPointVisible(const float start[3], const float end[3]) { - TR_TraceRayFilter(start, end, MASK_VISIBLE, RayType_EndPoint, Filter_NoPlayers); + TR_TraceRayFilter(start, end, MASK_SOLID, RayType_EndPoint, Filter_NoPlayers); return TR_GetFraction() == 1.0; }