Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void () BotIsDead =
- {
- self.think = BotRespawn;
- self.nextthink = ((time + 1) + (random () * (4 - self.bot_skill)));
- setmodel (self, "");
- };
- void () ChangePitch =
- {
- local float ideal;
- local float move;
- self.current_pitch = self.angles_x;
- ideal = self.ideal_pitch;
- if ((ideal > 54))
- {
- ideal = 54;
- }
- else
- {
- if ((ideal < -54))
- {
- ideal = -54;
- }
- }
- if ((self.current_pitch == ideal))
- {
- return;
- }
- move = (ideal - self.current_pitch);
- if ((move > 0))
- {
- if ((move > 6))
- {
- move = 6;
- }
- }
- else
- {
- if ((move < CONTENT_SKY))
- {
- move = CONTENT_SKY;
- }
- }
- self.current_pitch = (self.current_pitch + move);
- self.angles_x = self.current_pitch;
- };
- void () wall_look =
- {
- local vector a1;
- local vector b1;
- local vector c1;
- local float a;
- local float b;
- local float c;
- makevectors (self.angles);
- traceline (self.origin, ((self.origin + '0 0 16') + (v_forward * 100)), FALSE, self);
- a = vlen ((trace_endpos - self.origin));
- a1 = trace_endpos;
- if ((random () < 0.45))
- {
- self.angles_x = (self.angles_x - 8);
- }
- else
- {
- self.angles_x = (self.angles_x + 12);
- }
- if ((trace_fraction < 1))
- {
- self.angles_y = (self.angles_y - 45);
- makevectors (self.angles);
- traceline (self.origin, ((self.origin + '0 0 16') + (v_forward * 100)), FALSE, self);
- b = vlen ((trace_endpos - self.origin));
- b1 = trace_endpos;
- if ((trace_fraction < 1))
- {
- self.angles_y = (self.angles_y + 90);
- makevectors (self.angles);
- traceline (self.origin, ((self.origin + '0 0 16') + (v_forward * 100)), FALSE, self);
- c = vlen ((trace_endpos - self.origin));
- c1 = trace_endpos;
- }
- }
- if (((a > b) && (a > c)))
- self.angles_y = (self.angles_y - 45);
- else if (((b > a) && (b > c)))
- self.angles_y = (self.angles_y - 90);
- else if (((c > a) && (c > b)))
- return;
- return;
- };
- void () patternchange =
- {
- local float p;
- if ((self.waterlevel < SPAWNFLAG_LASER))
- {
- p = random ();
- if ((p < 0.7))
- {
- self.pattern = 0;
- return;
- }
- else
- {
- if (((p > 0.9) && (pointcontents (self.origin) > CONTENT_WATER)))
- {
- self.pattern = 1;
- return;
- }
- }
- }
- return;
- };
- float (entity targ) BotCanSeeItemThroughWater =
- {
- local vector spot1;
- local vector spot2;
- local vector vec;
- spot1 = (self.origin + self.view_ofs);
- vec = GetRandomVector ();
- spot2 = (targ.origin + vec);
- traceline (spot1, spot2, TRUE, self);
- if ((trace_fraction == 1))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- float (vector pt) BotCanSeePoint =
- {
- local vector spot1;
- spot1 = (self.origin + self.view_ofs);
- traceline (spot1, pt, TRUE, self);
- if ((trace_inopen && trace_inwater))
- {
- return (FALSE);
- }
- if ((trace_fraction == 1))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- float (vector pt) BotCanSeePointThroughWater =
- {
- local vector spot1;
- spot1 = (self.origin + self.view_ofs);
- traceline (spot1, pt, TRUE, self);
- if ((trace_fraction == 1))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- float (entity targ) BotCanSeeItem =
- {
- local vector spot1;
- local vector spot2;
- local vector vec;
- spot1 = (self.origin + self.view_ofs);
- vec = GetRandomVector ();
- spot2 = (targ.origin + vec);
- traceline (spot1, spot2, TRUE, self);
- if ((trace_inopen && trace_inwater))
- {
- return (FALSE);
- }
- if ((trace_fraction == 1))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- float (entity targ) BotCanSeePlayer =
- {
- local vector spot1;
- local vector spot2;
- local vector vec;
- local float r;
- spot1 = (self.origin + self.view_ofs);
- if (((targ.waterlevel == 0) || (targ.waterlevel == 3)))
- {
- vec = GetRandomVector ();
- }
- else
- {
- vec = '0 0 16';
- }
- spot2 = (targ.origin + vec);
- traceline (spot1, spot2, TRUE, self);
- if ((trace_inopen && trace_inwater))
- {
- return (FALSE);
- }
- if ((trace_fraction == 1))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- float (entity targ) BotCanSeePlayer0 =
- {
- return (BotCanSeeItem (targ));
- };
- entity (entity targ) BotCanSeePlayerFollow =
- {
- local float vis;
- local entity e;
- local float nm;
- if ((targ != world))
- {
- nm = 0;
- e = targ.follow_head;
- while (((e != world) && (nm < 10)))
- {
- vis = BotCanSeeItem (e);
- if (vis)
- {
- return (e);
- }
- e = e.follow_next;
- nm = (nm + 1);
- }
- }
- return (world);
- };
- void () RemoveInaccessible =
- {
- num_inaccessible_entities = (num_inaccessible_entities - 1);
- if ((self.inaccessible_entity != world))
- {
- if ((self.inaccessible_entity.inaccessible_count > 0))
- {
- self.inaccessible_entity.inaccessible_count = (self.inaccessible_entity.inaccessible_count - 1);
- }
- }
- remove (self);
- };
- float (entity e) ItemIsAccessible =
- {
- local entity p;
- if ((e.inaccessible_count <= 0))
- {
- return (TRUE);
- }
- p = find (world, classname, "inaccessible_from_here");
- while ((p != world))
- {
- if ((p.inaccessible_entity == e))
- {
- if ((vlen ((p.origin - self.origin)) < 100))
- {
- return (FALSE);
- }
- }
- p = find (p, classname, "inaccessible_from_here");
- }
- return (TRUE);
- };
- void (entity e) SpawnInaccessibleFromHere =
- {
- local entity p;
- if (ItemIsAccessible (e))
- {
- num_inaccessible_entities = (num_inaccessible_entities + 1);
- p = spawn ();
- p.classname = "inaccessible_from_here";
- p.inaccessible_entity = e;
- e.inaccessible_count = (e.inaccessible_count + 1);
- p.origin = (self.origin + '0 0 16');
- setorigin (p, p.origin);
- p.solid = SOLID_NOT;
- p.movetype = MOVETYPE_NONE;
- setmodel (p, string_null);
- p.think = RemoveInaccessible;
- p.nextthink = (time + 60);
- }
- };
- entity (float dist) FindNearbyItem =
- {
- local entity head;
- local entity selected;
- local float item_rating;
- local float best_rating;
- local float found;
- if ((time < self.find_item_time))
- return (head);
- self.find_item_time = (time + (self.bsk_reaction_time / 1.5));
- selected = world;
- found = FALSE;
- if ((self.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((self.team == TEAM_COLOR1))
- {
- head = find (world, classname, "item_flag_team1");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- head = find (world, classname, "item_flag_team2");
- }
- }
- if ( head != world )
- {
- if ((head.solid != SOLID_NOT))
- {
- if (BotCanSeeItem (head))
- {
- found = TRUE;
- selected = head;
- }
- }
- }
- }
- if (!found)
- {
- if ((self.team == TEAM_COLOR1))
- {
- head = find (world, classname, "item_flag_team2");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- head = find (world, classname, "item_flag_team1");
- }
- }
- if ((head != world))
- {
- if (((time >= head.bot_ignore_until_time) || (self.team != head.bot_ignore_team)))
- {
- if ((head.solid != SOLID_NOT))
- {
- if ((vlen ((head.origin - self.origin)) < 700))
- {
- if (BotCanSeeItem (head))
- {
- found = TRUE;
- selected = head;
- }
- }
- }
- }
- }
- }
- if (!found)
- {
- head = findradius (self.origin, dist);
- while (head)
- {
- if (((head.solid != SOLID_NOT) || (time < self.ltime)))
- {
- if (head.bot_wants_item)
- {
- if (((time >= head.bot_ignore_until_time) || (self.team != head.bot_ignore_team)))
- {
- if (BotCanSeeItem (head))
- {
- if (ItemIsAccessible (head))
- {
- item_rating = IsGoodItem (self, head);
- if ((item_rating > 0))
- {
- if (((trace_plane_dist - item_rating) < dist))
- {
- best_rating = item_rating;
- selected = head;
- dist = trace_plane_dist;
- found = TRUE;
- }
- }
- }
- }
- }
- }
- }
- head = head.chain;
- }
- }
- return (selected);
- };
- entity (entity bot, float dist) HelpTeammate =
- {
- local entity head;
- local entity selected1;
- local entity selected2;
- local entity selected3;
- local float d;
- local float best_dist1;
- local float best_dist2;
- local float best_dist3;
- local float thisdist;
- local entity follow_ent;
- if ((((bot.goalentity.classname == "player") || (bot.goalentity.classname == "bot")) && (bot.goalentity != bot)))
- {
- if ((bot.goalentity.team == self.team))
- {
- if ((bot.goalentity.health > 0))
- {
- if (BotCanSeePlayer (bot.goalentity))
- {
- return (bot.goalentity);
- }
- if ((bot.goalentity.classname == "player"))
- {
- follow_ent = BotCanSeePlayerFollow (bot.goalentity);
- if ((follow_ent != world))
- {
- return (follow_ent);
- }
- }
- }
- }
- }
- if ((time < bot.help_teammate_time))
- {
- return (world);
- }
- bot.help_teammate_time = (time + 5);
- selected1 = world;
- selected2 = world;
- selected3 = world;
- best_dist1 = 100000000;
- best_dist2 = 100000000;
- best_dist3 = 100000000;
- head = findradius (bot.origin, dist);
- while (head)
- {
- if (((head.classname == "player") || (head.classname == "bot")))
- {
- if ((head.team == bot.team))
- {
- if ((head != bot))
- {
- if (!(head.observer_flags & PLAYER_NO_TARGET))
- {
- if (!head.observer)
- {
- d = vlen ((head.origin - bot.origin));
- if ((head.classname == "player"))
- {
- if (((head.observer_flags & PLAYER_ALWAYS_ESCORT) || ((time < (self.escort_time + ESCORT_TIME)) && (self.escort_entity == head))))
- {
- if ((d < best_dist1))
- {
- if (BotCanSeePlayer (head))
- {
- selected1 = head;
- best_dist1 = d;
- }
- }
- }
- }
- if ((head.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((self != head.goalentity))
- {
- if ((d < best_dist2))
- {
- if (BotCanSeePlayer (head))
- {
- selected2 = head;
- best_dist2 = d;
- }
- }
- }
- }
- if ((head.classname == "bot"))
- {
- if ((head.enemy != world))
- {
- if (((head.enemy.classname == "player") || (head.enemy.classname == "bot")))
- {
- if ((d < best_dist3))
- {
- if (BotCanSeePlayer (head))
- {
- selected3 = head;
- best_dist3 = d;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- head = head.chain;
- }
- if ((selected1 != world))
- {
- return (selected1);
- }
- else
- {
- if ((selected2 != world))
- {
- return (selected2);
- }
- else
- {
- if ((selected3 != world))
- {
- return (selected3);
- }
- else
- {
- return (world);
- }
- }
- }
- };
- entity (float fteam) BotFindClosestTempWaypoint =
- {
- local entity e;
- local entity selected;
- local float best_waypoint_dist;
- selected = world;
- best_waypoint_dist = 99999997952;
- e = find (world, classname, "waypoint_temp");
- while ((e != world))
- {
- if ((e.team == fteam))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- if ((vlen ((e.origin - self.origin)) < best_waypoint_dist))
- {
- selected = e;
- best_waypoint_dist = vlen ((e.origin - self.origin));
- }
- }
- }
- e = find (e, classname, "waypoint_temp");
- }
- return (selected);
- };
- entity (float fteam) BotFindLeastWaypoint =
- {
- local entity e;
- local entity selected;
- local float best_waypoint_num;
- local float current_waypoint_num;
- local float choose;
- current_waypoint_num = 999999;
- best_waypoint_num = 999999;
- selected = world;
- if ((fteam == TEAM_COLOR1))
- {
- e = wp_first_red;
- }
- else
- {
- if ((fteam == TEAM_COLOR2))
- {
- e = wp_first_blue;
- }
- else
- {
- if ((fteam == -1))
- {
- e = wp_first_general;
- }
- }
- }
- while ((e != world))
- {
- if ((e.waypoint_num < current_waypoint_num))
- {
- if ((e.waypoint_num < best_waypoint_num))
- {
- if ((e.waypoint_num != -1))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- selected = e;
- best_waypoint_num = e.waypoint_num;
- }
- }
- else
- {
- if (((((e.waypoint_num == -1) && self.use_defensive_way) && (self.bot_plan == BOT_DEFEND)) && !(self.player_flag & ITEM_ENEMY_FLAG)))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- selected = e;
- best_waypoint_num = e.waypoint_num;
- }
- }
- }
- }
- else
- {
- if ((e.waypoint_num == best_waypoint_num))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- choose = TRUE;
- if ((self.goalentity.classname == "waypoint"))
- {
- choose = FALSE;
- }
- if ((self.goalentity.waypoint_num > e.waypoint_num))
- {
- choose = TRUE;
- }
- if (choose)
- {
- if ((random () < 0.5))
- {
- selected = e;
- best_waypoint_num = e.waypoint_num;
- }
- }
- }
- }
- }
- }
- e = e.wp_chain;
- }
- return (selected);
- };
- entity (float fteam) BotFindGreatestWaypoint =
- {
- local entity e;
- local entity selected;
- local float best_waypoint_num;
- local float current_waypoint_num;
- local float choose;
- current_waypoint_num = -1;
- best_waypoint_num = -1;
- selected = world;
- if ((fteam == TEAM_COLOR1))
- {
- e = wp_first_red;
- }
- else
- {
- if ((fteam == TEAM_COLOR2))
- {
- e = wp_first_blue;
- }
- else
- {
- if ((fteam == -1))
- {
- e = wp_first_general;
- }
- }
- }
- while ((e != world))
- {
- if ((e.waypoint_num > current_waypoint_num))
- {
- if ((e.waypoint_num > best_waypoint_num))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- selected = e;
- best_waypoint_num = e.waypoint_num;
- }
- }
- else
- {
- if ((e.waypoint_num == best_waypoint_num))
- {
- if (BotCanSeeItemThroughWater (e))
- {
- choose = TRUE;
- if ((self.goalentity.classname == "waypoint"))
- {
- choose = FALSE;
- }
- if ((self.goalentity.waypoint_num > e.waypoint_num))
- {
- choose = TRUE;
- }
- if (choose)
- {
- if ((random () < 0.5))
- {
- selected = e;
- best_waypoint_num = e.waypoint_num;
- }
- }
- }
- }
- }
- }
- e = e.wp_chain;
- }
- return (selected);
- };
- void () BotFireHook =
- {
- if (!hook_use_enabled) return;
- if ((temp1 & TEMP1_MULTI))
- {
- self.lastweapon_shot = self.weapon;
- self.weapon = IT_HOOK;
- set_player_weapon ();
- self.button0 = TRUE;
- Bot_Attack ();
- self.weapon = self.lastweapon_shot;
- }
- else
- {
- if ((self.player_flag & ITEM_RUNE3_FLAG))
- {
- self.attack_finished = (time + 0.06);
- HasteSound ();
- }
- else
- {
- self.attack_finished = (time + 0.1);
- }
- self.weapon = IT_HOOK;
- self.button0 = TRUE;
- Bot_Attack ();
- if ((self.nextjump < 4))
- {
- PlayerJump ();
- }
- }
- };
- float (entity bot, entity en, float dist) CanSeeInvisibleEntity =
- {
- local float can_see_eyes;
- local float chance;
- can_see_eyes = TRUE;
- if ((en.invisible_finished > time))
- {
- if ((dist < 80))
- {
- chance = 5;
- }
- else
- {
- if ((dist < 200))
- {
- chance = SECRET_NO_SHOOT;
- }
- else
- {
- chance = 1;
- }
- }
- if (((random () * 100) < (chance + (bot.bot_skill * (chance / 4)))))
- {
- can_see_eyes = TRUE;
- }
- else
- {
- can_see_eyes = FALSE;
- }
- }
- return (can_see_eyes);
- };
- entity () FindNearbyEnemy =
- {
- local entity head;
- local entity selected;
- local float dist;
- local float thisdist;
- if ((time < self.find_enemy_time))
- {
- return (head);
- }
- self.find_enemy_time = (time + self.bsk_reaction_time);
- if ((time > self.large_dist_pulse))
- {
- self.large_dist_pulse = (time + self.bsk_next_pulse_time);
- dist = large_pulse_dist;
- if ((random () < 0.02))
- dist = (dist + self.bsk_extra_large_pulse_dist);
- }
- else
- {
- dist = awareness_dist;
- if ((random () < 0.008))
- {
- dist = (dist + self.bsk_extra_awareness_dist);
- }
- }
- selected = world;
- head = findradius (self.origin, dist);
- while (head)
- {
- if ((head.classname != "image"))
- {
- if ((head.team != self.team))
- {
- if (((head.health > 0) && (head != self)))
- {
- if (EntityInFieldOfView (head))
- {
- if (BotCanSeePlayer (head))
- {
- if ((trace_plane_dist < dist))
- {
- if (CanSeeInvisibleEntity (self, head, trace_plane_dist))
- {
- if (!(head.observer_flags & PLAYER_NO_TARGET))
- {
- if (!head.observer)
- {
- selected = head;
- dist = trace_plane_dist;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- head = head.chain;
- }
- if (((selected != world) && (bot_debug >= 3)))
- {
- dprint (self.netname);
- dprint (" found ");
- dprint (selected.netname);
- dprint ("\n");
- }
- return (selected);
- };
- void () BotJump =
- {
- if (self.hook_out)
- {
- return;
- }
- makevectors (self.angles);
- v_forward_z = 0;
- v_forward = normalize (v_forward);
- if ((self.waterlevel >= SPAWNFLAG_LASER))
- {
- if ((self.watertype == CONTENT_WATER))
- {
- self.velocity = (VEC_ORIGIN + (v_forward * 100));
- }
- else
- {
- if ((self.watertype == CONTENT_SLIME))
- {
- self.velocity = (VEC_ORIGIN + (v_forward * 80));
- }
- else
- {
- if ((self.watertype == CONTENT_LAVA))
- {
- self.velocity = (VEC_ORIGIN + (v_forward * 50));
- }
- }
- }
- }
- else
- {
- self.velocity = (VEC_ORIGIN + (v_forward * 100));
- }
- self.flags = (self.flags | FL_JUMPRELEASED);
- PlayerJump ();
- };
- float () IsJumpSafe =
- {
- local vector org;
- local vector spot2;
- if ((self.nextjump < 1))
- {
- self.nextjump = 1;
- }
- makevectors (self.angles);
- org = (self.origin + (v_forward * 100));
- spot2 = org;
- spot2_z = (spot2_z - 500);
- traceline (org, spot2, TRUE, self);
- if ((trace_ent.classname == "plat"))
- {
- return (TRUE);
- }
- if ((pointcontents (trace_endpos) == CONTENT_LAVA))
- {
- return (FALSE);
- }
- if ((pointcontents (trace_endpos) == CONTENT_SLIME))
- {
- return (FALSE);
- }
- org = (self.origin + (v_forward * 200));
- spot2 = org;
- spot2_z = (spot2_z - 500);
- traceline (org, spot2, TRUE, self);
- if ((pointcontents (trace_endpos) == CONTENT_LAVA))
- {
- return (FALSE);
- }
- if ((pointcontents (trace_endpos) == CONTENT_SLIME))
- {
- return (FALSE);
- }
- return (TRUE);
- };
- float () BotShouldJump =
- {
- local float chance;
- local float jump_to_goal;
- local vector v;
- if (!IsJumpSafe ())
- {
- if (((pointcontents (self.origin) != CONTENT_SLIME) && (pointcontents (self.origin) != CONTENT_LAVA)))
- {
- return (FALSE);
- }
- }
- jump_to_goal = FALSE;
- v = (self.origin - self.goalentity.origin);
- if ((vlen (v) < 50))
- {
- if ((self.origin_z < self.goalentity.origin_z))
- {
- if (((self.goalentity.origin_z - self.origin_z) < 100))
- {
- jump_to_goal = TRUE;
- }
- }
- }
- else
- {
- if ((vlen (v) > 60))
- {
- if ((self.origin_z > self.goalentity.origin_z))
- {
- if (((self.origin_z - self.goalentity.origin_z) > 100))
- {
- jump_to_goal = TRUE;
- }
- }
- }
- }
- if (jump_to_goal)
- {
- chance = self.bsk_extra_jump_chance;
- }
- else
- {
- if ((pointcontents (self.origin) == CONTENT_SLIME))
- {
- chance = self.bsk_extra_jump_chance;
- }
- else
- {
- if ((pointcontents (self.origin) == CONTENT_LAVA))
- {
- chance = self.bsk_extra_jump_chance;
- }
- else
- {
- if (self.bot_blocked)
- {
- chance = 0.1;
- }
- else
- {
- if ((self.bot_action == BOT_FIGHTING))
- {
- chance = 0.03;
- }
- else
- {
- chance = 0.002;
- }
- }
- }
- }
- }
- if ((random () < chance))
- {
- return (TRUE);
- }
- else
- {
- return (FALSE);
- }
- };
- void (vector org) SpawnTempDebugMarker =
- {
- local entity st;
- st = spawn ();
- st.origin = org;
- setorigin (st, org);
- st.solid = SOLID_NOT;
- st.movetype = MOVETYPE_NONE;
- setmodel (st, "progs/s_bubble.spr");
- st.think = SUB_Remove;
- st.nextthink = (time + 0.1);
- };
- float () StepUpZ =
- {
- local vector spot1;
- local vector spot2;
- local vector vf2;
- local vector vr2;
- local vector org;
- local float diff1;
- local float diff2;
- local float diff3;
- local float maxx;
- makevectors (self.angles);
- vf2 = v_forward;
- vf2_z = 0;
- vf2 = normalize (vf2);
- org = (self.origin + (vf2 * 24));
- spot1 = org;
- spot2 = (spot1 - '0 0 64');
- traceline (spot1, spot2, TRUE, self);
- diff1 = (trace_endpos_z - (self.origin_z - 24));
- vr2 = v_right;
- vr2_z = 0;
- vr2 = normalize (vr2);
- org = ((self.origin + (vf2 * 24)) + (vr2 * SECRET_YES_SHOOT));
- spot1 = org;
- spot2 = (spot1 - '0 0 64');
- traceline (spot1, spot2, TRUE, self);
- diff2 = (trace_endpos_z - (self.origin_z - 24));
- org = ((self.origin + (vf2 * 24)) + (vr2 * -16));
- spot1 = org;
- spot2 = (spot1 - '0 0 64');
- traceline (spot1, spot2, TRUE, self);
- diff3 = (trace_endpos_z - (self.origin_z - 24));
- maxx = diff1;
- if ((diff2 > maxx))
- {
- maxx = diff2;
- }
- if ((diff3 > maxx))
- {
- maxx = diff3;
- }
- if ((maxx > SECRET_YES_SHOOT))
- {
- maxx = SECRET_YES_SHOOT;
- }
- if ((maxx > 0))
- {
- return (maxx);
- }
- else
- {
- return (0);
- }
- };
- float () ShouldReleaseHook =
- {
- if (((self.stuck_count > SPAWNFLAG_LASER) && !self.hooked_on_someone))
- {
- return (TRUE);
- }
- else
- {
- if (((time > (self.hook_snag_time + 3)) && !self.hooked_on_someone))
- {
- return (TRUE);
- }
- }
- return (FALSE);
- };
- float () MoveForwardSafe =
- {
- local vector spot1;
- local vector spot2;
- local vector vf2;
- local vector org;
- local float diff;
- makevectors (self.angles);
- vf2 = v_forward;
- vf2_z = 0;
- vf2 = normalize (vf2);
- org = (self.origin + (vf2 * 24));
- spot1 = org;
- spot2 = (org - '0 0 2000');
- traceline (spot1, spot2, TRUE, self);
- diff = (trace_endpos_z - (self.origin_z - 24));
- if (((diff < 0) && (trace_inopen && trace_inwater)))
- {
- return (FALSE);
- }
- else
- {
- return (TRUE);
- }
- };
- void () ExtraWalkMoveFrameThink =
- {
- walkmove (self.extramove_yaw, self.extramove_dist);
- if (self.extramove_lastframewasextra)
- {
- self.think = BotAnimationThink;
- }
- else
- {
- self.think = self.extramove_oldthink;
- }
- self.extramove_lastframewasextra = TRUE;
- self.nextthink = (time + 0.1);
- };
- void () ExtraMoveToGoalFrameThink =
- {
- movetogoal (self.extramove_dist);
- if (self.extramove_lastframewasextra)
- {
- self.think = BotAnimationThink;
- }
- else
- {
- self.think = self.extramove_oldthink;
- }
- self.extramove_lastframewasextra = TRUE;
- self.nextthink = (time + 0.15);
- };
- float (float yaw, float dist) BotWalkMove =
- {
- if ((self.pattern == 1))
- {
- self.nextthink = (time + 0.1);
- return (walkmove (yaw, self.extramove_dist));
- }
- else
- {
- self.extramove_yaw = yaw;
- self.extramove_dist = (dist / SPAWNFLAG_LASER);
- self.think = ExtraWalkMoveFrameThink;
- self.nextthink = (time + 0.05);
- return (walkmove (yaw, self.extramove_dist));
- }
- };
- void (float dist) BotMoveToGoal =
- {
- if ((self.pattern == 1))
- {
- self.nextthink = (time + 0.1);
- self.ideal_yaw = vectoyaw ((self.goalentity.origin - self.origin));
- ChangeYaw ();
- if (!EntityInFieldOfView (self.goalentity))
- {
- wall_look ();
- }
- if ((self.watertype == CONTENT_WATER))
- {
- self.speed = 175;
- }
- if ((self.watertype == CONTENT_SLIME))
- {
- self.speed = 100;
- }
- if ((self.watertype == CONTENT_LAVA))
- {
- self.speed = 20;
- }
- if ((self.bot_plan == BOT_ATTACK))
- {
- self.speed = (floor (((random () * 6) + 1)) * 100);
- }
- else
- {
- self.speed = 450;
- }
- norse_movetogoal (TRUE);
- }
- else
- {
- self.ideal_yaw = vectoyaw ((self.movement));
- self.extramove_dist = (dist / SPAWNFLAG_LASER);
- self.think = ExtraMoveToGoalFrameThink;
- self.nextthink = (time + 0.05);
- movetogoal (self.extramove_dist);
- }
- };
- float (vector desired_velocity) GetMoveDist =
- {
- local float dist;
- local float dp;
- local vector des_vel;
- if ((desired_velocity == VEC_ORIGIN))
- {
- makevectors (self.angles);
- des_vel = normalize (v_forward);
- }
- else
- {
- des_vel = normalize (desired_velocity);
- }
- self.current_velocity = normalize (self.current_velocity);
- dp = (self.current_velocity * des_vel);
- self.current_velocity = des_vel;
- if ((dp < 0))
- {
- dp = 0;
- }
- dist = (SECRET_NEVER * dp);
- if ((self.waterlevel == 3))
- {
- dist = (dist / SPAWNFLAG_LASER);
- }
- return (dist);
- };
- void () MoveBot =
- {
- local float dist;
- local vector vec;
- local vector oldorg;
- local vector vec2;
- local float stepup;
- self.bot_action = BOT_MOVING;
- if (!(self.flags & FL_ONGROUND))
- return;
- self.v_angle = normalize(self.goalentity.origin - self.origin);
- self.v_angle_z = 0; // let the engine handle roll with physics
- dist = GetMoveDist ((self.goalentity.origin - self.origin));
- movedist = dist;
- if (BotShouldJump ())
- {
- BotJump ();
- }
- else
- {
- if (!smooth_move)
- {
- oldorg = self.origin;
- BotMoveToGoal (dist);
- self.bot_blocked = FALSE;
- if (((self.origin == oldorg) && (dist != 0)))
- {
- self.bot_blocked = TRUE;
- }
- }
- else
- {
- self.flags = (self.flags | FL_JUMPRELEASED);
- self.flags = (self.flags - (self.flags & FL_ONGROUND));
- if (!norse_checkgap (self))
- {
- vec2 = self.origin;
- stepup = StepUpZ ();
- vec2_z = (vec2_z + stepup);
- setorigin (self, vec2);
- vec = (self.goalentity.origin - self.origin);
- vec_z = stepup;
- vec = normalize (vec);
- if ((self.goalentity != self))
- {
- self.movement_x = vec_x;
- self.movement_y = vec_y;
- //self.movement = self.velocity;
- }
- else
- {
- makevectors (self.angles);
- self.movement_x = vec_x;
- self.movement_y = vec_y;
- //self.movement = self.velocity;
- //self.velocity = (v_forward * 640);
- }
- }
- }
- }
- };
- float () MaybeFightFlagCarrier =
- {
- local entity p;
- local float x;
- if ((random () < self.bsk_skill_lin3))
- {
- if ((self.team == TEAM_COLOR1))
- {
- p = find (world, classname, "item_flag_team1");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- p = find (world, classname, "item_flag_team2");
- }
- }
- if ((p.cnt == FLAG_CARRIED))
- {
- if ((p.owner != world))
- {
- if (((p.owner.classname == "player") || (p.owner.classname == "bot")))
- {
- if ((p.owner != self.enemy))
- {
- if (((p.owner.health > 0) && (p.owner != self)))
- {
- if (EntityInFieldOfView (p.owner))
- {
- if (BotCanSeePlayer (p.owner))
- {
- if (CanSeeInvisibleEntity (self, p.owner, trace_plane_dist))
- {
- if (!(p.owner.observer_flags & PLAYER_NO_TARGET))
- {
- if (!p.owner.observer)
- {
- if ((trace_plane_dist < 1500))
- {
- self.goalentity = p.owner;
- self.movetarget = p.owner;
- self.enemy = p.owner;
- self.suspicious_about = p.owner.origin;
- self.suspicious_about_time = (time - 5);
- self.repeat = -1;
- self.enemy_notice_time = (time - 999);
- fBotSayTeam (": ENGAGING EMEMY CARRIER!!!\n");
- x = random ();
- if ((x < 0.33))
- {
- sound (self, CHAN_AUTO, "enforcer/sight2.wav", 1, ATTN_NORM);
- }
- else
- {
- if ((x < 0.66))
- {
- sound (self, CHAN_AUTO, "enforcer/sight1.wav", 1, ATTN_NORM);
- }
- else
- {
- if ((x > 0.66))
- {
- sound (self, CHAN_AUTO, "enforcer/sight3.wav", 1, ATTN_NORM);
- }
- }
- }
- powerup ();
- self.bot_action = BOT_FIGHTING;
- return (TRUE);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return (FALSE);
- };
- float () MaybeFight =
- {
- local entity en;
- en = FindNearbyEnemy ();
- if (((en.owner.team != self.team) || !en.team))
- {
- if ((((en.health < 1) || (en.health > 300)) || !en.team))
- {
- return (FALSE);
- }
- if ((self.health > 5))
- {
- self.goalentity = en;
- self.movetarget = en;
- }
- self.enemy = en;
- self.suspicious_about = en.origin;
- self.suspicious_about_time = time;
- self.enemy_notice_time = time;
- self.bot_action = BOT_FIGHTING;
- return (TRUE);
- }
- return (FALSE);
- };
- void () StopFighting =
- {
- if ((self.bot_action == BOT_FIGHTING))
- {
- self.bot_action = BOT_MOVING;
- }
- self.think = BotAnimationThink;
- self.extramove_oldthink = BotAnimationThink;
- self.button0 = FALSE;
- self.button1 = FALSE;
- self.angles_x = 0;
- if (((self.goalentity.classname == "player") || (self.goalentity.classname == "bot")))
- {
- if ((self.goalentity.team != self.team))
- {
- self.goalentity = self;
- self.movetarget = self;
- }
- }
- self.enemy = world;
- };
- void () ContinueFighting =
- {
- if (((((random () * 3) < self.bot_skill) && (self.flags & FL_ONGROUND)) && (self.health < 50)))
- {
- if (((self.frame < 52) || (self.frame >= 62)))
- {
- if ((random () < 0.5))
- {
- self.frame = 52;
- }
- else
- {
- self.frame = 61;
- }
- }
- if ((self.health > 25))
- {
- self.frame = (self.frame + 1);
- }
- else
- {
- self.frame = (self.frame - 1);
- }
- if ((self.health < SVC_SELLSCREEN))
- {
- self.nextjump = 10;
- self.swing = random ();
- if ((random () < 0.5))
- {
- BotFireHookUpRandomly ((vlen ((self.origin - self.enemy.origin)) * 0.5));
- }
- else
- {
- BotFireHookUpRandomly ((vectoyaw ((self.enemy.origin - self.origin)) * 1.5));
- }
- }
- }
- if ((random () < self.bsk_move_while_firing))
- {
- if ((random () < 0.7))
- {
- MoveWhileFiring ();
- }
- else
- {
- BotEvade (world);
- }
- }
- BotLeadTarget (FALSE);
- if (((self.enemy.team == self.team) && (time > self.enemy.invisible_finished)))
- {
- StopFighting ();
- }
- else
- {
- if ((time > self.attack_finished))
- {
- Bot_BestWeapon ();
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- self.lastweapon_shot = self.weapon;
- BotFireWeapon (FALSE);
- }
- }
- };
- void () MoveWhileFiring =
- {
- local float dist;
- local float r;
- local float rad;
- local float moved;
- local entity item;
- local entity e;
- local float chance;
- self.extramove_oldthink = self.think;
- self.extramove_lastframewasextra = FALSE;
- moved = FALSE;
- BotLeadTarget (FALSE);
- if ((self.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((self.team == TEAM_COLOR1))
- {
- e = find (world, classname, "item_flag_team1");
- }
- if ((self.team == TEAM_COLOR2))
- {
- e = find (world, classname, "item_flag_team2");
- }
- if ((e.cnt == 0))
- {
- if ((vlen ((self.origin - e.origin)) < 35))
- {
- self.angles_y = vectoyaw ((e.origin - self.origin));
- if (EntityInFieldOfView (e))
- {
- self.goalentity = e;
- BotMoveTowardTarget ();
- }
- }
- }
- }
- if (!moved)
- {
- if ((random () < self.bsk_move_while_firing))
- {
- rad = 250;
- if ((random () < 0.01))
- {
- rad = (rad + 200);
- }
- dist = rad;
- item = FindNearbyItem (dist);
- if ((((item.origin_z - self.origin_z) > 30) || ((item.origin_z - self.origin_z) < -30)))
- {
- item = world;
- }
- if ((random () < 0.02))
- {
- item = world;
- }
- if ((((item.classname == "mine") || (item.classname == "grenade")) || (item.classname == "missile")))
- {
- if (((item.owner == self) || (item.owner.team != self.team)))
- {
- BotEvade (item);
- }
- }
- if (((item != world) || (item.classname == "light_torch_small_walltorch")))
- BotEvade (item);
- else
- {
- self.goalentity = self.enemy;
- self.movetarget = self.enemy;
- dist = vlen ((self.enemy.origin - self.origin));
- if ((dist > 100))
- {
- if ((self.enemy.player_flag & ITEM_ENEMY_FLAG))
- {
- chance = 0.95;
- }
- else
- {
- chance = 0.8;
- }
- }
- else
- {
- chance = 0.7;
- }
- if ((random () < chance))
- {
- BotMoveTowardTarget ();
- }
- else
- {
- BotEvade (world);
- }
- }
- }
- }
- };
- void () MaybeChangeYaw =
- {
- local float r;
- r = random ();
- makevectors (self.angles);
- traceline ((self.origin + '0 0 22'), ((self.origin + '0 0 22') + (v_forward * 40)), FALSE, self);
- if (((trace_fraction < 1) || (random () < 0.3)))
- {
- if ((r < 0.1))
- {
- self.ideal_yaw = ((self.ideal_yaw + 30) + (((random () * SPAWNFLAG_LASER) - 1) * 50));
- if ((self.ideal_yaw > 360))
- {
- self.ideal_yaw = (self.ideal_yaw - 360);
- }
- if ((self.ideal_yaw < 0))
- {
- self.ideal_yaw = (360 + self.ideal_yaw);
- }
- ChangeYaw ();
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- self.ideal_yaw = (self.ideal_yaw + (((random () * SPAWNFLAG_LASER) - 1) * 10));
- if ((self.ideal_yaw > 360))
- {
- self.ideal_yaw = (self.ideal_yaw - 360);
- }
- if ((self.ideal_yaw < 0))
- {
- self.ideal_yaw = (360 + self.ideal_yaw);
- }
- ChangeYaw ();
- }
- }
- }
- };
- entity (vector org) SpawnTempDebugMarker2 =
- {
- local entity e;
- e = spawn ();
- e.classname = "debug_marker";
- e.owner = self;
- e.origin = org;
- setorigin (e, org);
- e.solid = SOLID_NOT;
- e.movetype = MOVETYPE_NONE;
- setmodel (e, "progs/s_bubble.spr");
- setsize (e, VEC_ORIGIN, VEC_ORIGIN);
- e.nextthink = (time + 0.3);
- e.think = SUB_Remove;
- return (e);
- };
- void (float perfect_accuracy) BotLeadTarget =
- {
- local vector move;
- local vector vlead;
- local vector evec;
- local vector d;
- local vector org;
- local vector eorg;
- local vector err1;
- local vector err2;
- local vector face_vec;
- local vector ang;
- local float fly;
- local float rng;
- local float misjudge_position;
- local float onground;
- local float e;
- local float ez;
- if (((self.enemy.classname == "player") || (self.enemy.classname == "bot")))
- {
- eorg = (self.enemy.origin + '0 0 16');
- evec = self.enemy.velocity;
- if (!(self.enemy.flags & FL_ONGROUND))
- {
- onground = FALSE;
- }
- }
- else
- {
- eorg = (self.enemy.absmax + self.enemy.absmin);
- eorg_x = (eorg_x / SPAWNFLAG_LASER);
- eorg_y = (eorg_y / SPAWNFLAG_LASER);
- eorg_z = (eorg_z / SPAWNFLAG_LASER);
- evec = VEC_ORIGIN;
- }
- org = (self.origin + '0 0 16');
- face_vec = normalize (((eorg + '0 0 8') - org));
- rng = vlen ((org - eorg));
- if (((self.weapon == IT_SHOTGUN) || (self.weapon == IT_SUPER_SHOTGUN)))
- {
- e = 20;
- if (onground)
- {
- ez = 20;
- }
- else
- {
- ez = 50;
- }
- }
- else
- {
- e = 5;
- if (onground)
- {
- ez = 20;
- }
- else
- {
- ez = 50;
- }
- }
- if (!perfect_accuracy)
- {
- err1_x = ((self.bot_skill_inverse * (rng * 0.005)) * (((random () * SPAWNFLAG_LASER) - 1) * e));
- err1_y = ((self.bot_skill_inverse * (rng * 0.005)) * (((random () * SPAWNFLAG_LASER) - 1) * e));
- err1_z = ((self.bot_skill_inverse * (rng * 0.005)) * (((random () * SPAWNFLAG_LASER) - 1) * ez));
- eorg_x = (eorg_x + err1_x);
- eorg_y = (eorg_y + err1_y);
- eorg_z = (eorg_z + err1_z);
- }
- if (!perfect_accuracy)
- {
- err2_x = (self.bot_skill_inverse * (((random () * SPAWNFLAG_LASER) - 1) * (evec_x * 1)));
- err2_y = (self.bot_skill_inverse * (((random () * SPAWNFLAG_LASER) - 1) * (evec_y * 1)));
- err2_z = (self.bot_skill_inverse * (((random () * SPAWNFLAG_LASER) - 1) * (evec_z * SPAWNFLAG_LASER)));
- evec_x = (evec_x + err2_x);
- evec_y = (evec_y + err2_y);
- evec_z = (evec_z + err2_z);
- }
- if (((self.weapon == IT_NAILGUN) || (self.weapon == IT_SUPER_NAILGUN)))
- {
- if ((self.player_flag & ITEM_RUNE3_FLAG))
- {
- fly = (vlen ((eorg - org)) / 2000);
- }
- else
- {
- fly = (vlen ((eorg - org)) / 1000);
- }
- }
- else
- {
- if ((self.weapon == IT_ROCKET_LAUNCHER))
- {
- fly = (vlen ((eorg - org)) / 1000);
- }
- else
- {
- if ((self.weapon == IT_GRENADE_LAUNCHER))
- {
- fly = (vlen ((eorg - org)) / 600);
- }
- else
- {
- fly = 0;
- }
- }
- }
- d = (eorg + (fly * evec));
- if ((bot_debug >= 1))
- {
- SpawnTempDebugMarker2 (d);
- }
- vlead = normalize ((d - org));
- self.bot_aim = vlead;
- ang = vectoangles (face_vec);
- ang_x = (ang_x / 3);
- if ((face_vec_z < 0))
- {
- ang_x = (ang_x * -1);
- }
- if ((ang_x < -26.2))
- {
- ang_x = -26.2;
- }
- if ((ang_x > SVC_TEMPENTITY))
- {
- ang_x = SVC_TEMPENTITY;
- }
- self.angles = ang;
- };
- void (float perfect_accuracy) BotFireWeapon =
- {
- if (!W_CheckNoAmmo ()) return;
- BotLeadTarget (perfect_accuracy);
- self.v_angle = self.angles;
- self.button0 = TRUE;
- if ((self.player_flag & ITEM_ENEMY_FLAG))
- {
- fBotSayTeam (": Need Escort To Base!!!\n");
- powerup ();
- }
- Bot_WeaponFrame ();
- if (self.hooked_on_someone) self.button0 = TRUE;
- };
- void () BotMoveTowardTarget =
- {
- if ((self.enemy == world))
- {
- return;
- }
- BotLeadTarget (FALSE);
- MoveBot ();
- };
- void () DropDown =
- {
- local float r;
- traceline (self.origin, (self.origin + '0 0 -1000'), TRUE, self);
- if ((trace_inopen && trace_inwater))
- {
- if (((pointcontents (trace_endpos) == CONTENT_LAVA) || (pointcontents (trace_endpos) == CONTENT_SLIME)))
- {
- self.bot_blocked = TRUE;
- if ((random () < 0.7))
- {
- r = random ();
- self.angles_y = (self.angles_y + (r * 10));
- }
- else
- {
- self.fire_hook_immediately = TRUE;
- }
- }
- }
- self.button0 = FALSE;
- };
- void (float change_yaw) BotMoveTowardGoal =
- {
- local float should_fire_hook;
- local float chance;
- local vector vyaw;
- local vector goalorg;
- local vector pos;
- should_fire_hook = FALSE;
- if (((self.goalentity != self) && hook_use_enabled))
- {
- chance = 0;
- if (((self.goalentity.origin_z - self.origin_z) > 30))
- {
- chance = 0.04;
- }
- else
- {
- if (((self.goalentity.origin_z - self.origin_z) < -30))
- {
- chance = 0.04;
- }
- else
- {
- if ((vlen ((self.goalentity.origin - self.origin)) > 700))
- {
- chance = 0.04;
- }
- else
- {
- if ((self.get_item_stuck_count > 3))
- {
- chance = 0.04;
- }
- else
- {
- chance = 0.008;
- }
- }
- }
- }
- if ((self.goalentity.classname == "player"))
- {
- chance = 0.1;
- }
- else
- {
- if ((vlen (self.goalentity.velocity) != 0))
- {
- chance = 0.000100;
- }
- }
- if ((self.bot_action == BOT_FIGHTING))
- {
- chance = 0.01;
- }
- if ((random () < chance))
- {
- should_fire_hook = TRUE;
- }
- }
- if (!should_fire_hook)
- {
- if ((self.goalentity != self))
- {
- vyaw = (self.goalentity.origin - self.origin);
- vyaw_z = 0;
- vyaw = normalize (vyaw);
- }
- MoveBot ();
- }
- else
- {
- if ((self.goalentity != self))
- {
- vyaw = (self.goalentity.origin - self.origin);
- vyaw_z = 0;
- vyaw = normalize (vyaw);
- if ((self.goalentity.classname == "player"))
- {
- chance = 0.9;
- }
- if ((self.goalentity.classname == "bot"))
- {
- chance = 0.3;
- }
- else
- {
- chance = 0.1;
- }
- traceline (self.goalentity.origin, (self.goalentity.origin + '0 0 50000'), TRUE, self);
- if ((pointcontents (trace_endpos) == CONTENT_SKY))
- {
- chance = 1;
- }
- if ((random () < chance))
- {
- goalorg = self.goalentity.origin;
- MoveDebugMarker (goalorg);
- self.bot_aim = (goalorg - (self.origin + '0 0 16'));
- self.bot_aim = normalize (self.bot_aim);
- }
- else
- {
- traceline (self.goalentity.origin, (self.goalentity.origin + '0 0 50000'), TRUE, self);
- if (TRUE)
- {
- pos = trace_endpos;
- traceline ((self.origin + '0 0 16'), pos, TRUE, self);
- if ((trace_fraction == 1))
- {
- MoveDebugMarker (pos);
- self.bot_aim = (pos - (self.origin + '0 0 16'));
- self.bot_aim = normalize (self.bot_aim);
- }
- else
- {
- if ((random () < 0.7))
- {
- goalorg = self.goalentity.origin;
- goalorg_x = (goalorg_x + (((random () * SPAWNFLAG_LASER) - 1) * 5));
- goalorg_y = (goalorg_y + (((random () * SPAWNFLAG_LASER) - 1) * 5));
- goalorg_z = (goalorg_z + (((random () * SPAWNFLAG_LASER) - 1) * 5));
- MoveDebugMarker (goalorg);
- self.bot_aim = (goalorg - (self.origin + '0 0 16'));
- self.bot_aim = normalize (self.bot_aim);
- }
- }
- }
- }
- PlayerJump ();
- BotFireHook ();
- }
- }
- };
- void (entity combat_item) BotEvade =
- {
- local float dist;
- local float r;
- local float evade_yaw;
- local float move_blocked;
- local vector targorigin;
- local float oldlefty;
- r = random ();
- if (TRUE)
- {
- if (!smooth_move)
- {
- if ((combat_item != world))
- {
- self.current_evade_yaw = vectoyaw ((combat_item.origin - self.origin));
- targorigin = combat_item.origin;
- }
- else
- {
- self.current_evade_yaw = vectoyaw ((self.enemy.origin - self.origin));
- if ((random () < 0.03))
- {
- self.lefty = !self.lefty;
- }
- else
- {
- if ((random () < 0.01))
- {
- oldlefty = self.lefty;
- self.lefty = 3;
- }
- }
- if ((self.lefty == 3))
- {
- self.current_evade_yaw = (self.current_evade_yaw + 180);
- self.lefty = oldlefty;
- }
- else
- {
- if (self.lefty)
- {
- self.current_evade_yaw = (self.current_evade_yaw + 90);
- }
- else
- {
- self.current_evade_yaw = (self.current_evade_yaw - 90);
- }
- }
- self.current_evade_yaw = (self.current_evade_yaw + (((random () * SPAWNFLAG_LASER) - 1) * 10));
- targorigin = self.goalentity.origin;
- }
- if ((self.current_evade_yaw < 0))
- {
- self.current_evade_yaw = (self.current_evade_yaw + 360);
- }
- if ((self.current_evade_yaw >= 360))
- {
- self.current_evade_yaw = (self.current_evade_yaw - 360);
- }
- dist = GetMoveDist ((targorigin - self.origin));
- move_blocked = !BotWalkMove (self.current_evade_yaw, dist);
- if (move_blocked)
- {
- self.lefty = !self.lefty;
- }
- }
- else
- {
- makevectors (self.angles);
- self.velocity = (self.velocity + (normalize (v_right) * 640));
- }
- }
- };
- void () SetBotWaterLevel =
- {
- local vector start;
- local vector end;
- local float wlevel;
- local float wtype;
- local float fc;
- local float wc;
- local float ec;
- wlevel = 0;
- wtype = -1;
- fc = pointcontents ((self.origin + '0 0 -23'));
- wc = pointcontents ((self.origin + '0 0 4'));
- ec = pointcontents ((self.origin + '0 0 22'));
- if ((((fc != -1) || (wc != -1)) || (ec != -1)))
- {
- if ((((fc == CONTENT_WATER) || (wc == CONTENT_WATER)) || (ec == CONTENT_WATER)))
- {
- wlevel = 1;
- wtype = CONTENT_WATER;
- if ((wc == CONTENT_WATER))
- {
- wlevel = SPAWNFLAG_LASER;
- }
- if ((ec == CONTENT_WATER))
- {
- wlevel = 3;
- }
- }
- else
- {
- if ((((fc == CONTENT_SLIME) || (wc == CONTENT_SLIME)) || (ec == CONTENT_SLIME)))
- {
- wlevel = 1;
- wtype = CONTENT_SLIME;
- if ((wc == CONTENT_SLIME))
- {
- wlevel = SPAWNFLAG_LASER;
- }
- if ((ec == CONTENT_SLIME))
- {
- wlevel = 3;
- }
- }
- else
- {
- if ((((fc == CONTENT_LAVA) || (wc == CONTENT_LAVA)) || (ec == CONTENT_LAVA)))
- {
- wlevel = 1;
- wtype = CONTENT_LAVA;
- if ((wc == CONTENT_LAVA))
- {
- wlevel = SPAWNFLAG_LASER;
- }
- if ((ec == CONTENT_LAVA))
- {
- wlevel = 3;
- }
- }
- }
- }
- }
- self.waterlevel = wlevel;
- self.watertype = wtype;
- };
- void () BotPreThink =
- {
- if (self.bot_type == "rbot")
- return;
- self.message = "PRETHINK";
- CheckRules ();
- SetBotWaterLevel ();
- self.old_waterlevel = self.waterlevel;
- self.old_watertype = self.watertype;
- WaterMove ();
- self.waterlevel = self.old_waterlevel;
- self.watertype = self.old_watertype;
- if ((self.health <= 0))
- {
- //self.think = PlayerDie;
- }
- else
- {
- if ((self.waterlevel == SPAWNFLAG_LASER))
- {
- CheckWaterJump ();
- }
- }
- if (((self.nextthink < (time - 1)) && self.health)|| (self.nextthink > (time +1)) && self.health)
- self.nextthink = time + 0.2;
- };
- void () checkyaw =
- {
- local vector los;
- local vector los_angles;
- local float o_range;
- local float missile_factor;
- local vector spotty_squid;
- o_range = vlen ((self.enemy.origin - self.origin));
- if (self.weapon == IT_ROCKET_LAUNCHER || self.weapon == IT_NAILGUN || self.weapon == IT_SUPER_NAILGUN || self.weapon == IT_HOOK)
- {
- missile_factor = (o_range / (1900 + (random () * 700)));
- }
- else
- {
- if ((self.weapon == IT_GRENADE_LAUNCHER))
- {
- missile_factor = (o_range / (1000 + (random () * 50)));
- }
- else
- {
- missile_factor = 0;
- }
- }
- if ((o_range > 300))
- {
- spotty_squid = ('9 9 8' * (random () - 0.5));
- }
- else spotty_squid = VEC_ORIGIN;
- if (self.altweap)
- spotty_squid = '15 15 15';
- los = (((self.enemy.origin - self.origin) + (self.enemy.velocity * missile_factor)) + spotty_squid);
- los_angles = vectoangles (los);
- self.ideal_pitch = los_angles_x;
- if ((self.ideal_pitch > 180))
- {
- self.ideal_pitch = (self.ideal_pitch - 360);
- }
- ChangePitch ();
- };
- void () BotPostThink =
- {
- self.message = "POSTTHINK";
- if ((((self.jump_flag < -300) && (self.flags & FL_ONGROUND)) && (self.health > 0)))
- {
- if (((self.watertype == CONTENT_WATER) && (self.waterlevel < 1)))
- {
- if (((self.sex == SPAWNFLAG_LASER) && (temp1 & TEMP1_PLAYER2SOUNDS)))
- {
- sound (self, CHAN_BODY, "player_f/h2ojump.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
- {
- sound (self, CHAN_BODY, "player3/h2ojump.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
- {
- sound (self, CHAN_BODY, "player4/h2ojump.wav", 1, ATTN_NORM);
- }
- else
- {
- sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
- }
- }
- }
- }
- else
- {
- if ((self.jump_flag < -650))
- {
- if (!(deathmatch & DM_NO_FALLING))
- {
- T_Damage (self, world, world, 5);
- }
- if (((self.sex == SPAWNFLAG_LASER) && (temp1 & TEMP1_PLAYER2SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player_f/land2.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player3/land2.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player4/land2.wav", 1, ATTN_NORM);
- }
- else
- {
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- }
- }
- }
- self.deathtype = "falling";
- }
- else
- {
- if (((self.sex == SPAWNFLAG_LASER) && (temp1 & TEMP1_PLAYER2SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player_f/land.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 3) && (temp1 & TEMP1_PLAYER3SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player3/land.wav", 1, ATTN_NORM);
- }
- else
- {
- if (((self.sex == 4) && (temp1 & TEMP1_PLAYER4SOUNDS)))
- {
- sound (self, CHAN_VOICE, "player4/land.wav", 1, ATTN_NORM);
- }
- else
- {
- sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
- }
- }
- }
- }
- }
- self.jump_flag = 0;
- }
- if (!(self.flags & FL_ONGROUND))
- {
- self.jump_flag = self.velocity_z;
- }
- CheckPowerups ();
- if (((self.nextthink < (time - 1)) && self.health)|| (self.nextthink > (time +1)) && self.health)
- self.nextthink = time + 0.2;
- };
- float (float enemy_base, float change_yaw) MoveTowardBase =
- {
- local entity e;
- local float team_lo;
- local float team_hi;
- local float fteam;
- if ((time < self.next_waypoint_time))
- {
- return (FALSE);
- }
- self.next_waypoint_time = (time + 0.35);
- if (enemy_base)
- {
- team_lo = self.enemy_team;
- team_hi = self.team;
- }
- else
- {
- team_lo = self.team;
- team_hi = self.enemy_team;
- }
- if ((self.goalentity.classname == "waypoint"))
- {
- if (!(((self.use_defensive_way == 1) && (self.bot_plan == BOT_DEFEND)) && (team_lo == self.team)))
- {
- if ((self.goalentity.team == team_lo))
- {
- if ((self.goalentity.waypoint_num == 0))
- {
- BotMoveTowardGoal (change_yaw);
- return (TRUE);
- }
- }
- }
- if ((((self.use_defensive_way == 1) && (self.bot_plan == BOT_DEFEND)) && (team_lo == self.team)))
- {
- if ((self.goalentity.waypoint_num == -1))
- {
- BotMoveTowardGoal (change_yaw);
- return (TRUE);
- }
- }
- }
- e = BotFindLeastWaypoint (team_lo);
- if ((e != world))
- {
- self.goalentity = e;
- self.movetarget = e;
- self.enemy = world;
- BotMoveTowardGoal (change_yaw);
- return (TRUE);
- }
- else
- {
- e = BotFindGreatestWaypoint (team_hi);
- if ((e != world))
- {
- self.goalentity = e;
- self.movetarget = e;
- self.enemy = world;
- BotMoveTowardGoal (change_yaw);
- return (TRUE);
- }
- else
- {
- e = BotFindLeastWaypoint (-1);
- if ((e != world))
- {
- self.goalentity = e;
- self.movetarget = e;
- self.enemy = world;
- BotMoveTowardGoal (change_yaw);
- return (TRUE);
- }
- }
- }
- return (FALSE);
- };
- float (float fteam) NumBotsDefending =
- {
- local entity p;
- local float nm;
- nm = 0;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- if ((p.bot_plan == BOT_DEFEND))
- {
- nm = (nm + 1);
- }
- }
- p = find (p, classname, "bot");
- }
- return (nm);
- };
- float () MaybeGoToTempWaypoint =
- {
- local entity e;
- e = BotFindClosestTempWaypoint (self.team);
- if ((e != world))
- {
- self.goalentity = e;
- self.movetarget = e;
- self.enemy = world;
- BotMoveTowardGoal (TRUE);
- return (TRUE);
- }
- return (FALSE);
- };
- void () SetBotPlan =
- {
- local entity flag;
- local entity eflag;
- local float nm;
- local float r;
- local float oldplan;
- local float numbots;
- local entity f;
- local entity e;
- oldplan = self.bot_plan;
- if ((time < (self.camping_time + CAMPING_TIME)))
- return;
- if ((time < (self.escort_time + ESCORT_TIME)))
- return;
- if ((time > qtr_3))
- {
- if (self.team == TEAM_COLOR2)
- {
- f = find (world, classname, "item_flag_team2");
- if (f.cnt == 0 && captures_red > captures_blue)
- {
- if (self.bot_action != BOT_FIGHTING && visible(f))
- if (random() < 0.2)
- fBotSayTeam (": Our Base is Clear, I'm attacking....\n");
- else if (self.bot_action == BOT_FIGHTING && visible(f))
- fBotSayTeam (": Base Defenses Compromised!!\n");
- self.bot_plan = BOT_ATTACK;
- }
- if ((self.reserve > 0))
- powerup ();
- return;
- }
- }
- if (self.team == TEAM_COLOR1)
- {
- f = find (world, classname, "item_flag_team1");
- if ((f.cnt == 0 && captures_red < captures_blue))
- {
- if (self.bot_action != BOT_FIGHTING && visible(f))
- if (random() < 0.2)
- fBotSayTeam (": Our Base is Clear, I'm attacking....\n");
- else if (self.bot_action == BOT_FIGHTING && visible(f))
- fBotSayTeam (": Base Defenses Compromised!!\n");
- self.bot_plan = BOT_ATTACK;
- }
- if ((self.reserve > 0))
- powerup ();
- return;
- }
- if ((time < qtr_1))
- {
- if ((time < (cvar ("timelimit") * 8)))
- if (random() < 0.65)
- {
- self.bot_plan = BOT_ATTACK;
- return;
- }
- if (self.team == TEAM_COLOR2)
- {
- e = find (world, classname, "item_flag_team2");
- if ((e.cnt == 0 && captures_red > captures_blue))
- {
- if (self.bot_action != BOT_FIGHTING && visible(e))
- if (random() < 0.2)
- fBotSayTeam (": Our Base is Clear, I'm attacking....\n");
- else if (self.bot_action == BOT_FIGHTING && visible(e))
- fBotSayTeam (": Base Defenses Compromised!!\n");
- self.bot_plan = BOT_ATTACK;
- return;
- }
- else if (self.bot_plan == BOT_ATTACK)
- {
- if (((self.repeat > time) && (random () < 0.3)))
- {
- fBotSayTeam (": I'm On Defense Now, Heading to Base...\n");
- self.bot_plan = BOT_DEFEND;
- return;
- }
- else if (visible(e)&& e.cnt == 0 && self.bot_action != BOT_FIGHTING)
- fBotSayTeam (": Base is Clear...\n");
- return;
- }
- if (self.team == TEAM_COLOR1)
- {
- e = find (world, classname, "item_flag_team1");
- if ((e.cnt == 0 && captures_red < captures_blue))
- {
- if (self.bot_action != BOT_FIGHTING && visible(e))
- if (random() < 0.2)
- fBotSayTeam (": Our Base is Clear, I'm attacking....\n");
- else if (self.bot_action == BOT_FIGHTING && visible(e))
- fBotSayTeam (": Base Defenses Compromised!!\n");
- self.bot_plan = BOT_ATTACK;
- return;
- }
- else if (self.bot_plan == BOT_ATTACK)
- {
- fBotSayTeam (": I'm On Defense Now, Heading to Base...\n");
- self.bot_plan = BOT_DEFEND;
- return;
- }
- else if (visible(e)&& e.cnt == 0 && self.bot_action != BOT_FIGHTING)
- fBotSayTeam (": Base is Clear...\n");
- return;
- }
- }
- if (IsHumanOnTeam (self.team))
- {
- if ((random () < 0.9))
- {
- return;
- }
- }
- if ((self.team == TEAM_COLOR1))
- {
- flag = find (world, classname, "item_flag_team1");
- eflag = find (world, classname, "item_flag_team2");
- numbots = next_bot_red;
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- flag = find (world, classname, "item_flag_team2");
- eflag = find (world, classname, "item_flag_team1");
- numbots = next_bot_blue;
- }
- }
- if ((self.bot_plan == BOT_ATTACK))
- {
- nm = NumBotsDefending (self.team);
- if (((nm < (numbots / SPAWNFLAG_LASER)) && ((flag.cnt == 0) || (eflag.cnt == FLAG_CARRIED))))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_DEFEND;
- }
- }
- else
- {
- if ((self.player_flag & ITEM_RUNE3_FLAG))
- {
- if ((random () < 0.01))
- {
- self.bot_plan = BOT_DEFEND;
- }
- }
- else
- {
- if ((self.player_flag & ITEM_RUNE4_FLAG))
- {
- if ((random () < 0.01))
- {
- self.bot_plan = BOT_DEFEND;
- }
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_DEFEND;
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_ROAM;
- }
- }
- }
- }
- }
- }
- else
- {
- if ((self.bot_plan == BOT_DEFEND))
- {
- if ((((time < self.super_damage_finished) || (time < self.invisible_finished)) || (time < self.invincible_finished)))
- {
- self.bot_plan = BOT_ATTACK;
- }
- else
- {
- if (((time < (last_flag_capture + 10)) && (self.team == last_capture_team)))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- else
- {
- if (((flag.cnt == FLAG_CARRIED) && (eflag.cnt == FLAG_CARRIED)))
- {
- if (!(self.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- }
- else
- {
- if ((self.player_flag & ITEM_RUNE1_FLAG))
- {
- if ((random () < 0.01))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- else
- {
- if ((self.player_flag & ITEM_RUNE2_FLAG))
- {
- if ((random () < 0.01))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_ATTACK;
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_ROAM;
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- nm = NumBotsDefending (self.team);
- if ((((time < self.super_damage_finished) || (time < self.invisible_finished)) || (time < self.invincible_finished)))
- {
- self.bot_plan = BOT_ATTACK;
- }
- else
- {
- if (((nm < (numbots / SPAWNFLAG_LASER)) && ((flag.cnt == 0) || (eflag.cnt == FLAG_CARRIED))))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_DEFEND;
- }
- }
- else
- {
- if (((flag.cnt == FLAG_CARRIED) && (eflag.cnt == FLAG_CARRIED)))
- {
- if (!(self.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- }
- else
- {
- if (((time < (last_flag_capture + 10)) && (self.team == last_capture_team)))
- {
- if ((random () < 0.02))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_DEFEND;
- }
- else
- {
- if ((random () < 0.001))
- {
- self.bot_plan = BOT_ATTACK;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- float () SetSpecialGoals =
- {
- local entity p;
- local entity e;
- local float maxrad;
- local float moved;
- local entity old_goal;
- moved = FALSE;
- if ((map_has_waypoints && (self.player_flag & ITEM_ENEMY_FLAG)))
- {
- moved = MoveTowardBase (0, TRUE);
- }
- if (!moved)
- {
- e = HelpTeammate (self, 600);
- if ((e != world))
- {
- if ((e.classname == "follow_ent"))
- {
- old_goal = self.goalentity;
- self.goalentity = e;
- self.movetarget = e;
- BotMoveTowardGoal (TRUE);
- self.goalentity = old_goal;
- self.movetarget = old_goal;
- return (TRUE);
- }
- else
- {
- if ((vlen ((e.origin - self.origin)) > 150))
- {
- self.goalentity = e;
- self.movetarget = e;
- self.enemy = world;
- if ((e.classname == "player"))
- {
- if (((self.escort_entity == e) || (e.observer_flags & PLAYER_ALWAYS_ESCORT)))
- {
- BotSayEscort (e);
- }
- }
- BotMoveTowardGoal (TRUE);
- return (TRUE);
- }
- }
- }
- else
- {
- if ((time < (self.camping_time + CAMPING_TIME)))
- {
- self.goalentity = self.camping_entity;
- self.movetarget = self.camping_entity;
- self.enemy = world;
- BotMoveTowardGoal (TRUE);
- return (TRUE);
- }
- else
- {
- if (map_has_waypoints)
- {
- SetBotPlan ();
- if ((self.bot_plan == BOT_ATTACK))
- {
- moved = MoveTowardBase (ENEMY_BASE, TRUE);
- }
- if (!moved)
- {
- if ((self.bot_plan == BOT_DEFEND))
- {
- moved = MoveTowardBase (0, TRUE);
- }
- }
- }
- }
- }
- }
- return (moved);
- };
- void (float old_dist, entity goal_item) CheckStuck =
- {
- if ((goal_item != world))
- {
- if (((old_dist - vlen ((self.origin - goal_item.origin))) < 5))
- {
- self.get_item_stuck_count = (self.get_item_stuck_count + 1);
- if (((self.get_item_stuck_count > 10) && (num_inaccessible_entities < 5)))
- {
- self.get_item_stuck_count = 0;
- SpawnInaccessibleFromHere (goal_item);
- }
- }
- }
- };
- float () MaybeGetItems =
- {
- local entity item;
- local float dist;
- local float old_dist;
- if ((time > self.large_dist_pulse_items))
- {
- self.large_dist_pulse_items = (time + self.bsk_next_pulse_time_items);
- dist = item_large_pulse_dist;
- if ((random () < 0.02))
- {
- dist = (dist + self.bsk_extra_large_pulse_dist);
- }
- }
- else
- {
- dist = item_awareness_dist;
- }
- item = FindNearbyItem (dist);
- if ((item != world))
- {
- if ((item != self.goalentity))
- {
- self.get_item_stuck_count = 0;
- }
- self.goalentity = item;
- self.movetarget = item;
- self.enemy = world;
- old_dist = vlen ((self.origin - self.goalentity.origin));
- BotMoveTowardGoal (TRUE);
- CheckStuck (old_dist, self.goalentity);
- return (TRUE);
- }
- return (FALSE);
- };
- float (float force_search) MaybeShootTriggers =
- {
- local entity selected;
- local entity e;
- local float dist;
- local float best_dist;
- local vector org;
- local vector selected_org;
- local entity old_enemy;
- if (((time < self.trigger_search_time) && !force_search))
- {
- return (FALSE);
- }
- self.trigger_search_time = (time + (TE_WIZSPIKE * (random () * 5)));
- dist = 150;
- dist = (dist + 400);
- best_dist = 1000000000;
- e = find (world, classname, "door");
- while (e)
- {
- org = (e.absmin + e.absmax);
- org_x = (org_x / SPAWNFLAG_LASER);
- org_y = (org_y / SPAWNFLAG_LASER);
- org_z = (org_z / SPAWNFLAG_LASER);
- if (BotCanSeePoint (org))
- {
- if ((vlen ((self.origin - org)) < best_dist))
- {
- if ((e.health > 0))
- {
- selected = e;
- selected_org = org;
- best_dist = vlen ((self.origin - org));
- }
- }
- }
- e = find (e, classname, "door");
- }
- if (((selected != world) && (random () < 0.8)))
- {
- best_dist = 1000000000;
- e = find (world, classname, "func_button");
- while (e)
- {
- org = e.origin;
- if (BotCanSeePoint (org))
- {
- if ((vlen ((self.origin - org)) < best_dist))
- {
- if ((e.health > 0))
- {
- selected = e;
- selected_org = org;
- best_dist = vlen ((self.origin - org));
- }
- }
- }
- e = find (e, classname, "func_button");
- }
- }
- if ((selected != world))
- {
- if ((random () < 0.5))
- {
- old_enemy = self.enemy;
- self.enemy = selected;
- if (((time > self.attack_finished) && (self.ammo_shells > 0)))
- {
- self.weapon = IT_SHOTGUN;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- BotFireWeapon (TRUE);
- if ((selected.classname == "door"))
- {
- SpawnTempWaypoint (selected_org, 5, self.team);
- }
- }
- self.enemy = old_enemy;
- return (TRUE);
- }
- }
- return (FALSE);
- };
- float (entity newwp, entity oldwp) WaypointBetter =
- {
- if ((oldwp == world))
- {
- return (TRUE);
- }
- if ((oldwp.health > 1))
- {
- self.enemy = oldwp;
- }
- if ((newwp.health > 1))
- {
- self.enemy = newwp;
- }
- if ((newwp.path_1 || newwp.path_2))
- {
- dprint (self.netname);
- dprint (" choosing path ");
- if ((random () < 0.5))
- {
- //self.angles_y = oldwp.path_1;
- }
- else
- {
- //self.angles_y = oldwp.path_2;
- }
- }
- if ((self.bot_plan == BOT_ATTACK))
- {
- if (((newwp.team == self.team) && (oldwp.team == self.team)))
- {
- if ((newwp.waypoint_num == oldwp.waypoint_num))
- {
- vlen ((newwp.origin - self.origin));
- if ((vlen ((oldwp.origin - self.origin)) < vlen ((oldwp.origin - self.origin))))
- {
- return (TRUE);
- }
- }
- else
- {
- if ((newwp.waypoint_num < oldwp.waypoint_num))
- {
- return (FALSE);
- }
- else
- {
- if ((newwp.waypoint_num > oldwp.waypoint_num))
- {
- return (TRUE);
- }
- }
- }
- }
- else
- {
- if (((newwp.team == self.team) && (oldwp.team != self.team)))
- {
- return (FALSE);
- }
- else
- {
- if (((newwp.team != self.team) && (oldwp.team == self.team)))
- {
- return (TRUE);
- }
- else
- {
- if (((newwp.team != self.team) && (oldwp.team != self.team)))
- {
- if ((newwp.waypoint_num == oldwp.waypoint_num))
- {
- vlen ((newwp.origin - self.origin));
- if ((vlen ((oldwp.origin - self.origin)) < vlen ((oldwp.origin - self.origin))))
- {
- return (TRUE);
- }
- }
- else
- {
- if ((newwp.waypoint_num < oldwp.waypoint_num))
- {
- return (TRUE);
- }
- else
- {
- if ((newwp.waypoint_num > oldwp.waypoint_num))
- {
- return (FALSE);
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((self.bot_plan == BOT_DEFEND))
- {
- if (((newwp.team == self.team) && (oldwp.team == self.team)))
- {
- if ((newwp.waypoint_num == oldwp.waypoint_num))
- {
- vlen ((newwp.origin - self.origin));
- if ((vlen ((oldwp.origin - self.origin)) < vlen ((oldwp.origin - self.origin))))
- {
- return (TRUE);
- }
- }
- else
- {
- if ((newwp.waypoint_num < oldwp.waypoint_num))
- {
- return (TRUE);
- }
- else
- {
- if ((newwp.waypoint_num > oldwp.waypoint_num))
- {
- return (FALSE);
- }
- }
- }
- }
- else
- {
- if (((newwp.team == self.team) && (oldwp.team != self.team)))
- {
- return (TRUE);
- }
- else
- {
- if (((newwp.team != self.team) && (oldwp.team == self.team)))
- {
- return (FALSE);
- }
- else
- {
- if (((newwp.team != self.team) && (oldwp.team != self.team)))
- {
- if ((newwp.waypoint_num == oldwp.waypoint_num))
- {
- vlen ((newwp.origin - self.origin));
- if ((vlen ((oldwp.origin - self.origin)) < vlen ((oldwp.origin - self.origin))))
- {
- return (TRUE);
- }
- }
- else
- {
- if ((newwp.waypoint_num < oldwp.waypoint_num))
- {
- return (FALSE);
- }
- else
- {
- if ((newwp.waypoint_num > oldwp.waypoint_num))
- {
- return (TRUE);
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((random () < 0.3))
- {
- return (TRUE);
- }
- }
- }
- return (FALSE);
- };
- float () FireHookAtBestOutOfWaterWaypoint =
- {
- local float best_dist;
- local vector selected_pos;
- local entity e;
- local entity selected;
- local entity selected_wp;
- local vector pos;
- local float wp_better;
- selected_pos = VEC_ORIGIN;
- selected_wp = world;
- best_dist = 10000000000;
- e = find (world, classname, "waypoint");
- while ((e != world))
- {
- if (visible (e))
- {
- if ((pointcontents (e.origin) != CONTENT_WATER))
- {
- if ((pointcontents (e.origin) != CONTENT_SLIME))
- {
- if ((pointcontents (e.origin) != CONTENT_LAVA))
- {
- traceline (e.origin, (e.origin + '0 0 50000'), TRUE, self);
- pos = trace_endpos;
- if (BotCanSeePointThroughWater (pos))
- {
- wp_better = WaypointBetter (e, selected_wp);
- if ((wp_better || (selected_pos == VEC_ORIGIN)))
- {
- selected_pos = pos;
- selected_wp = e;
- self.angles_x = vectoyaw ((e.origin - self.origin));
- e.velocity = ((self.origin - e.origin) * 0.45);
- e.nextthink = (time + 6);
- best_dist = vlen ((e.origin - self.origin));
- }
- }
- }
- }
- }
- }
- e = find (e, classname, "waypoint");
- }
- if ((selected_pos != VEC_ORIGIN))
- {
- MoveDebugMarker (selected_pos);
- self.bot_aim = (selected_pos - (self.origin + '0 0 16'));
- self.bot_aim = normalize (self.bot_aim);
- self.swing = (random () * 0.9);
- PlayerJump ();
- BotFireHook ();
- if ((e.angles != VEC_ORIGIN))
- {
- self.angles = e.angles;
- BotFireHook ();
- }
- return (TRUE);
- }
- return (FALSE);
- };
- void (entity ent) BotFireHookAtEntity =
- {
- local vector org;
- if (!hook_use_enabled)
- {
- return;
- }
- if ((time > self.attack_finished))
- {
- org = ent.origin;
- MoveDebugMarker (org);
- self.bot_aim = (org - self.origin);
- self.bot_aim = normalize (self.bot_aim);
- self.swing = 0.55;
- BotFireHook ();
- }
- };
- void (float zdist) BotFireHookUpRandomly =
- {
- local vector org;
- //bprint(self.netname);
- //bprint("BotFireHookUpRandomly\n");
- if (!hook_use_enabled)
- return;
- if ((time > self.attack_finished))
- {
- org = self.origin;
- org_z = (org_z + zdist);
- org_x = (org_x + (((random () * -1) - 1) * 25));
- org_y = (org_y + (((random () * -1) - 1) * 25));
- if ((random () < 0.5))
- {
- org_x = (org_x * -1);
- }
- if ((random () < 0.5))
- {
- org_y = (org_y * -1);
- }
- if ((random () < 0.5))
- {
- org_z = (org_z * -1);
- }
- MoveDebugMarker (org);
- self.bot_aim = (org - self.origin);
- self.bot_aim = normalize (self.bot_aim);
- self.goalentity = self.debug_marker;
- BotFireHook ();
- }
- };
- float () MaybeGetOutOfWater =
- {
- if (self.hook_out) return (FALSE);
- if ((time < self.getoutofwater_time)) return (FALSE);
- self.getoutofwater_time = (time + 1);
- if ((self.watertype == CONTENT_WATER))
- {
- if ((self.waterlevel == 3))
- {
- if (FireHookAtBestOutOfWaterWaypoint ())
- {
- return (TRUE);
- }
- }
- }
- return (FALSE);
- };
- float () MaybeTryNotToDrown =
- {
- if (self.waterlevel < 3) return(0);
- local entity e;
- local float r;
- if (((self.watertype == CONTENT_WATER) || (self.flags == FL_INWATER)))
- {
- if ((self.air_finished - 4) < time)
- {
- self.flags = (self.flags - (self.flags & FL_ONGROUND));
- if (!FireHookAtBestOutOfWaterWaypoint ())
- {
- local entity x;
- x = FindNearbyItem(random() * 500);
- if (visible(x))
- BotFireHookAtEntity(x);
- else
- {
- BotFireHookUpRandomly (random() * 1500);
- wall_look ();
- }
- }
- return (TRUE);
- }
- }
- else
- {
- if (((self.watertype == CONTENT_SLIME) || (self.watertype == CONTENT_LAVA)))
- {
- self.bot_blocked = TRUE;
- if (!FireHookAtBestOutOfWaterWaypoint () && self.watertype == CONTENT_SLIME)
- {
- wall_look ();
- BotFireHook ();
- }
- if (!FireHookAtBestOutOfWaterWaypoint ())
- BotFireHookUpRandomly (1500);
- return (TRUE);
- }
- }
- return (FALSE);
- };
- float () MaybeFireHook =
- {
- if ((random () < 0.003))
- {
- if ((time > self.attack_finished))
- {
- BotFireHook ();
- return (TRUE);
- }
- }
- return (FALSE);
- };
- float () BotCanSeeHisFlagAtBase =
- {
- local entity flag;
- if ((self.team == TEAM_COLOR1))
- {
- flag = find (world, classname, "item_flag_team1");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- flag = find (world, classname, "item_flag_team2");
- }
- }
- if ((self.bot_plan == BOT_DEFEND))
- {
- if ((flag.cnt == 0))
- {
- if (BotCanSeeItem (flag))
- {
- return (TRUE);
- }
- }
- }
- return (FALSE);
- };
- float () BotShouldStand =
- {
- if ((self.bot_plan == BOT_DEFEND))
- {
- if (BotCanSeeHisFlagAtBase ())
- {
- if ((random () < 0.3))
- {
- dprint (self.netname);
- dprint (" decides to stand\n");
- return (TRUE);
- }
- }
- }
- if ((random () < 0.003))
- {
- return (TRUE);
- }
- return (FALSE);
- };
- void () NothingToDo =
- {
- MaybeChangeYaw ();
- self.trigger_search_time = (time + (TE_WIZSPIKE * (random () * 5)));
- MaybeShootTriggers (FALSE);
- MoveBot ();
- };
- void () CheckGiveUpCamping =
- {
- if (((time < (self.camping_time + CAMPING_TIME)) && (self.camping_entity != world)))
- {
- if (BotCanSeeItem (self.camping_entity))
- {
- self.last_see_camp_ent = time;
- }
- else
- {
- if ((time > (self.last_see_camp_ent + 30)))
- {
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I'm going to stop camping");
- BotSayTeamEnd ();
- self.camping_time = (time - 999);
- remove (self.camping_entity);
- self.camping_entity = world;
- }
- }
- }
- };
- entity (vector org) SpawnDebugMarker =
- {
- local entity e;
- e = spawn ();
- e.classname = "debug_marker";
- e.owner = self;
- e.origin = org;
- setorigin (e, org);
- e.solid = SOLID_NOT;
- e.movetype = MOVETYPE_NONE;
- setmodel (e, string_null);
- setsize (e, VEC_ORIGIN, VEC_ORIGIN);
- return (e);
- };
- void () BotThink =
- {
- if (self.bot_type == "rbot")
- return;
- local float visi;
- local entity follow_ent;
- local entity old_goal;
- self.yaw_speed = 15;
- self.message = "THINK";
- if (self.ltime == 120)
- {
- BotSayLetsGetEm();
- self.ltime = (time + 120);
- }
- if ((pointcontents ((self.origin + '0 0 10')) == CONTENT_SOLID))
- {
- BotIsDead();
- return;
- }
- if ((self.goalentity.classname == "waypoint"))
- {
- self.goalentity.nextjump = (self.goalentity.nextjump + 1);
- if (EntityInFieldOfView (self.goalentity))
- {
- self.goalentity.velocity = (self.goalentity.velocity * 0.66);
- }
- if ((self.goalentity.nextjump > 90))
- {
- self.goalentity.nextthink = (time + 0.33);
- }
- }
- if ((bot_dump == 50))
- return;
- if (self.timing < 0.33)
- {
- if (self.bot_action == BOT_FIGHTING || (self.player_flag & ITEM_ENEMY_FLAG))
- {
- if (random() < 0.33)
- self.nextthink = (time + (sys_ticrate * 2));
- }
- else
- {
- self.nextthink = (time + (sys_ticrate * 3));
- }
- }
- if ((pointcontents (self.origin) == CONTENT_WATER))
- {
- self.pattern = 0;
- if ((pointcontents (self.origin + '0 0 18') == CONTENT_WATER))
- {
- if ((self.flags & !FL_SWIM))
- {
- self.flags = (self.flags + FL_SWIM);
- }
- self.movetype = MOVETYPE_FLY;
- self.yaw_speed = 60;
- }
- }
- else
- {
- self.movetype = MOVETYPE_WALK;
- if ((self.flags & FL_SWIM))
- self.flags = (self.flags - FL_SWIM);
- }
- if (((self.attacked > time) && (self.bot_action != BOT_FIGHTING)))
- {
- makevectors (self.angles);
- self.angles_y = vectoyaw (self.turn);
- if ((EntityInFieldOfView (self.enemy) && (self.attack_finished < time)))
- {
- checkyaw ();
- MaybeFight ();
- }
- else
- self.attacked = 0;
- }
- else
- self.turn = '0 0 0';
- if ((self.hooked_on_someone || (self.imhooked > time)))
- {
- self.weapon = Bot_BestWeapon ();
- checkyaw ();
- }
- if (time < (self.suspicious_about_time + 4))
- {
- if (self.bot_action == BOT_FIGHTING && self.enemy.health > 0)
- self.angles_y = vectoyaw ((self.enemy.origin - self.origin));
- else
- {
- if (!visible (self.enemy))
- self.angles_y = vectoyaw ((self.suspicious_about - self.origin));
- checkyaw();
- }
- if (((self.flags == FL_ONGROUND) && (random () < 0.5)))
- {
- self.yaw_speed = (self.yaw_speed * 2);
- if ((self.flags == FL_ONGROUND))
- self.frame = 13;
- }
- if (((self.weapon == IT_GRENADE_LAUNCHER) || (self.weapon == IT_ROCKET_LAUNCHER)))
- {
- //EntityInFieldOfView (self.enemy);
- if ((EntityInFieldOfView (self.enemy) && (self.attack_finished < time)))
- {
- if ((self.enemy.health > 0))
- {
- Bot_Attack ();
- }
- }
- }
- }
- else
- {
- self.yaw_speed = 100;
- }
- if (((self.repeat > time) && (random () < 0.8)))
- {
- sound (self, CHAN_BODY, "misc/talk.wav", 1, ATTN_NONE);
- bprint (self.talkname);
- bprint ("º ");
- BotSayMiddle (self.repeated);
- }
- if ((!self.goalentity && !(self.flags & FL_SWIM)))
- {
- if (!FireHookAtBestOutOfWaterWaypoint ())
- {
- wall_look ();
- }
- }
- if (((self.waterlevel > SPAWNFLAG_LASER) && (self.bot_action != BOT_FIGHTING)))
- {
- EntityInFieldOfView (self.goalentity);
- if ((BotCanSeePlayer (self.goalentity) && BotCanSeePlayer (self.goalentity)))
- {
- self.velocity = (self.goalentity.origin - self.origin);
- }
- if ((self.goalentity.origin_z > self.origin_z))
- {
- self.velocity_z = (self.velocity_z + 3);
- }
- if ((self.goalentity.origin_z < self.origin_z))
- {
- self.velocity_z = (self.velocity_z + 3);
- }
- }
- self.extramove_oldthink = self.think;
- self.extramove_lastframewasextra = FALSE;
- if ((self.health <= 0))
- {
- self.think = BotRespawn;
- self.nextthink = ((time + 1) + (random () * 4));
- return;
- }
- //BotPreThink ();
- if (self.timing > 0.33 && self.timing < 0.66)
- {
- if (self.bot_action == BOT_FIGHTING || (self.player_flag & ITEM_ENEMY_FLAG))
- self.nextthink = (time + (sys_ticrate * 2));
- else
- self.nextthink = (time + (sys_ticrate * 3));
- }
- if ((self.health <= 0))
- {
- return;
- }
- if (!(temp1 & TEMP1_MULTI))
- {
- self.weapon = Bot_BestWeapon ();
- }
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- MaybeFightFlagCarrier ();
- if ((self.enemy != world))
- {
- visi = BotCanSeePlayer (self.enemy);
- follow_ent = world;
- if ((!visi && !(self.player_flag & ITEM_ENEMY_FLAG)))
- {
- follow_ent = BotCanSeePlayerFollow (self.enemy);
- }
- }
- else
- {
- visi = FALSE;
- }
- CheckGiveUpCamping ();
- if (self.fire_hook_immediately)
- {
- BotFireHookUpRandomly (30);
- self.swing = 0.55;
- self.fire_hook_immediately = FALSE;
- }
- else
- {
- if ((((self.enemy.health > 0) && visi) && (self.bot_action == BOT_FIGHTING)))
- {
- if ((time > (self.enemy_notice_time + (self.bsk_reaction_time / SPAWNFLAG_LASER))))
- {
- ContinueFighting ();
- }
- }
- else
- {
- if ((((self.enemy.health > 0) && (follow_ent != world)) && (self.bot_action == BOT_FIGHTING)))
- {
- old_goal = self.goalentity;
- self.goalentity = follow_ent;
- self.movetarget = follow_ent;
- BotMoveTowardGoal (TRUE);
- self.goalentity = old_goal;
- self.movetarget = old_goal;
- }
- else
- {
- if (!MaybeFight ())
- {
- StopFighting ();
- if (!MaybeGoToTempWaypoint ())
- {
- if (!MaybeTryNotToDrown ())
- {
- if (!MaybeGetItems ())
- {
- if (!SetSpecialGoals ())
- {
- if (!MaybeGetOutOfWater ())
- {
- if (!MaybeShootTriggers (FALSE))
- {
- if (!MaybeFireHook ())
- {
- NothingToDo ();
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- BotSaySomething ();
- //BotPostThink ();
- if (((pointcontents (self.origin) != CONTENT_WATER) && (random () < 0.01)))
- {
- patternchange ();
- }
- if (self.timing > 0.66)
- {
- if (self.bot_action == BOT_FIGHTING || (self.player_flag & ITEM_ENEMY_FLAG))
- self.nextthink = (time + (sys_ticrate * 5));
- else
- self.nextthink = (time + (sys_ticrate * 3));
- }
- if (((self.nextthink < (time - 1)) && self.health)|| (self.nextthink > (time +1)) && self.health)
- self.nextthink = time + 0.2;
- };
- void () BotSelfDeActivate =
- {
- local float forward;
- if ((self.classname != "bot"))
- return;
- self.solid = SOLID_NOT;
- self.deadflag = DEAD_DEAD;
- if ((self.flags & FL_ONGROUND))
- {
- forward = vlen (self.velocity);
- forward = (forward - 20);
- if ((forward <= 0))
- {
- self.velocity = VEC_ORIGIN;
- }
- else
- {
- self.velocity = (forward * normalize (self.velocity));
- }
- }
- if ((self.nextjump > -1))
- self.nextjump = 0;
- CopyToBodyQue (self);
- BotIsDead ();
- };
- void () Bot_Precache =
- {
- bot_debug = 0;
- next_bot_num = 0;
- next_bot_red = 0;
- next_bot_blue = 0;
- smooth_move = FALSE;
- use_extra_move_frame = TRUE;
- last_flag_capture = (time - 999);
- last_flag_pickup = (time - 999);
- last_order_time_team1 = (time - 999);
- last_order_time_team2 = (time - 999);
- level_over_time = (time - 999);
- hook_use_enabled = TRUE;
- auto_camera_view = FALSE;
- auto_fov_control = FALSE;
- cur_camera_watch_ent = world;
- last_camera_ent = world;
- bots_have_normal_names = TRUE;
- SpawnWaypointsForMap (mapname);
- InitCPU ();
- goal_winner = world;
- precache_model ("maps/b_shell1.bsp");
- precache_model ("maps/b_nail1.bsp");
- precache_model ("progs/g_shot.mdl");
- precache_model ("progs/g_nail2.mdl");
- precache_model ("maps/b_bh25.bsp");
- precache_sound ("items/health1.wav");
- precache_model ("progs/armor.mdl");
- if (!(cvar ("teamplay") & TEAM_NO_FLAG_TOSS))
- {
- precache_sound ("shalrath/attack2.wav");
- }
- if (!(cvar ("temp1") & TEMP1_NOMESS))
- {
- precache_sound ("misc/secret.wav");
- bot_chatter_off = 0;
- }
- precache_model ("progs/s_bubble.spr");
- precache_model ("progs/s_light.spr");
- if ((cvar ("teamplay") & TEAM_CAPTURE_CUSTOM))
- {
- precache_model ("progs/flag.mdl");
- precache_sound ("misc/flagtk.wav");
- precache_sound ("misc/flagcap.wav");
- precache_sound ("doors/runetry.wav");
- }
- else
- {
- precache_model ("progs/w_g_key.mdl");
- precache_sound ("ogre/ogwake.wav");
- precache_sound ("boss2/pop2.wav");
- precache_sound ("doors/drclos4.wav");
- }
- };
- entity (entity bot) TeamCaptureSpawnBot =
- {
- local float ss;
- local entity p;
- local entity spot;
- if ((mapname == "start"))
- {
- spot = MultiSelectSpawnPoint ();
- return (spot);
- }
- else
- {
- if ((bot.team == TEAM_COLOR1))
- {
- team1_lastspawn = find (team1_lastspawn, classname, "info_player_team1");
- if ((team1_lastspawn == world))
- {
- team1_lastspawn = find (team1_lastspawn, classname, "info_player_team1");
- }
- return (team1_lastspawn);
- }
- if ((bot.team == TEAM_COLOR2))
- {
- team2_lastspawn = find (team2_lastspawn, classname, "info_player_team2");
- if ((team2_lastspawn == world))
- {
- team2_lastspawn = find (team2_lastspawn, classname, "info_player_team2");
- }
- return (team2_lastspawn);
- }
- return (HeadSelectSpawnPoint ());
- }
- };
- void (float make_visible) SetDebugMarkersVisible =
- {
- local entity e;
- e = find (world, classname, "debug_marker");
- while ((e != world))
- {
- if (make_visible)
- {
- debug_markers_visible = TRUE;
- setmodel (e, "progs/s_light.spr");
- }
- else
- {
- debug_markers_visible = TRUE;
- setmodel (e, "");
- }
- e = find (e, classname, "debug_marker");
- }
- };
- void (vector org) MoveDebugMarker =
- {
- if (debug_markers_visible)
- {
- setorigin (self.debug_marker, org);
- }
- };
- void (entity p) SetBotSkin =
- {
- if ((p.team == TEAM_COLOR1))
- p.skin = 1;
- else
- {
- if ((p.team == TEAM_COLOR2))
- p.skin = 3;
- }
- if ((p.bot_skill >= SPAWNFLAG_LASER))
- p.skin = (p.skin + 1);
- p.oldskin = p.skin;
- };
- void () bot_touch =
- {
- /* debug code
- bprint (self.model);
- bprint ("\n");
- bprint (ftos (self.skin));
- bprint ("\n");
- bprint (ftos(self.modelindex));
- bprint ("\n");
- */
- if (self.watertype == CONTENT_LAVA)
- {
- if (!FireHookAtBestOutOfWaterWaypoint ())
- BotFireHookUpRandomly (1500);
- }
- if ((other.classname == "bot" && other.team == self.team))
- if ((random () < 0.25))
- fBotSayTeam (": Move!!\n");
- if ((other.classname == "bot" || other.classname == "player" && other.team != self.team))
- {
- self.attacked = time + 2.5;
- self.enemy = other;
- }
- if ((other.solid == SOLID_BSP && other != world))
- {
- traceline (self.origin, (self.origin + '0 0 -120'), TRUE, self);
- if (((trace_ent.classname == "plat") && (self.bot_action != BOT_FIGHTING)))
- {
- if (trace_ent.velocity_z != 0 && trace_ent == other)
- {
- self.yaw_speed = ((self.yaw_speed * 0.8) + 0.15);
- self.nextthink = self.nextthink + 0.075;
- self.frame = 36;
- }
- }
- if (((trace_ent.classname == "door") && trace_ent.health))
- {
- self.enemy = trace_ent;
- }
- traceline ((self.origin + '0 0 12'), (self.origin + '0 120 12'), TRUE, self);
- if (((trace_ent.classname == "door") && trace_ent.health))
- {
- self.enemy = trace_ent;
- }
- }
- if ((other.classname == "waypoint"))
- {
- other.velocity = VEC_ORIGIN;
- setorigin (other, other.oldorigin);
- other.nextthink = (time + 8);
- if (((other.waypoint_num == -1) && (other == self.goalentity)))
- {
- self.yaw_speed = 10;
- }
- else
- {
- self.yaw_speed = (random () * 10);
- }
- }
- if ((other.classname == "image"))
- {
- if (self.bot_action != BOT_FIGHTING && self.enemy != other)
- {
- self.enemy = other;
- self.bot_action = BOT_FIGHTING;
- self.flags = self.flags | FL_ONGROUND;
- if (((random () < 0.5)) && (other.health < 7))
- self.repeated = "Get off Me!!!!!!!\n";
- else
- self.repeated = "Say Hello to my Little Friend!!!!\n";
- if (((random () < 0.3))) self.repeat = (time + (random () * 1));
- }
- }
- if (((other == world) && (self.movetype == MOVETYPE_FLY)))
- {
- if ((self.air_finished < time))
- {
- self.velocity = normalize((self.goalentity.origin - self.origin) * 1.5);
- }
- }
- makevectors (self.angles);
- };
- entity (string name, float botteam, float bskill) BotCreate =
- {
- local entity self;
- local float lfClientNo;
- lfClientNo = clientNextAvailable ();
- /*
- if (lfClientNo == -1)
- {
- //sprint2 ("Max Clients Full......No bot created.\n");
- return (world);
- }
- */
- local entity spot,tekbot,store;
- local float mapper;
- local float counter;
- local string st;
- if (!deathmatch)
- {
- sprint2 ("Deathmatch is not enabled.\n");
- sprint2 ("No bot created.\n");
- return (self);
- }
- tekbot = spawnclient();
- tekbot.botname = name;
- RandomNormalName (tekbot);
- //tekbot.solid = SOLID_SLIDEBOX;
- //tekbot.movetype = MOVETYPE_STEP;
- clientSetUsed (lfClientNo);
- //tekbot.simulated_client = TRUE;
- tekbot.colormap = (lfClientNo + 1);
- tekbot.fClientNo = lfClientNo;
- if (bots_have_normal_names)
- tekbot.netname = tekbot.altname;
- else
- tekbot.netname = tekbot.botname;
- tekbot.classname = "bot";
- tekbot.team = botteam;
- tekbot.lastteam = botteam;
- tekbot.ltime = 120;
- tekbot.gtimer = 1.75;
- tekbot.deathtype = "?????";
- tekbot.timing = random ();
- tekbot.waterlevel = 0;
- tekbot.health = 100;
- tekbot.max_health = 100;
- tekbot.frags = 0;
- tekbot.flags = FL_CLIENT;
- tekbot.takedamage = DAMAGE_AIM;
- tekbot.goalentity = self;
- tekbot.movetarget = self;
- tekbot.enemy = world;
- tekbot.pausetime = 0;
- tekbot.deadflag = DEAD_NO;
- tekbot.escort_time = (time - 999);
- tekbot.escort_entity = world;
- tekbot.pattern = 0;
- tekbot.camping_time = (time - 999);
- tekbot.reserve = 0;
- tekbot.repeat = 0;
- tekbot.repeated = "";
- tekbot.swing = 0;
- tekbot.nextjump = 0;
- tekbot.games = rint (random () * 10);
- //if (tekbot.games < 1)
- tekbot.playtime = ((cvar ("timelimit") * (random () * 60)));
- tekbot.camping_entity = world;
- tekbot.camping_spot = VEC_ORIGIN;
- tekbot.last_kill_time = (time - 999);
- tekbot.last_kill_ent = world;
- tekbot.num_kills = 0;
- tekbot.num_deaths = 0;
- tekbot.num_suicides = 0;
- tekbot.num_captures = 0;
- tekbot.num_pickups = 0;
- tekbot.num_recovery = 0;
- tekbot.num_assists = 0;
- tekbot.num_bonus = 0;
- tekbot.player_flag = (tekbot.player_flag - (tekbot.player_flag & ITEM_RUNE_MASK));
- tekbot.player_flag = (tekbot.player_flag - (tekbot.player_flag & ITEM_ENEMY_FLAG));
- tekbot.spawn_time = time;
- tekbot.yaw_speed = 15;
- tekbot.show_hostile = 0;
- tekbot.weapon = 1;
- tekbot.effects = 0;
- tekbot.ammo_shells = 25;
- tekbot.ammo_nails = 0;
- tekbot.ammo_rockets = 0;
- tekbot.ammo_cells = 0;
- tekbot.last_say = 0;
- tekbot.armorvalue = rint(random() * 50 + random() + 25);
- tekbot.items = IT_SHOTGUN | IT_ARMOR1;
- tekbot.turn = '0 0 0';
- tekbot.view_ofs = '0 0 22';
- tekbot.hook_out = FALSE;
- tekbot.bot_plan = rint(random() * 3);
- tekbot.th_pain = bot_pain;
- tekbot.th_die = PlayerDie;
- tekbot.touch = bot_touch;
- tekbot.debug_marker = world;
- if ((temp1 & TEMP1_MULTI))
- {
- //oself = self;
- //self = self;
- set_player_modelindexes ();
- //self = oself;
- }
- else
- {
- if (!(temp1 & TEMP1_SUPPORT_PLAYER2))
- tekbot.sex = 1;
- if ((tekbot.sex == SPAWNFLAG_LASER))
- {
- setmodel (tekbot, "progs/player_f.mdl");
- }
- else
- {
- if ((tekbot.sex == 3))
- {
- setmodel (tekbot, "progs/player3.mdl");
- }
- else
- {
- if ((tekbot.sex == 4))
- {
- setmodel (tekbot, "progs/player4.mdl");
- }
- else
- {
- setmodel (tekbot, "progs/bot.mdl");
- modelindex_bot = tekbot.modelindex;
- tekbot.modelindex = modelindex_bot;
- }
- }
- }
- }
- tekbot.bot_skill = bskill;
- if ((tekbot.bot_skill < 0))
- {
- tekbot.bot_skill = 0;
- }
- if ((tekbot.bot_skill > 3))
- {
- tekbot.bot_skill = 3;
- }
- tekbot.bot_skill_inverse = (3 - tekbot.bot_skill);
- tekbot.bsk_skill_lin1 = (0.7 + (tekbot.bot_skill * 0.1));
- tekbot.bsk_skill_lin2 = (LMQUOTA_ARMOR + (tekbot.bot_skill * 0.2));
- tekbot.bsk_skill_lin3 = (0.1 + (tekbot.bot_skill * 0.3));
- tekbot.bsk_next_pulse_time = (0.3 + (0.3 * tekbot.bot_skill_inverse));
- tekbot.bsk_next_pulse_time_items = (0.2 + (0.2 * tekbot.bot_skill_inverse));
- tekbot.bsk_extra_large_pulse_dist = (200 * tekbot.bot_skill);
- tekbot.bsk_extra_awareness_dist = (300 * tekbot.bot_skill);
- tekbot.bsk_extra_jump_chance = (0.05 + (0.05 * tekbot.bot_skill));
- tekbot.bsk_move_while_firing = (0.85 + (tekbot.bot_skill * 0.05));
- tekbot.bsk_evade_chance = (LMQUOTA_ARMOR + (tekbot.bot_skill * 0.2));
- tekbot.bsk_bot_fov = (tekbot.bot_skill_inverse * 0.15);
- tekbot.bsk_reaction_time = (0.2 * tekbot.bot_skill_inverse);
- tekbot.shirt_color = TeamGetShirt (tekbot.team, self);
- tekbot.clientcolors = (tekbot.shirt_color) * 16 + (tekbot.team - 1);
- if ((botteam == TEAM_COLOR1))
- {
- tekbot.enemy_team = TEAM_COLOR2;
- }
- else
- {
- if ((botteam == TEAM_COLOR2))
- {
- tekbot.enemy_team = TEAM_COLOR1;
- }
- }
- SetBotSkin (tekbot);
- /* Debug code
- bprint (tekbot.model);
- bprint ("\n");
- bprint (ftos(tekbot.skin));
- bprint ("\n");
- bprint (ftos(tekbot.modelindex));
- bprint ("\n");
- */
- if (((random () * 3) <= tekbot.bot_skill))
- {
- tekbot.use_defensive_way = 1;
- }
- else
- {
- tekbot.use_defensive_way = 0;
- }
- if (!(temp1 & TEMP1_USEDEFWAYS))
- {
- tekbot.use_defensive_way = 0;
- }
- tekbot.air_finished = (time + 300);
- tekbot.dmg = SPAWNFLAG_LASER;
- setsize (tekbot, VEC_HULL_MIN, VEC_HULL_MAX);
- //tekbot.angles = tekbot.v_angle = spot.angles;
- waypoint_idle = 0;
- Waypoint_Toggle();
- //tekbot.origin = (spot.origin + '0 0 1');
- //setorigin (self, tekbot.origin);
- //tekbot.angles_y = spot.angles_y;
- //tekbot.angles_x = 0;
- //tekbot.ideal_yaw = (tekbot.angles * '0 1 0');
- //tekbot.v_angle = tekbot.angles;
- //makevectors (tekbot.angles);
- tekbot.bot_action = BOT_MOVING;
- tekbot.think = BotAnimationThink ;
- tekbot.extramove_oldthink = BotAnimationThink;
- tekbot.nextthink = ((time + 0.1) + (random () * 0.1));
- bprint ("[Fclient: ");
- st = ftos (tekbot.fClientNo);
- bprint (st);
- bprint ("]");
- tekbot.fixangle = FALSE;
- if ((tekbot.team == TEAM_COLOR1))
- {
- bprint ("[r");
- st = ftos (next_bot_red);
- bprint (st);
- bprint ("] ");
- }
- else
- {
- if ((tekbot.team == TEAM_COLOR2))
- {
- bprint ("[b");
- st = ftos (next_bot_blue);
- bprint (st);
- bprint ("] ");
- }
- }
- if ((deathmatch & DM_START_SMALL))
- {
- tekbot.items = ((IT_HOOK | IT_SUPER_SHOTGUN) | IT_NAILGUN);
- tekbot.ammo_shells = 69;
- tekbot.ammo_rockets = 0;
- tekbot.ammo_nails = 40;
- tekbot.ammo_cells = 0;
- tekbot.armortype = 0.31;
- tekbot.armorvalue = 100;
- tekbot.weapon = IT_NAILGUN;
- }
- if ((deathmatch & DM_START_BIG))
- {
- tekbot.items = (((IT_HOOK | IT_SUPER_SHOTGUN) | IT_SUPER_NAILGUN) | IT_ROCKET_LAUNCHER);
- tekbot.ammo_shells = 69;
- tekbot.ammo_rockets = 5;
- tekbot.ammo_nails = 60;
- tekbot.ammo_cells = 0;
- tekbot.armortype = 0.31;
- tekbot.armorvalue = 100;
- tekbot.weapon = IT_ROCKET_LAUNCHER;
- }
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- if (tekbot.simulated_client)
- {
- tekbot.fShirt = tekbot.shirt_color;
- tekbot.fPants = (tekbot.team - 1);
- //msgUpdateNameToAll (tekbot.fClientNo, tekbot.netname);
- //msgUpdateColorsToAll (tekbot.fClientNo, tekbot.fShirt, tekbot.fPants);
- //msgUpdateFragsToAll (tekbot.fClientNo, tekbot.frags);
- }
- tekbot.observer_flags = 0;
- tekbot.observer = 0;
- spawn_tdeath (tekbot.origin, self);
- spawn_tfog ((tekbot.origin + (v_forward * 20)));
- bprint (tekbot.netname);
- bprint (" [skill ");
- st = ftos (floor (tekbot.bot_skill));
- bprint (st);
- bprint ("] entered the game\n");
- store = self;
- self = tekbot;
- ClientConnect ();
- PutClientInServer();
- self = store;
- return (tekbot);
- };
- void () BotRespawn =
- {
- local entity spot;
- local string type;
- local float ss;
- local entity p;
- if (!deathmatch) return;
- self.sFloating = string_null;
- self.turn = '0 0 0';
- self.onfire = FALSE;
- self.teleport_time = time + rint ((random () * 4));
- self.deathtype = "Factory Defect!";
- self.ltime = (time + 120);
- self.flags = FL_CLIENT;
- self.touch = bot_touch;
- self.solid = SOLID_SLIDEBOX;
- self.movetype = MOVETYPE_WALK;
- self.waterlevel = 0;
- self.air_finished = (time + 300);
- self.dmg = SPAWNFLAG_LASER;
- self.classname = "bot";
- self.health = 100;
- self.max_health = 100;
- self.takedamage = DAMAGE_AIM;
- self.deadflag = DEAD_NO;
- self.goalentity = self;
- self.movetarget = self;
- self.enemy = world;
- self.pausetime = 0;
- self.armortype = 0.31;
- self.armorvalue = 75;
- self.nextjump = 0;
- self.super_damage_finished = 0;
- self.invincible_finished = 0;
- self.invisible_finished = 0;
- self.radsuit_finished = 0;
- self.player_flag = (self.player_flag - (self.player_flag & ITEM_RUNE_MASK));
- self.player_flag = (self.player_flag - (self.player_flag & ITEM_ENEMY_FLAG));
- self.suspicious_about = VEC_ORIGIN;
- self.suspicious_about_time = 0;
- self.yaw_speed = 75;
- self.show_hostile = 0;
- self.effects = 0;
- self.view_ofs = '0 0 22';
- self.items = IT_SHOTGUN;
- self.weapon = IT_SHOTGUN;
- self.ammo_shells = 25;
- self.ammo_nails = 0;
- self.ammo_rockets = 0;
- self.ammo_cells = 0;
- self.escort_time = (time - 999);
- self.escort_entity = world;
- self.camping_time = (time - 999);
- if ((self.camping_entity != world))
- {
- remove (self.camping_entity);
- }
- self.camping_entity = world;
- self.camping_spot = VEC_ORIGIN;
- self.hook_out = FALSE;
- self.th_pain = bot_pain;
- self.th_die = PlayerDie;
- if (random() < 0.5)
- bot_chatter_rated_g = !bot_chatter_rated_g;
- if ((self.skin < 1))
- SetBotSkin (self);
- if (((self.sex == 2) && (temp1 & TEMP1_SUPPORT_PLAYER2)))
- setmodel (self, "progs/player_f.mdl");
- else
- {
- if ((self.sex == 3))
- {
- setmodel (self, "progs/player3.mdl");
- }
- else
- {
- if ((self.sex == 4))
- {
- setmodel (self, "progs/player4.mdl");
- }
- else
- {
- setmodel (self, "progs/bot.mdl");
- }
- }
- }
- setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
- //if ((deathmatch & DM_SPAWN_RANDOM))
- spot = Get_Botspawn(self);
- self.angles = self.v_angle = spot.angles; //
- self.pattern = 0;
- spawn_tdeath (spot.origin, self);
- spot.spawn_time = spot.spawn_time + 5;
- self.origin = (spot.origin + '0 0 3');
- setorigin (self, self.origin);
- //droptofloor ();
- //self.angles_y = spot.angles_y;
- //self.angles_z = 0;
- //self.angles_x = 0;
- //self.ideal_yaw = (self.angles * '0 1 0');
- //self.v_angle = self.angles;
- makevectors (self.angles);
- spawn_tfog ((self.origin + (v_forward * 20)));
- //self.bot_action = BOT_MOVING;
- self.think = BotAnimationThink;
- self.extramove_oldthink = BotAnimationThink;
- self.nextthink = (time + 0.075);
- if ((deathmatch & DM_START_SMALL))
- {
- self.items = ((IT_HOOK | IT_SUPER_SHOTGUN) | IT_NAILGUN);
- self.ammo_shells = 69;
- self.ammo_rockets = 0;
- self.ammo_nails = 40;
- self.ammo_cells = 0;
- self.armortype = 0.31;
- self.armorvalue = 100;
- self.weapon = IT_NAILGUN;
- }
- if ((deathmatch & DM_START_BIG))
- {
- self.items = (((IT_HOOK | IT_SUPER_SHOTGUN) | IT_SUPER_NAILGUN) | IT_ROCKET_LAUNCHER);
- self.ammo_shells = 69;
- self.ammo_rockets = 5;
- self.ammo_nails = 60;
- self.ammo_cells = 0;
- self.armortype = 0.31;
- self.armorvalue = 100;
- self.weapon = IT_ROCKET_LAUNCHER;
- }
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- };
- void (entity to) BotList =
- {
- local entity head;
- local string frag;
- local float best;
- local string bestname;
- local float num;
- if ((to.classname != "player"))
- {
- return;
- }
- bestname = "";
- best = 0;
- num = 0;
- sprint (to, "Bot frags:\n");
- head = find (world, classname, "bot");
- while (head)
- {
- num = (num + 1);
- frag = ftos (head.frags);
- sprint (to, head.netname);
- sprint (to, " = ");
- sprint (to, frag);
- if ((best < head.frags))
- {
- best = head.frags;
- bestname = head.netname;
- }
- head = find (head, classname, "bot");
- }
- };
- void (string name, float botteam, float bskill) QBotCreate =
- {
- local float lfClientNo;
- lfClientNo = clientNextAvailable ();
- //if (lfClientNo == -1)
- //{
- //sprint2 ("Max Clients Full......No bot created.\n");
- //return (world);
- //}
- local string st;
- local entity que,qbot;
- if (!deathmatch)
- {
- sprint2 ("Deathmatch is not enabled.\n");
- sprint2 ("No bot created.\n");
- return;
- }
- qbot = spawnclient ();
- qbot.search_time = time;
- qbot.attack_finished = time;
- qbot.th_pain = bot_pain;
- //qbot.th_die = BotDie;
- //qbot.th_stand = bot_stand1;
- //qbot.th_walk = bot_walk;
- //qbot.th_run = bot_run;
- //qbot.th_melee = dmbot_melee;
- //qbot.th_cache = cacheenemy;
- //qbot.think = bot_start;
- //qbot.nextthink = (time + 0.1);
- //qbot.enemy = world;
- //qbot.pathtype = NEVERTARGET;
- qbot.deadflag = DEAD_NO;
- qbot.pausetime = FALSE;
- qbot.movetype = MOVETYPE_STEP;
- clientSetUsed (lfClientNo);
- qbot.simulated_client = TRUE;
- qbot.colormap = (lfClientNo + 1);
- qbot.fClientNo = lfClientNo;
- if (bots_have_normal_names)
- {
- qbot.netname = qbot.altname;
- }
- else
- {
- qbot.netname = qbot.botname;
- }
- qbot.classname = "bot";
- qbot.team = botteam;
- qbot.lastteam = botteam;
- qbot.ltime = 120;
- qbot.gtimer = 1.75;
- qbot.deathtype = "?????";
- qbot.timing = random ();
- qbot.waterlevel = 0;
- qbot.health = 100;
- qbot.max_health = 100;
- qbot.frags = 0;
- qbot.flags = FL_CLIENT;
- qbot.takedamage = DAMAGE_AIM;
- qbot.goalentity = qbot;
- qbot.movetarget = qbot;
- qbot.enemy = world;
- qbot.pausetime = 0;
- qbot.deadflag = DEAD_NO;
- qbot.escort_time = (time - 999);
- qbot.escort_entity = world;
- qbot.pattern = 0;
- qbot.camping_time = (time - 999);
- qbot.reserve = 0;
- qbot.repeat = 0;
- qbot.repeated = "";
- qbot.swing = 0;
- qbot.nextjump = 0;
- qbot.games = rint (random () * 10);
- qbot.playtime = 0;
- qbot.camping_entity = world;
- qbot.camping_spot = VEC_ORIGIN;
- qbot.last_kill_time = (time - 999);
- qbot.last_kill_ent = world;
- qbot.num_kills = 0;
- qbot.num_deaths = 0;
- qbot.num_suicides = 0;
- qbot.num_captures = 0;
- qbot.num_pickups = 0;
- qbot.num_recovery = 0;
- qbot.num_assists = 0;
- qbot.num_bonus = 0;
- qbot.player_flag = (qbot.player_flag - (qbot.player_flag & ITEM_RUNE_MASK));
- qbot.player_flag = (qbot.player_flag - (qbot.player_flag & ITEM_ENEMY_FLAG));
- qbot.spawn_time = time;
- qbot.yaw_speed = 15;
- qbot.show_hostile = 0;
- qbot.weapon = 1;
- qbot.effects = 0;
- qbot.ammo_shells = 25;
- qbot.ammo_nails = 0;
- qbot.ammo_rockets = 0;
- qbot.ammo_cells = 0;
- qbot.last_say = 0;
- qbot.armorvalue = rint(random() * 50 + random() + 25);
- qbot.items = IT_SHOTGUN | IT_ARMOR1;
- qbot.turn = '0 0 0';
- qbot.view_ofs = '0 0 22';
- qbot.hook_out = FALSE;
- qbot.bot_plan = rint(random() * 3);
- qbot.th_pain = bot_pain;
- qbot.th_die = PlayerDie;
- qbot.touch = bot_touch;
- qbot.debug_marker = world;
- if ((temp1 & TEMP1_MULTI))
- {
- qbot = qbot;
- qbot = qbot;
- set_player_modelindexes ();
- qbot = qbot;
- }
- else
- {
- if (!(temp1 & TEMP1_SUPPORT_PLAYER2))
- {
- qbot.sex = 1;
- }
- if ((qbot.sex == SPAWNFLAG_LASER))
- {
- setmodel (qbot, "progs/player_f.mdl");
- }
- else
- {
- if ((qbot.sex == 3))
- {
- setmodel (qbot, "progs/player3.mdl");
- }
- else
- {
- if ((qbot.sex == 4))
- {
- setmodel (qbot, "progs/player4.mdl");
- }
- else
- {
- setmodel (qbot, "progs/bot.mdl");
- modelindex_bot = qbot.modelindex;
- qbot.modelindex = modelindex_bot;
- }
- }
- }
- }
- qbot.bot_skill = bskill;
- if ((qbot.bot_skill < 0))
- {
- qbot.bot_skill = 0;
- }
- if ((qbot.bot_skill > 3))
- {
- qbot.bot_skill = 3;
- }
- qbot.bot_skill_inverse = (3 - qbot.bot_skill);
- qbot.bsk_skill_lin1 = (0.7 + (qbot.bot_skill * 0.1));
- qbot.bsk_skill_lin2 = (LMQUOTA_ARMOR + (qbot.bot_skill * 0.2));
- qbot.bsk_skill_lin3 = (0.1 + (qbot.bot_skill * 0.3));
- qbot.bsk_next_pulse_time = (0.3 + (0.3 * qbot.bot_skill_inverse));
- qbot.bsk_next_pulse_time_items = (0.2 + (0.2 * qbot.bot_skill_inverse));
- qbot.bsk_extra_large_pulse_dist = (200 * qbot.bot_skill);
- qbot.bsk_extra_awareness_dist = (300 * qbot.bot_skill);
- qbot.bsk_extra_jump_chance = (0.05 + (0.05 * qbot.bot_skill));
- qbot.bsk_move_while_firing = (0.85 + (qbot.bot_skill * 0.05));
- qbot.bsk_evade_chance = (LMQUOTA_ARMOR + (qbot.bot_skill * 0.2));
- qbot.bsk_bot_fov = (qbot.bot_skill_inverse * 0.15);
- qbot.bsk_reaction_time = (0.2 * qbot.bot_skill_inverse);
- qbot.shirt_color = TeamGetShirt (qbot.team, qbot);
- qbot.clientcolors = (qbot.shirt_color) * 16 + (qbot.team - 1);
- if ((botteam == TEAM_COLOR1))
- {
- qbot.enemy_team = TEAM_COLOR2;
- }
- else
- {
- if ((botteam == TEAM_COLOR2))
- {
- qbot.enemy_team = TEAM_COLOR1;
- }
- }
- SetBotSkin (qbot);
- /* Debug code
- bprint (qbot.model);
- bprint ("\n");
- bprint (ftos(qbot.skin));
- bprint ("\n");
- bprint (ftos(qbot.modelindex));
- bprint ("\n");
- */
- if (((random () * 3) <= qbot.bot_skill))
- {
- qbot.use_defensive_way = 1;
- }
- else
- {
- qbot.use_defensive_way = 0;
- }
- if (!(temp1 & TEMP1_USEDEFWAYS))
- {
- qbot.use_defensive_way = 0;
- }
- qbot.air_finished = (time + 300);
- qbot.dmg = 2;
- setsize (qbot, VEC_HULL_MIN, VEC_HULL_MAX);
- //spot = TeamCaptureSpawnBot (qbot);
- //qbot.angles = qbot.v_angle = spot.angles;
- waypoint_idle = 0;
- Waypoint_Toggle();
- //PutClientInServer();
- //qbot.origin = (spot.origin + '0 0 1');
- //setorigin (qbot, qbot.origin);
- //qbot.angles_y = spot.angles_y;
- //qbot.angles_x = 0;
- //qbot.ideal_yaw = (qbot.angles * '0 1 0');
- //qbot.v_angle = qbot.angles;
- //makevectors (qbot.angles);
- spawn_tfog ((qbot.origin + (v_forward * 20)));
- qbot.bot_action = BOT_MOVING;
- qbot.think = BotAnimationThink ;
- qbot.extramove_oldthink = BotAnimationThink;
- qbot.nextthink = ((time + 0.1) + (random () * 0.1));
- spawn_tdeath (qbot.origin, qbot);
- bprint ("[Fclient: ");
- st = ftos (qbot.fClientNo);
- bprint (st);
- bprint ("]");
- qbot.fixangle = FALSE;
- if ((qbot.team == TEAM_COLOR1))
- {
- bprint ("[r");
- st = ftos (next_bot_red);
- bprint (st);
- bprint ("] ");
- }
- else
- {
- if ((qbot.team == TEAM_COLOR2))
- {
- bprint ("[b");
- st = ftos (next_bot_blue);
- bprint (st);
- bprint ("] ");
- }
- }
- spawn_tfog (qbot.origin);
- bprint (qbot.netname);
- bprint (" [skill ");
- st = ftos (floor (qbot.bot_skill));
- bprint (st);
- bprint ("] entered the game\n");
- if ((deathmatch & DM_START_SMALL))
- {
- qbot.items = ((IT_HOOK | IT_SUPER_SHOTGUN) | IT_NAILGUN);
- qbot.ammo_shells = 69;
- qbot.ammo_rockets = 0;
- qbot.ammo_nails = 40;
- qbot.ammo_cells = 0;
- qbot.armortype = 0.31;
- qbot.armorvalue = 100;
- qbot.weapon = IT_NAILGUN;
- }
- if ((deathmatch & DM_START_BIG))
- {
- qbot.items = (((IT_HOOK | IT_SUPER_SHOTGUN) | IT_SUPER_NAILGUN) | IT_ROCKET_LAUNCHER);
- qbot.ammo_shells = 69;
- qbot.ammo_rockets = 5;
- qbot.ammo_nails = 60;
- qbot.ammo_cells = 0;
- qbot.armortype = 0.31;
- qbot.armorvalue = 100;
- qbot.weapon = IT_ROCKET_LAUNCHER;
- }
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- if (qbot.simulated_client)
- {
- qbot.fShirt = qbot.shirt_color;
- qbot.fPants = (qbot.team - 1);
- //msgUpdateNameToAll (qbot.fClientNo, qbot.netname);
- //msgUpdateColorsToAll (qbot.fClientNo, qbot.fShirt, qbot.fPants);
- //msgUpdateFragsToAll (qbot.fClientNo, qbot.frags);
- }
- //
- qbot.botname = name;
- RandomNormalName (qbot);
- que = self;
- local entity x;
- x = spawn ();
- x = qbot;
- self = que;
- ClientConnect ();
- self = que;
- x.origin = (DMHEAD.origin);
- setorigin (x, DMHEAD.origin);
- /*
- msgUpdateNameToAll (qbot.fClientNo, qbot.netname);
- msgUpdateColorsToAll (qbot.fClientNo, qbot.fShirt, qbot.fPants);
- msgUpdateFragsToAll (qbot.fClientNo, qbot.frags);
- */
- //spot = TeamCaptureSpawnBot (qbot);
- //qbot.angles = qbot.v_angle = spot.angles;
- //self = qbot;
- //self = x = qbot;
- return;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement