furhter updates to team joining as well as wall proximity to help with crouching/jumping
This commit is contained in:
parent
fa55ea1e17
commit
74652f9d18
@ -30,7 +30,7 @@ def exit_handler():
|
|||||||
resetCfgInputShortWait()
|
resetCfgInputShortWait()
|
||||||
|
|
||||||
def joinTeam():
|
def joinTeam():
|
||||||
str = "jointeam 2; wait 2; zspawn; wait 1; {0}; wait 5;"
|
str = "jointeam 2; wait 2; zspawn; wait 1; wait 5;"
|
||||||
writeCfgInput(str)
|
writeCfgInput(str)
|
||||||
time.sleep(4.5)
|
time.sleep(4.5)
|
||||||
print('jointeam func: ')
|
print('jointeam func: ')
|
||||||
@ -85,9 +85,12 @@ def bot_process_movement(input_line):
|
|||||||
#maybe 0.8 instead
|
#maybe 0.8 instead
|
||||||
min_distance_target_human = 0.1
|
min_distance_target_human = 0.1
|
||||||
strInput = "-attack; wait 2; -use; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; wait 2; +use; +forward; wait 2; "
|
strInput = "-attack; wait 2; -use; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; wait 2; +use; +forward; wait 2; "
|
||||||
if crouch_or_jump > 0:
|
if crouch_or_jump == 2:
|
||||||
print('crouch_or_jump')
|
print('crouching')
|
||||||
strInput += "+jump; wait 5; +duck; wait 5; -jump; wait 500; -duck; wait 3;"
|
strInput += "+duck; wait 1500; -duck; wait 50;"
|
||||||
|
if crouch_or_jump == 3:
|
||||||
|
print('jumping')
|
||||||
|
strInput += "+jump; wait 750; +duck; wait 750; -jump; wait 500; -duck; wait 500; +jump; wait 1000; -jump; "
|
||||||
if dist_target > min_distance_target_human:
|
if dist_target > min_distance_target_human:
|
||||||
strInput += "use weapon_elite; wait 3; "
|
strInput += "use weapon_elite; wait 3; "
|
||||||
elif targeteam == 3:
|
elif targeteam == 3:
|
||||||
|
@ -276,6 +276,12 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
{
|
{
|
||||||
if (IsValidClient(present) && IsPlayerAlive(present))
|
if (IsValidClient(present) && IsPlayerAlive(present))
|
||||||
{
|
{
|
||||||
|
if (GetClientTeam(present) == 1)
|
||||||
|
{
|
||||||
|
//prevent him being stuck afk in spec
|
||||||
|
bot_send_connected_msg();
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
char message[generic_length * 7];
|
char message[generic_length * 7];
|
||||||
float present_bot_coords[3];
|
float present_bot_coords[3];
|
||||||
GetClientAbsOrigin(present, present_bot_coords);
|
GetClientAbsOrigin(present, present_bot_coords);
|
||||||
@ -335,7 +341,7 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
int target_enemy = find_closest_enemy(present, targeteam);
|
int target_enemy = find_closest_enemy(present, targeteam);
|
||||||
bool chasing_enemy = false;
|
bool chasing_enemy = false;
|
||||||
float dist_target = -1.0;
|
float dist_target = -1.0;
|
||||||
bool crouch_or_jump = false;
|
int crouch_or_jump = 0;
|
||||||
if (bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4)
|
if (bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4)
|
||||||
{
|
{
|
||||||
float pos[3];
|
float pos[3];
|
||||||
@ -373,6 +379,7 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
}
|
}
|
||||||
if (IsValidClient(targethuman) && !chasing_enemy)
|
if (IsValidClient(targethuman) && !chasing_enemy)
|
||||||
face_call(targethuman);
|
face_call(targethuman);
|
||||||
|
//0: nothing, 2: crouch, 3: jump
|
||||||
crouch_or_jump = wall_circle();
|
crouch_or_jump = wall_circle();
|
||||||
}
|
}
|
||||||
if (bot_on_type != 2)
|
if (bot_on_type != 2)
|
||||||
@ -387,44 +394,43 @@ public Action recursive_pressing(Handle timer, any data)
|
|||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool wall_circle()
|
public int wall_circle()
|
||||||
{
|
{
|
||||||
//TODO maybe
|
//Circle:
|
||||||
float min_cap_distance = 50.0;
|
for (int iterator = 0; iterator < 3; iterator++)
|
||||||
for (float AngleRotate = 0.0; AngleRotate < 360.0; AngleRotate += 30.0)
|
{
|
||||||
|
float angle_start = -360.0; //should be -180.0 ofc
|
||||||
|
float angle_end = 360.0;
|
||||||
|
for (float AngleRotate = angle_start; AngleRotate <= angle_end; AngleRotate += 10.0)
|
||||||
{
|
{
|
||||||
float StartOrigin[3];
|
float StartOrigin[3];
|
||||||
float Angles[3];
|
float Angles[3];
|
||||||
Angles[0] = 0.0;
|
GetClientEyeAngles(present, Angles);
|
||||||
Angles[1] = AngleRotate;
|
Angles[iterator] = AngleRotate;
|
||||||
Angles[2] = 0.0;
|
|
||||||
GetClientEyePosition(present, StartOrigin);
|
GetClientEyePosition(present, StartOrigin);
|
||||||
TR_TraceRayFilter(StartOrigin, Angles, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf);
|
TR_TraceRayFilter(StartOrigin, Angles, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf, present);
|
||||||
if (TR_DidHit())
|
if (TR_DidHit())
|
||||||
{
|
{
|
||||||
float EndOrigin[3];
|
float EndOrigin[3];
|
||||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
||||||
float Distance = (GetVectorDistance(StartOrigin, EndOrigin));
|
float dot_product = GetVectorDotProduct(StartOrigin, EndOrigin);
|
||||||
if (Distance < min_cap_distance)
|
dot_product = dot_product / 1000;
|
||||||
return true;
|
float distance = GetVectorDistance(StartOrigin, EndOrigin);
|
||||||
}
|
float crouch_cap = 5000.0;
|
||||||
float StartOrigin1[3];
|
float jump_cap = 100000.0;
|
||||||
float Angles1[3];
|
float distance_cap = 50.0;
|
||||||
Angles1[0] = AngleRotate;
|
if (distance <= distance_cap)
|
||||||
Angles1[1] = 0.0;
|
|
||||||
Angles1[2] = 0.0;
|
|
||||||
GetClientEyePosition(present, StartOrigin1);
|
|
||||||
TR_TraceRayFilter(StartOrigin1, Angles1, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf);
|
|
||||||
if (TR_DidHit())
|
|
||||||
{
|
{
|
||||||
float EndOrigin[3];
|
if (dot_product <= crouch_cap)
|
||||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
return 2;
|
||||||
float Distance = (GetVectorDistance(StartOrigin1, EndOrigin));
|
else if (dot_product <= jump_cap)
|
||||||
if (Distance < min_cap_distance)
|
return 3;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void check_bot_surfing()
|
public void check_bot_surfing()
|
||||||
|
Loading…
Reference in New Issue
Block a user