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()
|
||||
|
||||
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)
|
||||
time.sleep(4.5)
|
||||
print('jointeam func: ')
|
||||
@ -85,9 +85,12 @@ def bot_process_movement(input_line):
|
||||
#maybe 0.8 instead
|
||||
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; "
|
||||
if crouch_or_jump > 0:
|
||||
print('crouch_or_jump')
|
||||
strInput += "+jump; wait 5; +duck; wait 5; -jump; wait 500; -duck; wait 3;"
|
||||
if crouch_or_jump == 2:
|
||||
print('crouching')
|
||||
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:
|
||||
strInput += "use weapon_elite; wait 3; "
|
||||
elif targeteam == 3:
|
||||
|
@ -276,6 +276,12 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
{
|
||||
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];
|
||||
float present_bot_coords[3];
|
||||
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);
|
||||
bool chasing_enemy = false;
|
||||
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)
|
||||
{
|
||||
float pos[3];
|
||||
@ -373,6 +379,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
}
|
||||
if (IsValidClient(targethuman) && !chasing_enemy)
|
||||
face_call(targethuman);
|
||||
//0: nothing, 2: crouch, 3: jump
|
||||
crouch_or_jump = wall_circle();
|
||||
}
|
||||
if (bot_on_type != 2)
|
||||
@ -387,44 +394,43 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public bool wall_circle()
|
||||
public int wall_circle()
|
||||
{
|
||||
//TODO maybe
|
||||
float min_cap_distance = 50.0;
|
||||
for (float AngleRotate = 0.0; AngleRotate < 360.0; AngleRotate += 30.0)
|
||||
//Circle:
|
||||
for (int iterator = 0; iterator < 3; iterator++)
|
||||
{
|
||||
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];
|
||||
Angles[0] = 0.0;
|
||||
Angles[1] = AngleRotate;
|
||||
Angles[2] = 0.0;
|
||||
GetClientEyeAngles(present, Angles);
|
||||
Angles[iterator] = AngleRotate;
|
||||
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())
|
||||
{
|
||||
float EndOrigin[3];
|
||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
||||
float Distance = (GetVectorDistance(StartOrigin, EndOrigin));
|
||||
if (Distance < min_cap_distance)
|
||||
return true;
|
||||
}
|
||||
float StartOrigin1[3];
|
||||
float Angles1[3];
|
||||
Angles1[0] = AngleRotate;
|
||||
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];
|
||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
||||
float Distance = (GetVectorDistance(StartOrigin1, EndOrigin));
|
||||
if (Distance < min_cap_distance)
|
||||
return true;
|
||||
float dot_product = GetVectorDotProduct(StartOrigin, EndOrigin);
|
||||
dot_product = dot_product / 1000;
|
||||
float distance = GetVectorDistance(StartOrigin, EndOrigin);
|
||||
float crouch_cap = 5000.0;
|
||||
float jump_cap = 100000.0;
|
||||
float distance_cap = 50.0;
|
||||
if (distance <= distance_cap)
|
||||
{
|
||||
if (dot_product <= crouch_cap)
|
||||
return 2;
|
||||
else if (dot_product <= jump_cap)
|
||||
return 3;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void check_bot_surfing()
|
||||
|
Loading…
Reference in New Issue
Block a user