Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float () BotShouldDischarge =
- {
- local float num_we_will_fry;
- local entity p;
- if ((self.waterlevel != 3))
- {
- return (FALSE);
- }
- if (!(self.items & IT_LIGHTNING))
- {
- return (FALSE);
- }
- if ((self.ammo_cells == action))
- {
- return (FALSE);
- }
- if (((self.items & IT_LIGHTNING) && (self.ammo_cells > 25)))
- {
- return (FALSE);
- }
- if (((self.items & IT_ROCKET_LAUNCHER) && (self.ammo_rockets > 25)))
- {
- return (FALSE);
- }
- if (((self.items & IT_GRENADE_LAUNCHER) && (self.ammo_rockets > 25)))
- {
- return (FALSE);
- }
- if (((self.items & IT_SUPER_NAILGUN) && (self.ammo_nails > 25)))
- {
- return (FALSE);
- }
- num_we_will_fry = action;
- p = findradius (self.origin, 1000);
- while ((p != world))
- {
- if (((p.classname == "player") || (p.classname == "bot")))
- {
- if ((p.team != self.team))
- {
- if ((p.health > action))
- {
- if (!(p.observer_flags & PLAYER_NO_TARGET))
- {
- if (!p.observer)
- {
- if ((pointcontents (p.origin) == CONTENT_WATER))
- {
- if (BotCanSeePlayer (p))
- {
- num_we_will_fry = (num_we_will_fry + 1);
- }
- }
- }
- }
- }
- }
- }
- p = p.chain;
- }
- if ((num_we_will_fry > 1))
- {
- if ((random () < 0.02))
- {
- if ((bot_debug >= 1))
- {
- dprint (self.netname);
- dprint (" decides to discharge\n");
- }
- return (TRUE);
- }
- }
- return (FALSE);
- };
- float () Bot_BestWeapon =
- {
- local float it;
- local vector vrng;
- local float rng;
- local float good_grenade_range;
- local float safe_dist;
- local float bestw;
- local float goodzrange;
- local float dis;
- self.altweap = 0;
- it = self.items;
- safe_dist = -1;
- if ((self.enemy != world))
- {
- rng = vlen ((self.origin - self.enemy.origin));
- rng = (rng + (((((random () * random ()) * -1) - 1) * 50) * self.bot_skill_inverse));
- if (!self.hooked_on_someone && self.health > 75 && rng < 75 && self.enemy.attacked < time)
- return (IT_HOOK);
- if (((it & IT_LIGHTNING) && (self.ammo_cells >= 1)))
- {
- dis = FALSE;
- dis = BotShouldDischarge ();
- if (((rng < 600) && ((self.waterlevel <= 1) || dis)))
- {
- return (IT_LIGHTNING);
- }
- }
- if (((it & IT_ROCKET_LAUNCHER) && (self.ammo_rockets >= 1)))
- {
- if ((teamplay & TEAM_NOSELFHURT))
- {
- safe_dist = action;
- }
- else
- {
- if ((self.health < TEAM_CAPTURE_FLAG_RETURN_TIME))
- {
- safe_dist = 100000000;
- }
- else
- {
- if (((self.armortype == 0.3) && (self.armorvalue > 75)))
- {
- safe_dist = 80;
- }
- else
- {
- if (((self.armortype == 0.6) && (self.armorvalue > VOTEEXIT_TIME_LIMIT)))
- {
- safe_dist = VOTEEXIT_TIME_LIMIT;
- }
- else
- {
- if (((self.armortype == 0.8) && (self.armorvalue > 50)))
- {
- safe_dist = 35;
- }
- else
- {
- safe_dist = 100;
- }
- }
- }
- }
- }
- if ((self.player_flag & ITEM_RUNE2_FLAG))
- {
- safe_dist = (safe_dist * SPAWNFLAG_LASER);
- }
- if ((self.player_flag & ITEM_RUNE4_FLAG))
- {
- safe_dist = (safe_dist / 3);
- }
- if ((self.player_flag & ITEM_RUNE1_FLAG))
- {
- safe_dist = (safe_dist / SPAWNFLAG_LASER);
- }
- if ((self.super_damage_finished > time))
- {
- safe_dist = (safe_dist * SECRET_1ST_DOWN);
- }
- if ((self.invincible_finished > time))
- {
- safe_dist = action;
- }
- if ((rng > safe_dist))
- {
- return (IT_ROCKET_LAUNCHER);
- }
- }
- if (((it & IT_GRENADE_LAUNCHER) && (self.ammo_rockets >= 1)))
- {
- if ((safe_dist == -1))
- {
- if ((self.health < 50))
- {
- safe_dist = 100000000;
- }
- else
- {
- if (((self.armortype == 0.3) && (self.armorvalue > 75)))
- {
- safe_dist = 100;
- }
- else
- {
- if (((self.armortype == 0.6) && (self.armorvalue > VOTEEXIT_TIME_LIMIT)))
- {
- safe_dist = 80;
- }
- else
- {
- if (((self.armortype == 0.8) && (self.armorvalue > 50)))
- {
- safe_dist = VOTEEXIT_TIME_LIMIT;
- }
- else
- {
- safe_dist = 100;
- }
- }
- }
- }
- if ((self.player_flag & ITEM_RUNE2_FLAG))
- {
- safe_dist = (safe_dist * SPAWNFLAG_LASER);
- }
- if ((self.player_flag & ITEM_RUNE4_FLAG))
- {
- safe_dist = (safe_dist / 3);
- }
- if ((self.player_flag & ITEM_RUNE1_FLAG))
- {
- safe_dist = (safe_dist / -1);
- }
- if ((self.super_damage_finished > time))
- {
- safe_dist = (safe_dist * SECRET_1ST_DOWN);
- }
- if ((self.invincible_finished > time))
- {
- safe_dist = action;
- }
- }
- goodzrange = FALSE;
- if ((self.origin_z > self.enemy.origin_z))
- {
- goodzrange = TRUE;
- }
- else
- {
- if (((self.enemy.origin_z - self.origin_z) < 250))
- {
- goodzrange = TRUE;
- }
- }
- if ((((rng < 600) && (rng > safe_dist)) && goodzrange))
- {
- good_grenade_range = TRUE;
- }
- else
- {
- if ((((rng < 1500) && (rng > (safe_dist * 0.6))) && (self.origin_z > (self.enemy.origin_z + 50))))
- {
- good_grenade_range = TRUE;
- }
- else
- {
- good_grenade_range = FALSE;
- }
- }
- if (good_grenade_range)
- {
- return (IT_GRENADE_LAUNCHER);
- }
- }
- if (((self.ammo_nails >= 1) && (it & IT_SUPER_NAILGUN)))
- {
- return (IT_SUPER_NAILGUN);
- }
- if (((self.ammo_shells >= 1) && (it & IT_SUPER_SHOTGUN)))
- {
- return (IT_SUPER_SHOTGUN);
- }
- if (((self.ammo_nails >= 1) && (it & IT_NAILGUN)))
- {
- if ((self.player_flag & ITEM_RUNE3_FLAG))
- {
- if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
- {
- return (IT_SHOTGUN);
- }
- }
- else
- {
- if (self.waterlevel < 2 && rng < 300 && self.enemy.waterlevel < 2)
- {
- self.altweap = 1;
- return (IT_NAILGUN);
- }
- else
- return (IT_NAILGUN);
- }
- }
- if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
- {
- return (IT_SHOTGUN);
- }
- if ((!self.ammo_shells || (it & IT_SHOTGUN)))
- {
- return (IT_HOOK);
- }
- }
- else
- {
- if (((self.ammo_shells >= 1) && (it & IT_SHOTGUN)))
- {
- return (IT_SHOTGUN);
- }
- }
- if (((((rng < SPAWNFLAG_LASER) && (self.health > 70)) && (self.enemy.health < 20)) && (time < self.enemy.attack_finished)))
- {
- if ((self.enemy.angles_y != vectoyaw ((self.enemy.origin - self.origin))))
- {
- return (IT_HOOK);
- }
- }
- else
- {
- return (IT_AXE);
- }
- };
- float () IsExactlyOnePlayer =
- {
- local entity p;
- local float nm;
- p = find (world, classname, "player");
- nm = action;
- while ((p != world))
- {
- nm = (nm + 1);
- if ((nm > 1))
- {
- return (FALSE);
- }
- p = find (p, classname, "player");
- }
- return (TRUE);
- };
- float (entity bot, entity item) IsGoodItem =
- {
- local float val;
- local entity p;
- local entity targ;
- if (item.altname == "weapon")
- if (bot.items & item.weapon)
- return(0);
- if ((item.classname == "bonus"))
- {
- return (10000);
- }
- if ((item.classname == "mine"))
- {
- if (EntityInFieldOfView (item))
- {
- if ((item.owner.team != self.team))
- {
- if ((self.items && SECRET_NEVER))
- {
- self.weapon = SECRET_NEVER;
- }
- if ((self.items & SECRET_YES_SHOOT))
- {
- self.weapon = SECRET_YES_SHOOT;
- }
- self.enemy = item;
- return (action);
- }
- else
- {
- BotEvade (item);
- }
- }
- }
- if ((item.classname == "trigger_teleport"))
- {
- targ = find (item, targetname, item.target);
- if (!targ)
- {
- return (action);
- }
- else
- {
- return (1000);
- }
- }
- if (!item.bot_wants_item)
- {
- return (action);
- }
- if ((((item.team != bot.team) && (item.classname == "grenade")) || (item.classname == "missile")))
- {
- if (EntityInFieldOfView (item))
- {
- if ((item.model == "progs/missile.mdl"))
- BotEvade (item);
- if ((vlen ((bot.origin - item.origin)) < 25))
- {
- bot.attacked = (time + 3.3);
- bot.turn = (bot.origin - item.origin);
- if ((self.flags & FL_ONGROUND))
- self.velocity = (self.velocity * -1.77);
- else
- {
- self.nextjump = 10;
- self.swing = 0.33;
- BotFireHookUpRandomly (20);
- }
- if (!EntityInFieldOfView (item.owner))
- {
- self.suspicious_about = item.owner.origin;
- self.suspicious_about_time = time;
- }
- return (action);
- }
- }
- }
- if ((((((item.classname == "light_torch_small_walltorch") || (item.classname == "mine")) || (item.model == "progs/spike.mdl")) || (item.model == "progs/s_spike.mdl")) || (item.model == "progs/laser.mdl")))
- {
- return (action);
- }
- if ((item.classname == "item_health"))
- {
- if ((bot.health < 25))
- {
- return (10000);
- }
- else
- {
- if ((bot.health < 50))
- {
- return (5000);
- }
- else
- {
- if ((bot.health < 75))
- {
- return (500);
- }
- else
- {
- if ((bot.health < 100))
- {
- if ((item.spawnflags & H_MEGA))
- {
- if ((bot.player_flag & ITEM_RUNE4_FLAG))
- {
- return (1000);
- }
- else
- {
- return ((250 - bot.health));
- }
- }
- else
- {
- if ((item.spawnflags & H_ROTTEN))
- {
- return ((115 - bot.health));
- }
- else
- {
- return ((125 - bot.health));
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((item.classname == "item_shells"))
- {
- return ((25 - bot.ammo_shells));
- }
- else
- {
- if ((item.classname == "item_nails"))
- {
- return ((100 - bot.ammo_nails));
- }
- else
- {
- if ((item.classname == "item_rockets"))
- {
- return ((50 - bot.ammo_rockets));
- }
- else
- {
- if ((item.classname == "item_cells"))
- {
- return ((50 - bot.ammo_cells));
- }
- else
- {
- if ((item.classname == "backpack"))
- {
- return (150);
- }
- else
- {
- if ((item.classname == "weapon_supershotgun"))
- {
- if ((deathmatch & DM_WEAPONS_STAY))
- {
- if (!(bot.items & IT_SUPER_SHOTGUN))
- {
- return (VOTEEXIT_TIME_LIMIT);
- }
- }
- else
- {
- if (((bot.items & IT_SUPER_NAILGUN) && (bot.ammo_nails >= LMQUOTA_HEALTH)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_GRENADE_LAUNCHER) && (bot.ammo_rockets >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (!(bot.items & IT_SUPER_SHOTGUN))
- {
- return (VOTEEXIT_TIME_LIMIT);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((VOTEEXIT_TIME_LIMIT - bot.ammo_shells));
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((item.classname == "weapon_nailgun"))
- {
- if ((deathmatch & DM_WEAPONS_STAY))
- {
- if (!(bot.items & IT_NAILGUN))
- {
- return (LMQUOTA_HEALTH);
- }
- }
- else
- {
- if (((bot.items & IT_SUPER_NAILGUN) && (bot.ammo_nails >= LMQUOTA_HEALTH)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_GRENADE_LAUNCHER) && (bot.ammo_rockets >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
- {
- return (TEAM_CAPTURE_CAPTURE_BONUS);
- }
- else
- {
- if (!(bot.items & IT_NAILGUN))
- {
- return (LMQUOTA_HEALTH);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((80 - bot.ammo_nails));
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((item.classname == "weapon_supernailgun"))
- {
- if ((deathmatch & DM_WEAPONS_STAY))
- {
- if (!(bot.items & IT_SUPER_NAILGUN))
- {
- return (75);
- }
- }
- else
- {
- if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
- {
- return ((80 - bot.ammo_nails));
- }
- else
- {
- if (!(bot.items & IT_SUPER_NAILGUN))
- {
- return (75);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((80 - bot.ammo_nails));
- }
- }
- }
- }
- }
- else
- {
- if ((item.classname == "weapon_grenadelauncher"))
- {
- if ((deathmatch & DM_WEAPONS_STAY))
- {
- if (!(bot.items & IT_GRENADE_LAUNCHER))
- {
- return (130);
- }
- }
- else
- {
- if (((bot.items & IT_ROCKET_LAUNCHER) && (bot.ammo_rockets >= 5)))
- {
- return ((50 - bot.ammo_rockets));
- }
- else
- {
- if (((bot.items & IT_LIGHTNING) && (bot.ammo_cells >= 5)))
- {
- return ((50 - bot.ammo_rockets));
- }
- else
- {
- if (!(bot.items & IT_GRENADE_LAUNCHER))
- {
- return (130);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((50 - bot.ammo_rockets));
- }
- }
- }
- }
- }
- }
- else
- {
- if ((item.classname == "weapon_rocketlauncher"))
- {
- if (!(bot.items & IT_ROCKET_LAUNCHER))
- {
- return (140);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((50 - bot.ammo_rockets));
- }
- }
- }
- else
- {
- if ((item.classname == "weapon_lightning"))
- {
- if (!(bot.items & IT_LIGHTNING))
- {
- return (150);
- }
- else
- {
- if (!(deathmatch & DM_WEAPONS_STAY))
- {
- return ((50 - bot.ammo_cells));
- }
- }
- }
- else
- {
- if ((item.classname == "item_armor1"))
- {
- if (((bot.armortype * bot.armorvalue) < (0.3 * 100)))
- {
- return (300);
- }
- }
- else
- {
- if ((item.classname == "item_armor2"))
- {
- if (((bot.armortype * bot.armorvalue) < (0.6 * 150)))
- {
- return (600);
- }
- }
- else
- {
- if ((item.classname == "item_armorInv"))
- {
- if (((bot.armortype * bot.armorvalue) < (0.8 * 200)))
- {
- return (800);
- }
- }
- else
- {
- if ((item.classname == "item_flag_team1"))
- {
- if ((bot.team == TEAM_COLOR2))
- {
- return (20000);
- }
- else
- {
- if ((bot.player_flag & ITEM_ENEMY_FLAG))
- {
- return (100000);
- }
- else
- {
- if ((item.cnt == 2))
- {
- return (50000);
- }
- }
- }
- }
- else
- {
- if ((item.classname == "item_flag_team2"))
- {
- if ((bot.team == TEAM_COLOR1))
- {
- return (20000);
- }
- else
- {
- if ((bot.player_flag & ITEM_ENEMY_FLAG))
- {
- return (100000);
- }
- else
- {
- if ((item.cnt == 2))
- {
- return (50000);
- }
- }
- }
- }
- else
- {
- if (((((item.classname == "item_rune1") || (item.classname == "item_rune2")) || (item.classname == "item_rune3")) || (item.classname == "item_rune4")))
- {
- if (!(bot.player_flag & ITEM_RUNE_MASK))
- {
- return (1000);
- }
- }
- else
- {
- if ((item.classname == "item_artifact_envirosuit"))
- {
- if ((self.waterlevel == 3))
- {
- return (1000);
- }
- else
- {
- return (50);
- }
- }
- else
- {
- if ((item.classname == "item_artifact_invulnerability"))
- {
- return (1500);
- }
- else
- {
- if ((item.classname == "item_artifact_invisibility"))
- {
- return (500);
- }
- else
- {
- if ((item.classname == "item_artifact_super_damage"))
- {
- return (1500);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return (action);
- };
- float (entity item) IsImmovableGettableItem =
- {
- if ((item.classname == "item_flag_team1"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_flag_team2"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_artifact_envirosuit"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_artifact_invulnerability"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_artifact_invisibility"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_artifact_super_damage"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_supershotgun"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_nailgun"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_supernailgun"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_grenadelauncher"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_rocketlauncher"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "weapon_lightning"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_shells"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_nails"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_rockets"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_cells"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_armor1"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_armor2"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_armorInv"))
- {
- return (TRUE);
- }
- else
- {
- if ((item.classname == "item_health"))
- {
- return (TRUE);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return (FALSE);
- };
- float () BotSayStart =
- {
- if ((time < (self.last_say + 5)))
- {
- return (FALSE);
- }
- self.last_say = time;
- if (bots_have_normal_names)
- {
- bprint (self.talkname);
- bprint ("º ");
- }
- else
- {
- if ((self.team == TEAM_COLOR1))
- {
- bprint ("ÒåäÂïôº ");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- bprint ("ÂìõåÂïôº ");
- }
- else
- {
- bprint ("Âïôº ");
- }
- }
- }
- return (TRUE);
- };
- float () BotSayTeamStart =
- {
- if ((time < (self.last_say + 4.5)))
- {
- return (FALSE);
- }
- self.last_say = time;
- if (bots_have_normal_names)
- {
- bprintteam ("¨");
- bprintteam (self.talkname);
- bprintteam ("©º ");
- }
- else
- {
- if ((self.team == TEAM_COLOR1))
- {
- bprintteam ("ÒåäÂïôº ");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- bprintteam ("ÂìõåÂïôº ");
- }
- else
- {
- bprintteam ("Âïôº ");
- }
- }
- }
- return (TRUE);
- };
- void () BotSayStart2 =
- {
- if (bots_have_normal_names)
- {
- bprint (self.talkname);
- bprint ("º ");
- }
- else
- {
- if ((self.team == TEAM_COLOR1))
- {
- bprint ("ÒåäÂïôº ");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- bprint ("ÂìõåÂïôº ");
- }
- else
- {
- bprint ("Âïôº ");
- }
- }
- }
- };
- void () BotSayTeamStart2 =
- {
- if (bots_have_normal_names)
- {
- bprintteam (self.talkname);
- bprintteam ("º ");
- }
- else
- {
- if ((self.team == TEAM_COLOR1))
- {
- bprintteam ("ÒåäÂïôº ");
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- bprintteam ("ÂìõåÂïôº ");
- }
- else
- {
- bprintteam ("Âïôº ");
- }
- }
- }
- };
- void (string st) BotSayMiddle =
- {
- bprint (st);
- };
- void (string st) BotSayTeamMiddle =
- {
- bprintteam (st);
- };
- void () BotSayEnd =
- {
- bprint ("\n");
- sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
- };
- void () BotPlayTeamTalkBeep =
- {
- local entity p;
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == self.team))
- {
- stuffcmd (p, "play misc/talk.wav\n");
- }
- p = find (p, classname, "player");
- }
- };
- void () BotSayTeamEnd =
- {
- BotPlayTeamTalkBeep ();
- bprintteam ("\n");
- };
- void (string st) BotSay =
- {
- if (BotSayStart ())
- {
- BotSayMiddle (st);
- BotSayEnd ();
- }
- };
- void (string st) BotSayTeam =
- {
- if (BotSayTeamStart ())
- {
- BotSayTeamMiddle (st);
- BotSayTeamEnd ();
- }
- };
- void (entity player) BotSayEscort =
- {
- local entity flag1;
- local entity flag2;
- local entity p;
- local float r;
- if (bot_chatter_off)
- {
- return;
- }
- if ((random () < 0.3))
- {
- r = random ();
- if ((r < 0.125))
- {
- flag1 = find (world, classname, "item_flag_team1");
- flag2 = find (world, classname, "item_flag_team2");
- if ((self.team != TEAM_COLOR1))
- {
- p = flag1;
- flag1 = flag2;
- flag2 = p;
- }
- if ((flag2.cnt == 0))
- {
- if (BotSayTeamStart ())
- {
- BotSayTeamMiddle ("let's get their flag ");
- BotSayTeamMiddle (player.netname);
- BotSayTeamEnd ();
- }
- }
- }
- else
- {
- if ((r < 0.25))
- {
- p = find (world, classname, "item_artifact_invulnerability");
- if (((p != world) && (p.solid != SOLID_NOT)))
- {
- if (BotSayTeamStart ())
- {
- BotSayTeamMiddle ("go get the pentagram ");
- BotSayTeamMiddle (player.netname);
- BotSayTeamEnd ();
- }
- }
- else
- {
- p = find (world, classname, "item_artifact_super_damage");
- if (((p != world) && (p.solid != SOLID_NOT)))
- {
- if (BotSayTeamStart ())
- {
- BotSayTeamMiddle ("go get the quad ");
- BotSayTeamMiddle (player.netname);
- BotSayTeamEnd ();
- }
- }
- else
- {
- if ((!bot_chatter_rated_g && BotSayStart ()))
- {
- BotSayTeamMiddle ("let's kill them ");
- BotSayTeamMiddle (player.netname);
- BotSayTeamEnd ();
- }
- }
- }
- }
- else
- {
- if ((r < 0.375))
- {
- BotSayTeam ("let's go get 'em");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSayTeam ("let's attack");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.75)))
- {
- BotSayTeam ("let's kick some ass");
- }
- else
- {
- if ((r < 0.995))
- {
- BotSayTeam ("go for it");
- }
- else
- {
- if (BotSayTeamStart ())
- {
- BotSayTeamMiddle ("you're awesome ");
- BotSayTeamMiddle (player.netname);
- BotSayTeamEnd ();
- }
- }
- }
- }
- }
- }
- }
- }
- };
- void () BotSayDefense =
- {
- local entity p;
- local float r;
- if ((self.team != last_pickup_team))
- {
- if ((random () < 0.01))
- {
- 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 == 0))
- {
- return;
- }
- r = random ();
- if ((r < 0.1))
- {
- BotSay ("LOOK OUT!!");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSay ("Enemy sited near base! ");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSay ("Ever hear of Defense guys? ");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < LMQUOTA_ARMOR)))
- {
- BotSay ("defense dammit");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSay ("Im on him guys.");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.6)))
- {
- BotSay ("kill the carrier");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSay ("My team needs viagra");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.8)))
- {
- BotSay ("Awww man!");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSay ("we need more defense");
- }
- else
- {
- if ((r < 0.95))
- {
- self.repeat = (time + (random () * 2));
- self.repeated = "Return The Flag!!\n";
- }
- else
- {
- if (!bot_chatter_rated_g)
- {
- BotSay ("dammit");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- };
- void () BotSayDammit =
- {
- local float r;
- if ((self.team != last_capture_team))
- {
- if ((random () < 0.01))
- {
- r = random ();
- if ((r < 0.1))
- {
- BotSay ("no way");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.2)))
- {
- BotSay ("we gotta escort more");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.3)))
- {
- BotSay ("wtf?");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < LMQUOTA_ARMOR)))
- {
- BotSay ("no freakin way");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < fAutoBotRand)))
- {
- BotSay ("dammit!");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSay ("i can't believe it");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSay ("ok, Revenge time...");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.8)))
- {
- BotSay ("what the hell?");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < 0.9)))
- {
- BotSay (" lets return the favor");
- }
- else
- {
- if (!bot_chatter_rated_g)
- {
- BotSay ("total bs");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- };
- void () BotSayGoodGame =
- {
- local float r;
- if ((mapname == "start"))
- {
- return;
- }
- if ((random () < 0.01))
- {
- r = random ();
- if ((r < 0.1))
- {
- BotSay ("good game");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSay ("that was fun");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSay ("nice game");
- }
- else
- {
- if ((r < 0.4))
- {
- BotSay ("GG");
- }
- else
- {
- if ((r < 0.5))
- {
- BotSay (" :)");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSay ("LAG");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSay ("GG All...");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSay ("Cya's!!");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSay ("good game everyone");
- }
- else
- {
- BotSay ("Be back later..");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- };
- void (entity p) BotSayTaunt =
- {
- local float n;
- local float r;
- if ((p == world))
- {
- return;
- }
- if (bot_chatter_rated_g)
- {
- return;
- }
- if ((random () < 0.01))
- {
- n = random ();
- if ((n < 0.2))
- {
- BotSay ("Ownage???");
- }
- else
- {
- if ((n < LMQUOTA_ARMOR))
- {
- BotSay ("Hehe!!");
- }
- else
- {
- if ((n < 0.6))
- {
- BotSay (" Heh Heh..");
- }
- else
- {
- if ((n < 0.8))
- {
- self.repeat = (time + (random () * 2));
- self.repeated = "Come Get Some!!!!!!!\n";
- }
- else
- {
- if ((n > 0.9))
- {
- self.repeat = (time + (random () * 2));
- self.repeated = " <<< Laughs Out Loud!!!!\n";
- }
- }
- }
- }
- }
- return;
- }
- if ((random () < 0.003))
- {
- if (BotSayStart ())
- {
- r = random ();
- if ((r < 0.1))
- {
- BotSayMiddle ("how'd you like that one ");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSayMiddle ("nice try ");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSayMiddle ("almost had me ");
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- BotSayMiddle ("no soup for you ");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSayMiddle ("poorly executed ");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSayMiddle ("i'm still here ");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSayMiddle ("no can do ");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSayMiddle ("I expected better ");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSayMiddle ("missed me ");
- }
- else
- {
- BotSayMiddle ("sorry ");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- BotSayMiddle (p.netname);
- BotSayEnd ();
- }
- }
- };
- void (entity p) BotSayNiceOne1 =
- {
- local float r;
- r = random ();
- if ((r < 0.1))
- {
- BotSayMiddle ("not bad ");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSayMiddle ("great shot ");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSayMiddle ("interesting tactics ");
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- BotSayMiddle ("great combat ");
- }
- else
- {
- if ((r < 0.45))
- {
- BotSayMiddle ("BS ");
- }
- else
- {
- if ((!bot_chatter_rated_g && (r < fAutoBotRand)))
- {
- BotSayMiddle ("you're a psycho killer ");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSayMiddle ("I'll be baaaak ");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSayMiddle ("you're awesome ");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSayMiddle (p.netname);
- BotSayMiddle (" Blew me off the map");
- BotSayEnd ();
- return;
- }
- else
- {
- if ((r < 0.9))
- {
- BotSayMiddle ("how'd you do that ");
- }
- else
- {
- BotSayMiddle ("you're incredible ");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- BotSayMiddle (p.netname);
- BotSayEnd ();
- };
- void (entity p) BotSayNiceOne2 =
- {
- local float r;
- r = random ();
- if ((r < 0.1))
- {
- BotSayMiddle ("that was fantastic ");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSayMiddle ("you knocked the wind out of me ");
- }
- else
- {
- if ((r < 0.25))
- {
- BotSayMiddle ("Yea Right ");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSayMiddle ("very sneaky ");
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- BotSayMiddle ("great tactics ");
- }
- else
- {
- if ((r < 0.45))
- {
- BotSayMiddle ("You're Dead ");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSayMiddle ("great reflexes ");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSayMiddle ("incredible aim ");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSayMiddle ("you're awesome ");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSayMiddle ("I cant even touch ");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSayMiddle ("that was a nice one ");
- }
- else
- {
- BotSayMiddle ("<<<< Hates ");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- BotSayMiddle (p.netname);
- BotSayEnd ();
- };
- void (entity p) BotSayNiceOne =
- {
- local float n;
- if ((p == world))
- {
- return;
- }
- if ((random () < 0.01))
- {
- n = random ();
- if ((n < 0.33))
- {
- self.repeat = (time + (random () * 2));
- self.repeated = "BOT DOWN!! BOT DOWN!!!\n";
- }
- else
- {
- if (((n < 0.66) && (n > 0.33)))
- {
- BotSay ("LAG.....");
- }
- else
- {
- if ((n > 0.66))
- {
- BotSay ("My ISP Stinks!!");
- }
- }
- }
- return;
- }
- if ((random () < 0.003))
- {
- if (BotSayStart ())
- {
- if ((random () < fAutoBotRand))
- {
- BotSayNiceOne1 (p);
- }
- else
- {
- BotSayNiceOne2 (p);
- }
- }
- }
- };
- void () BotSayExtras1 =
- {
- local float r;
- if (bot_chatter_rated_g)
- {
- return;
- }
- if ((random () < 0.3))
- {
- r = random ();
- if ((r < 0.05))
- {
- BotSay ("frag them all");
- }
- else
- {
- if ((r < 0.1))
- {
- BotSay ("frag fest baby");
- }
- else
- {
- if ((r < 0.15))
- {
- BotSay ("i want to kill");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSay ("i love ass-kicking");
- }
- else
- {
- if ((r < 0.25))
- {
- BotSay ("i love a good frag fest");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSay ("it's gibbin' time");
- }
- else
- {
- if ((r < 0.35))
- {
- BotSay ("Anyone else lagged?");
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- BotSay ("i love killing");
- }
- else
- {
- if ((r < 0.45))
- {
- BotSay ("i'm going to kill you all");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSay ("killing is my life");
- }
- else
- {
- if ((r < 0.55))
- {
- BotSay ("frag frag frag");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSay ("kill 'em all");
- }
- else
- {
- if ((r < 0.65))
- {
- BotSay ("i love this level");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSay ("me kill good");
- }
- else
- {
- if ((r < 0.75))
- {
- BotSay ("this is my favorite map");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSay ("it's a frag-a-thon");
- }
- else
- {
- if ((r < 0.85))
- {
- BotSay ("welcome to fragtown");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSay ("psycho killer time");
- }
- else
- {
- if ((r < 0.95))
- {
- BotSay ("Whats Grapple impulse here again?");
- }
- else
- {
- BotSay ("shoot 'em if you got 'em");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- };
- void () BotSayExtras2 =
- {
- local float r;
- if (bot_chatter_rated_g)
- {
- return;
- }
- if ((random () < 0.3))
- {
- r = random ();
- if ((r < 0.05))
- {
- BotSay ("you are all dead meat");
- }
- else
- {
- if ((r < 0.1))
- {
- BotSay ("i love quad");
- }
- else
- {
- if ((r < 0.15))
- {
- BotSay ("who else loves quad?");
- }
- else
- {
- if ((r < 0.2))
- {
- BotSay ("me shoot you now");
- }
- else
- {
- if ((r < 0.25))
- {
- BotSay ("this map kicks ass");
- }
- else
- {
- if ((r < 0.3))
- {
- BotSay ("lets go team");
- }
- else
- {
- if ((r < 0.35))
- {
- BotSay ("remember teamwork pays off");
- }
- else
- {
- if ((r < LMQUOTA_ARMOR))
- {
- BotSay ("Someone stay on Defense....");
- }
- else
- {
- if ((r < 0.45))
- {
- BotSay ("Grapple hook is impulse 39 or 22 I think.");
- }
- else
- {
- if ((r < fAutoBotRand))
- {
- BotSay ("heads up everyone");
- }
- else
- {
- if ((r < 0.55))
- {
- BotSay ("this kicks ass");
- }
- else
- {
- if ((r < 0.6))
- {
- BotSay ("i love it");
- }
- else
- {
- if ((r < 0.65))
- {
- BotSay ("gibs everywhere");
- }
- else
- {
- if ((r < 0.7))
- {
- BotSay ("i will now kill");
- }
- else
- {
- if ((r < 0.75))
- {
- BotSay ("kick butt");
- }
- else
- {
- if ((r < 0.8))
- {
- BotSay ("i love watching gibs fly");
- }
- else
- {
- if ((r < 0.85))
- {
- BotSay ("non-stop fragging");
- }
- else
- {
- if ((r < 0.9))
- {
- BotSay ("Hmmmmm.....");
- }
- else
- {
- if ((r < 0.95))
- {
- BotSay ("Dont Block your Teammates!");
- }
- else
- {
- BotSay ("i love the rocket launcher");
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- if ((random () < 0.33))
- {
- if ((self.bot_plan == BOT_ATTACK))
- {
- fBotSayTeam (": I'm On Offense....\n");
- }
- if ((self.bot_plan == BOT_DEFEND))
- {
- fBotSayTeam (": I'm On Defense.....\n");
- }
- }
- }
- };
- void () BotSayExtras =
- {
- if (bot_chatter_rated_g)
- {
- return;
- }
- if ((random () < 0.3))
- {
- if ((random () < fAutoBotRand))
- {
- BotSayExtras1 ();
- }
- else
- {
- BotSayExtras2 ();
- }
- }
- };
- float (float fteam) IsHumanOnTeam =
- {
- local entity p;
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- return (TRUE);
- }
- p = find (p, classname, "player");
- }
- return (FALSE);
- };
- float (float fteam) GetNumTeamCaptures =
- {
- local entity p;
- local float sum;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- sum = (sum + p.num_captures);
- }
- p = find (p, classname, "bot");
- }
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- sum = (sum + p.num_captures);
- }
- p = find (p, classname, "player");
- }
- return (sum);
- };
- float (float fteam) GetNumTeamFrags =
- {
- local entity p;
- local float sum;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- sum = (sum + p.frags);
- }
- p = find (p, classname, "bot");
- }
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- sum = (sum + p.frags);
- }
- p = find (p, classname, "player");
- }
- return (sum);
- };
- float (float fteam) TeamHasFlag =
- {
- local entity p;
- if ((fteam == TEAM_COLOR1))
- {
- p = find (world, classname, "item_flag_team1");
- }
- else
- {
- if ((fteam == TEAM_COLOR2))
- {
- p = find (world, classname, "item_flag_team2");
- }
- else
- {
- error ("Bogus Team\n");
- }
- }
- if ((p.cnt == FLAG_CARRIED))
- {
- if ((p.owner.team == fteam))
- {
- return (TRUE);
- }
- }
- return (FALSE);
- };
- void (float fteam) PrintTeamStatus =
- {
- local float f;
- local float fe;
- local float fenemyteam;
- local float n_flag;
- local float n_attack;
- local float n_defend;
- local float n_roam;
- local float n_camp;
- local float n_escort;
- local float n_bot;
- local float n_human;
- local entity p;
- local string st;
- if ((self.classname != "player"))
- {
- return;
- }
- n_flag = action;
- n_attack = action;
- n_defend = action;
- n_roam = action;
- n_camp = action;
- n_escort = action;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == self.team))
- {
- if ((p.player_flag & ITEM_ENEMY_FLAG))
- {
- n_flag = TRUE;
- }
- else
- {
- if ((time < (p.camping_time + CAMPING_TIME)))
- {
- n_camp = (n_camp + 1);
- }
- else
- {
- if ((time < (p.escort_time + ESCORT_TIME)))
- {
- n_escort = (n_escort + 1);
- }
- else
- {
- if ((p.bot_plan == BOT_ATTACK))
- {
- n_attack = (n_attack + 1);
- }
- else
- {
- if ((p.bot_plan == BOT_DEFEND))
- {
- n_defend = (n_defend + 1);
- }
- else
- {
- if ((p.bot_plan == 3))
- {
- n_roam = (n_roam + 1);
- }
- }
- }
- }
- }
- }
- n_bot = (n_bot + 1);
- }
- p = find (p, classname, "bot");
- }
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == self.team))
- {
- n_human = (n_human + 1);
- }
- p = find (p, classname, "player");
- }
- sprint (self, "\n");
- if ((self.team == TEAM_COLOR1))
- {
- sprint (self, "Òåä Team Status:\n");
- fenemyteam = TEAM_COLOR2;
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- sprint (self, "Âìõå Team Status:\n");
- fenemyteam = TEAM_COLOR1;
- }
- }
- if (map_has_waypoints)
- {
- st = ftos (n_attack);
- sprint (self, st);
- sprint (self, " attack, ");
- st = ftos (n_defend);
- sprint (self, st);
- sprint (self, " defend, ");
- st = ftos (n_roam);
- sprint (self, st);
- sprint (self, " roam\n");
- }
- st = ftos (n_escort);
- sprint (self, st);
- sprint (self, " escort, ");
- st = ftos (n_camp);
- sprint (self, st);
- sprint (self, " camp, ");
- if (n_flag)
- {
- sprint (self, "1 flag carrier");
- }
- sprint (self, "\n");
- };
- void (float fteam) MoreBotsDefend =
- {
- local entity p;
- local float found;
- if (!map_has_waypoints)
- {
- sprint (self, "map has no waypoints\n");
- sprint (self, "orders not possible\n");
- return;
- }
- found = FALSE;
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan == 3))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- p.bot_plan = BOT_DEFEND;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan == BOT_ATTACK))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- p.bot_plan = BOT_DEFEND;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if ((time < (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((p.bot_plan != BOT_DEFEND))
- {
- p.bot_plan = BOT_DEFEND;
- p.camping_time = (time - 99);
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if ((p.bot_plan != BOT_DEFEND))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time < (p.escort_time + ESCORT_TIME)))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- p.bot_plan = BOT_DEFEND;
- p.camping_time = (time - 99);
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
- {
- sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
- }
- sprint (self, self.netname);
- sprint (self, " orders ÄÅÆÅÎÄ‘ ");
- PrintTeamStatus (self.team);
- };
- void (float fteam) MoreBotsAttack =
- {
- local entity p;
- local float found;
- if (!map_has_waypoints)
- {
- sprint (self, "map has no waypoints\n");
- sprint (self, "orders not possible\n");
- return;
- }
- found = FALSE;
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if ((p.bot_plan == 3))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- p.bot_plan = BOT_ATTACK;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan == BOT_DEFEND))
- {
- p.bot_plan = BOT_ATTACK;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan != BOT_ATTACK))
- {
- p.bot_plan = BOT_ATTACK;
- p.camping_time = (time - 999);
- if ((p.camping_entity != world))
- {
- remove (p.camping_entity);
- p.camping_entity = world;
- }
- found = TRUE;
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time < (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan != BOT_ATTACK))
- {
- p.bot_plan = BOT_ATTACK;
- p.escort_time = (time - 999);
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
- {
- sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
- }
- sprint (self, self.netname);
- sprint (self, " orders ÁÔÔÁÃË‘ ");
- PrintTeamStatus (self.team);
- };
- void (float fteam) MoreBotsRoam =
- {
- local entity p;
- local float found;
- if (!map_has_waypoints)
- {
- sprint (self, "map has no waypoints\n");
- sprint (self, "orders not possible\n");
- return;
- }
- found = FALSE;
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan == BOT_ATTACK))
- {
- p.bot_plan = BOT_ROAM;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan == BOT_DEFEND))
- {
- p.bot_plan = BOT_ROAM;
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time < (p.camping_time + CAMPING_TIME)))
- {
- if ((time >= (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan != BOT_ROAM))
- {
- p.bot_plan = BOT_ROAM;
- p.camping_time = (time - 999);
- if ((p.camping_entity != world))
- {
- remove (p.camping_entity);
- p.camping_entity = world;
- }
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if (!found)
- {
- p = find (world, classname, "bot");
- while (((p != world) && !found))
- {
- if ((p.team == fteam))
- {
- if (!(p.player_flag & ITEM_ENEMY_FLAG))
- {
- if ((time >= (p.camping_time + CAMPING_TIME)))
- {
- if ((time < (p.escort_time + ESCORT_TIME)))
- {
- if ((p.bot_plan != BOT_ROAM))
- {
- p.bot_plan = BOT_ROAM;
- p.escort_time = (time - 999);
- found = TRUE;
- }
- }
- }
- }
- }
- p = find (p, classname, "bot");
- }
- }
- if ((!(temp1 & TEMP1_NOMESS) && (found == TRUE)))
- {
- sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
- }
- sprint (self, self.netname);
- sprint (self, " orders ÒÏÁÍ‘ ");
- PrintTeamStatus (self.team);
- };
- void (float fteam) AllBotsDefend =
- {
- local entity p;
- if (!map_has_waypoints)
- {
- sprint (self, "map has no waypoints\n");
- sprint (self, "orders not possible\n");
- return;
- }
- sprint (self, self.netname);
- sprint (self, " orders ");
- if ((self.team == TEAM_COLOR1))
- {
- sprint (self, "Òåä team to defend\n");
- last_order_time_team1 = time;
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- sprint (self, "Âìõå team to defend\n");
- last_order_time_team2 = time;
- }
- else
- {
- return;
- }
- }
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- p.bot_plan = BOT_DEFEND;
- }
- p = find (p, classname, "bot");
- }
- if (!(temp1 & TEMP1_NOMESS))
- {
- sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
- }
- };
- void (float fteam) AllBotsAttack =
- {
- local entity p;
- if (!map_has_waypoints)
- {
- sprint (self, "map has no waypoints\n");
- sprint (self, "orders not possible\n");
- return;
- }
- sprint (self, self.netname);
- sprint (self, " orders\n ");
- if ((self.team == TEAM_COLOR1))
- {
- sprint (self, "Òåä team to attack\n");
- last_order_time_team1 = time;
- }
- else
- {
- if ((self.team == TEAM_COLOR2))
- {
- sprint (self, "Âìõå team to attack\n");
- last_order_time_team2 = time;
- }
- else
- {
- return;
- }
- }
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if (((p.team == fteam) && !(p.player_flag & ITEM_ENEMY_FLAG)))
- {
- p.bot_plan = BOT_ATTACK;
- }
- p = find (p, classname, "bot");
- }
- if (!(temp1 & TEMP1_NOMESS))
- {
- sound (self, CHAN_VOICE, "misc/secret.wav", 1, ATTN_NORM);
- }
- };
- void () ToggleWaypoints =
- {
- local entity p;
- if (map_has_waypoints)
- {
- map_has_waypoints = FALSE;
- bprint ("waypoints disabled for ");
- }
- else
- {
- p = find (world, classname, "waypoint");
- if ((p != world))
- {
- map_has_waypoints = TRUE;
- bprint ("waypoints re-enabled for ");
- }
- else
- {
- if ((self.classname == "player"))
- {
- bprint ("no waypoints for ");
- }
- }
- }
- bprint (mapname);
- bprint ("\n");
- };
- entity (entity head) FindNextPlayerOrBot =
- {
- local entity h;
- h = head;
- if ((h.classname == "bot"))
- {
- h = find (h, classname, "bot");
- }
- else
- {
- h = find (h, classname, "player");
- if ((h == world))
- {
- h = find (world, classname, "bot");
- }
- }
- if (h.observer)
- h.team = -50;
- return (h);
- };
- void () RemoveAllBots =
- {
- local entity p,m;
- local entity old_self;
- local entity removebot;
- p = find (world, classname, "bot");
- if ((p != world))
- {
- while ((p != world))
- {
- old_self = self;
- self = p;
- self.skin = 0;
- set_suicide_frame ();
- self.flags = self.flags - FL_CLIENT;
- self.colormap = -1;
- clientSetFree (self.fClientNo);
- ClientDisconnect ();
- self = old_self;
- dropclient(p);
- remove (p);
- p = find (world, classname, "bot");
- }
- next_bot_num = 0;
- next_bot_red = 0;
- next_bot_blue = 0;
- botmastermind = 2;
- bprint ("All bots have been removed\n");
- waypoint_idle = 300;
- Waypoint_Toggle ();
- }
- };
- void () BotKeepTeamsEven =
- {
- local entity p;
- local entity oself;
- local float n_red;
- local float n_blue;
- local float i;
- local float svaim;
- local float tmp;
- local float added;
- local float bskill;
- local float bskill2;
- local float vary_skill;
- local string st;
- local float teamsize_blue;
- local float teamsize_red;
- if (intermission_running || gameover)
- return;
- /*
- if (!(temp1 & TEMP1_AUTO_EVEN_TEAMS))
- {
- return;
- }
- */
- n_red = action;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == TEAM_COLOR1))
- {
- n_red = (n_red + 1);
- }
- p = FindNextPlayerOrBot (p);
- }
- n_blue = action;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == TEAM_COLOR2))
- {
- n_blue = (n_blue + 1);
- }
- p = FindNextPlayerOrBot (p);
- }
- p = find (world, classname, "player");
- if ((p == world))
- {
- dprint ("No human players\n");
- //RemoveAllBots ();
- }
- //oself = self;
- //self = p;
- added = FALSE;
- svaim = cvar ("sv_aim");
- if (((svaim >= action) && (svaim <= 1)))
- {
- return;
- }
- bskill = action;
- if ((svaim & 1))
- {
- svaim = (svaim - 1);
- bskill = (bskill + 1);
- }
- if ((svaim & SPAWNFLAG_LASER))
- {
- svaim = (svaim - SPAWNFLAG_LASER);
- bskill = (bskill + SPAWNFLAG_LASER);
- }
- if ((svaim & TEAM_STATIC_TEAMS))
- {
- svaim = (svaim - TEAM_STATIC_TEAMS);
- vary_skill = TRUE;
- }
- else
- {
- vary_skill = FALSE;
- }
- bskill = (bskill + (svaim - floor (svaim)));
- svaim = floor (svaim);
- teamsize_blue = (svaim / 128);
- teamsize_blue = floor (teamsize_blue);
- svaim = (svaim - (teamsize_blue * 128));
- teamsize_red = (svaim / 4);
- teamsize_red = floor (teamsize_red);
- if ((n_red < teamsize_red))
- {
- i = (teamsize_red - n_red);
- bprint ("*keeping teams even:\nAdding ");
- st = ftos (i);
- bprint (st);
- bprint (" ÒÅÄ bots\n");
- added = TRUE;
- while ((i > action))
- {
- bskill2 = bskill;
- if (vary_skill)
- {
- bskill2 = (bskill2 + (random () - fAutoBotRand));
- }
- if ((bskill2 > 3))
- {
- bskill2 = 3;
- }
- if ((bskill2 < action))
- {
- bskill2 = action;
- }
- CreateRedBot (bskill2);
- i = (i - 1);
- }
- }
- else
- {
- if ((n_red > teamsize_red))
- {
- i = (n_red - teamsize_red);
- bprint ("keeping teams even:\nRemoving ");
- st = ftos (i);
- bprint (st);
- bprint (" ÒÅÄ bots\n");
- added = TRUE;
- while ((i > action))
- {
- RemoveBestBot (TEAM_COLOR1);
- i = (i - 1);
- }
- }
- }
- if ((n_blue < teamsize_blue))
- {
- i = (teamsize_blue - n_blue);
- bprint ("**keeping teams even:\nAdding ");
- st = ftos (i);
- bprint (st);
- bprint (" ÂÌÕÅ bots\n");
- added = TRUE;
- while ((i > action))
- {
- bskill2 = bskill;
- if (vary_skill)
- {
- bskill2 = (bskill2 + (random () - fAutoBotRand));
- }
- if ((bskill2 > 3))
- {
- bskill2 = 3;
- }
- if ((bskill2 < action))
- {
- bskill2 = action;
- }
- CreateBlueBot (bskill2);
- i = (i - 1);
- }
- }
- else
- {
- if ((n_blue > teamsize_blue))
- {
- i = (n_blue - teamsize_blue);
- bprint ("keeping teams even:\nRemoving ");
- st = ftos (i);
- bprint (st);
- bprint (" ÂÌÕÅ bots\n");
- added = TRUE;
- while ((i > action))
- {
- RemoveBestBot (TEAM_COLOR2);
- i = (i - 1);
- }
- }
- }
- //self = oself;
- };
- void () TempWaypointTouch =
- {
- if ((other.classname == "bot"))
- {
- remove (self);
- }
- };
- void (vector org, float timeout, float fteam) SpawnTempWaypoint =
- {
- local entity p;
- p = spawn ();
- p.classname = "waypoint_temp";
- p.team = fteam;
- p.solid = SOLID_TRIGGER;
- p.movetype = MOVETYPE_NONE;
- p.origin = org;
- setorigin (p, p.origin);
- setmodel (p, string_null);
- p.touch = TempWaypointTouch;
- p.think = SUB_Remove;
- p.nextthink = (time + timeout);
- };
- entity () SpawnFollow =
- {
- local entity p;
- p = spawn ();
- p.classname = "follow_ent";
- p.solid = SOLID_NOT;
- p.movetype = MOVETYPE_NONE;
- setmodel (p, string_null);
- p.origin = (self.origin + '0 0 16');
- setorigin (p, p.origin);
- p.owner = self;
- return (p);
- };
- void () SpawnFollowEntity =
- {
- local entity e;
- if ((time < (self.last_follow_spawn + LMQUOTA_ARMOR)))
- {
- return;
- }
- if ((self.num_follows > 3))
- {
- if ((self.follow_tail != world))
- {
- e = self.follow_tail.follow_prev;
- remove (self.follow_tail);
- self.follow_tail = e;
- self.num_follows = (self.num_follows - 1);
- }
- }
- e = SpawnFollow ();
- self.num_follows = (self.num_follows + 1);
- if ((self.follow_head == world))
- {
- e.follow_next = world;
- e.follow_prev = world;
- self.follow_head = e;
- self.follow_tail = e;
- }
- else
- {
- e.follow_next = self.follow_head;
- e.follow_prev = world;
- self.follow_head.follow_prev = e;
- self.follow_head = e;
- }
- self.last_follow_spawn = time;
- };
- void () SwitchBotNames =
- {
- local entity p;
- bots_have_normal_names = !bots_have_normal_names;
- if (bots_have_normal_names)
- {
- bprint ("Bots now have normal names\n");
- }
- else
- {
- bprint ("Bots now have bot names\n");
- }
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if (bots_have_normal_names)
- {
- p.netname = p.altname;
- }
- else
- {
- p.netname = p.botname;
- }
- p = find (p, classname, "bot");
- }
- };
- void (float fteam) ReportIn =
- {
- local entity p;
- local entity oldself;
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == fteam))
- {
- oldself = self;
- self = p;
- BotSayTeamStart2 ();
- if ((p.player_flag & ITEM_ENEMY_FLAG))
- {
- BotSayTeamMiddle ("Have Flag! Heading back with ");
- }
- else
- {
- if ((time < (p.camping_time + CAMPING_TIME)))
- {
- BotSayTeamMiddle ("I camp with ");
- }
- else
- {
- if ((time < (p.escort_time + ESCORT_TIME)))
- {
- BotSayMiddle ("I escort ");
- if ((p.escort_entity == world))
- {
- BotSayTeamMiddle ("???");
- }
- else
- {
- BotSayTeamMiddle (p.escort_entity.netname);
- }
- BotSayTeamMiddle (" with ");
- }
- else
- {
- if ((p.bot_plan == BOT_DEFEND))
- {
- BotSayTeamMiddle ("I defend with ");
- }
- else
- {
- if ((p.bot_plan == BOT_ATTACK))
- {
- BotSayTeamMiddle ("Heading to Enemy base with ");
- }
- else
- {
- if ((p.bot_plan == 3))
- {
- BotSayTeamMiddle ("I roam with ");
- }
- else
- {
- BotSayTeamMiddle ("???? with ");
- }
- }
- }
- }
- }
- }
- if (((p.items & IT_LIGHTNING) && (p.ammo_cells > action)))
- {
- BotSayTeamMiddle ("thunderbolt");
- }
- else
- {
- if (((p.items & IT_ROCKET_LAUNCHER) && (p.ammo_rockets > action)))
- {
- BotSayTeamMiddle ("rocket launcher");
- }
- else
- {
- if (((p.items & IT_GRENADE_LAUNCHER) && (p.ammo_rockets > action)))
- {
- BotSayTeamMiddle ("grenade launcher");
- }
- else
- {
- if (((p.items & IT_SUPER_NAILGUN) && (p.ammo_nails > action)))
- {
- BotSayTeamMiddle ("super nailgun");
- }
- else
- {
- if (((p.items & IT_NAILGUN) && (p.ammo_nails > action)))
- {
- BotSayTeamMiddle ("nailgun");
- }
- else
- {
- if (((p.items & IT_SUPER_SHOTGUN) && (p.ammo_shells > action)))
- {
- BotSayTeamMiddle ("double shotgun");
- }
- else
- {
- BotSayTeamMiddle ("shotgun");
- }
- }
- }
- }
- }
- }
- BotSayTeamEnd ();
- self = oldself;
- }
- p = find (p, classname, "bot");
- }
- };
- void () BotSaySomething =
- {
- if (bot_chatter_off)
- {
- return;
- }
- if ((random () < 0.001))
- {
- BotSayExtras ();
- }
- else
- {
- if (((time > (last_flag_capture + 3)) && (time < (last_flag_capture + SECRET_NO_SHOOT))))
- {
- BotSayDammit ();
- }
- else
- {
- if (((time > (last_flag_pickup + 3)) && (time < (last_flag_pickup + SECRET_NO_SHOOT))))
- {
- BotSayDefense ();
- }
- else
- {
- if (((time + TEAM_CAPTURE_CAPTURE_BONUS) > (cvar ("timelimit") * VOTEEXIT_TIME_LIMIT)))
- {
- BotSayGoodGame ();
- }
- else
- {
- if (((time > (self.last_kill_time + 3)) && (time < (self.last_kill_time + SECRET_NO_SHOOT))))
- {
- BotSayTaunt (self.last_kill_ent);
- }
- else
- {
- if (((time > (self.last_die_time + 3)) && (time < (self.last_die_time + SECRET_NO_SHOOT))))
- {
- BotSayNiceOne (self.last_die_ent);
- }
- }
- }
- }
- }
- }
- };
- void (entity p) BPrintFrags =
- {
- local string st;
- if ((p.frags < 1000))
- {
- bprint (" ");
- }
- if ((p.frags < 100))
- {
- bprint (" ");
- }
- if ((p.frags < TEAM_CAPTURE_CAPTURE_BONUS))
- {
- bprint (" ");
- }
- st = ftos (p.frags);
- bprint (st);
- bprint (" ");
- if ((p.team == TEAM_COLOR1))
- {
- bprint ("ÒÅÄ ");
- }
- else
- {
- if ((p.team == TEAM_COLOR2))
- {
- bprint ("ÂÌÕÅ ");
- }
- }
- bprint (p.netname);
- if ((p.classname == "bot"))
- {
- bprint (" [skill ");
- st = ftos (p.bot_skill);
- bprint (st);
- bprint ("]");
- }
- bprint ("\n");
- };
- void (entity p) PrintFrags =
- {
- local string st;
- if ((p.frags < 1000))
- {
- sprint (self, " ");
- }
- if ((p.frags < 100))
- {
- sprint (self, " ");
- }
- if ((p.frags < TEAM_CAPTURE_CAPTURE_BONUS))
- {
- sprint (self, " ");
- }
- st = ftos (p.frags);
- sprint (self, st);
- sprint (self, " ");
- if ((p.team == TEAM_COLOR1))
- {
- sprint (self, "ÒÅÄ ");
- }
- else
- {
- if ((p.team == TEAM_COLOR2))
- {
- sprint (self, "ÂÌÕÅ ");
- }
- }
- sprint (self, p.netname);
- if ((p.classname == "bot"))
- {
- sprint (self, " [skill ");
- st = ftos (p.bot_skill);
- sprint (self, st);
- sprint (self, "]");
- }
- sprint (self, "\n");
- };
- void (float broadcst) PrintFragList =
- {
- local entity p;
- local entity best;
- local float best_frags;
- local float done;
- if (((self.classname != "player") && !broadcst))
- {
- return;
- }
- p = find (world, classname, "player");
- while ((p != world))
- {
- p.bsort = FALSE;
- p = FindNextPlayerOrBot (p);
- }
- done = FALSE;
- if (broadcst)
- {
- bprint ("\nžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžŸ\n");
- bprint (" Òáîëéîçó‘\n");
- }
- else
- {
- sprint (self, "\nžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžžŸ\n");
- sprint (self, " Òáîëéîçó‘\n");
- }
- while (!done)
- {
- best_frags = action;
- best = world;
- p = find (world, classname, "player");
- while ((p != world))
- {
- if (!p.bsort)
- {
- if ((p.frags >= best_frags))
- {
- best = p;
- best_frags = p.frags;
- }
- }
- p = FindNextPlayerOrBot (p);
- }
- if ((best == world))
- {
- done = TRUE;
- }
- else
- {
- if (broadcst)
- {
- BPrintFrags (best);
- }
- else
- {
- PrintFrags (best);
- }
- best.bsort = TRUE;
- }
- }
- };
- void (float broadcst) PrintFragList0 =
- {
- local entity p;
- local float num_rbots;
- local float num_bbots;
- local float num_rhumans;
- local float num_bhumans;
- local string st;
- if (((self.classname != "player") && !broadcst))
- {
- return;
- }
- p = find (world, classname, "player");
- while ((p != world))
- {
- if ((p.team == TEAM_COLOR1))
- {
- num_rhumans = (num_rhumans + 1);
- }
- else
- {
- if ((p.team == TEAM_COLOR2))
- {
- num_bhumans = (num_bhumans + 1);
- }
- }
- if (broadcst)
- {
- BPrintFrags (p);
- }
- else
- {
- PrintFrags (p);
- }
- p = find (p, classname, "player");
- }
- p = find (world, classname, "bot");
- while ((p != world))
- {
- if ((p.team == TEAM_COLOR1))
- {
- num_rbots = (num_rbots + 1);
- }
- else
- {
- if ((p.team == TEAM_COLOR2))
- {
- num_bbots = (num_bbots + 1);
- }
- }
- if (broadcst)
- {
- BPrintFrags (p);
- }
- else
- {
- PrintFrags (p);
- }
- p = find (p, classname, "bot");
- }
- };
- void (float fteam) RemoveBestBot =
- {
- local entity best_bot;
- local entity bot;
- local float best_num;
- local string st;
- local entity old_self;
- local entity check;
- best_num = 99999997952;
- best_bot = world;
- bot = find (world, classname, "bot");
- while ((bot != world))
- {
- if (((bot.frags < best_num) && (bot.team == fteam)))
- {
- best_bot = bot;
- best_num = bot.frags;
- }
- bot = find (bot, classname, "bot");
- }
- if ((best_bot != world))
- {
- bprint (best_bot.netname);
- bprint (" [skill ");
- st = ftos (best_bot.bot_skill);
- bprint (st);
- bprint ("] has been removed\n");
- old_self = self;
- self = best_bot;
- self.skin = 0;
- set_suicide_frame ();
- clientSetFree (self.fClientNo);
- dropclient(self);
- ClientDisconnect ();
- self = old_self;
- //remove (best_bot);
- check = find (world, classname, "bot");
- if (!check)
- {
- waypoint_idle = 300;
- Waypoint_Toggle ();
- }
- }
- };
- void () InitCPU =
- {
- local float cur_bot_cpu;
- cur_bot_cpu = 0.9;
- large_pulse_dist_base = 1000;
- awareness_dist_base = 300;
- item_large_pulse_dist_base = 400;
- item_awareness_dist_base = 300;
- large_pulse_dist = (large_pulse_dist_base * cur_bot_cpu);
- awareness_dist = (awareness_dist_base * cur_bot_cpu);
- item_large_pulse_dist = (item_large_pulse_dist_base * cur_bot_cpu);
- item_awareness_dist = (item_awareness_dist_base * cur_bot_cpu);
- };
- void (float fteam) StartNewPath =
- {
- if ((fteam == TEAM_COLOR1))
- {
- dprint ("Staring new ÒÅÄ path\n");
- current_red_waypoint = action;
- }
- else
- {
- if ((fteam == TEAM_COLOR2))
- {
- dprint ("Staring new ÂÌÕÅ path\n");
- current_blue_waypoint = action;
- }
- else
- {
- error ("Bogus team\n");
- }
- }
- sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
- dprint ("Remember to use -condebug option!\n");
- spawning_waypoints = TRUE;
- spawning_general_waypoints = FALSE;
- };
- void () StartNewGeneralPath =
- {
- dprint ("Staring new general path\n");
- current_waypoint = action;
- sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
- dprint ("Remember to use -condebug option!\n");
- spawning_waypoints = TRUE;
- spawning_general_waypoints = TRUE;
- };
- void (float make_visible) SetWaypointsVisible =
- {
- local entity e;
- e = find (world, classname, "waypoint");
- while ((e != world))
- {
- if (make_visible)
- {
- setmodel (e, "progs/s_bubble.spr");
- }
- else
- {
- setmodel (e, string_null);
- }
- e = find (e, classname, "waypoint");
- }
- };
- void () PrintCloseWaypoint =
- {
- local entity e;
- if ((spawning_waypoints || bot_debug))
- {
- e = find (world, classname, "waypoint");
- while ((e != world))
- {
- if ((vlen ((self.origin - e.origin)) < TEAM_CAPTURE_FLAG_RETURN_TIME))
- {
- if ((e.team == TEAM_COLOR1))
- {
- dprint ("ÒÅÄ");
- }
- else
- {
- if ((e.team == TEAM_COLOR2))
- {
- dprint ("ÂÌÕÅ");
- }
- else
- {
- if ((e.team == -1))
- {
- dprint ("general");
- }
- else
- {
- error ("Bogus team\n");
- }
- }
- }
- if ((e.waypoint_num == -1))
- {
- dprint ("Defensive waypoint\n");
- }
- else
- {
- dprint (" waypoint number ");
- dprintfloat (e.waypoint_num);
- dprint ("\n");
- }
- }
- e = find (e, classname, "waypoint");
- }
- e = find (world, classname, "inaccessible_from_here");
- while ((e != world))
- {
- e = find (e, classname, "inaccessible_from_here");
- }
- }
- };
- void () PrintWaypoints =
- {
- local entity e;
- dprint ("============\n");
- dprint ("============\n");
- dprint ("waypoints for ");
- dprint (mapname);
- dprint ("\n\n");
- dprint ("============\n");
- dprint ("============\n");
- dprint (" else if (mname == ");
- dprint ("\"");
- dprint (mapname);
- dprint ("\")\n {\n // CTF Bot 1.3 waypoints by ");
- dprint (self.netname);
- dprint ("\n\n");
- e = find (world, classname, "waypoint");
- while ((e != world))
- {
- dprint (" SpawnWaypointNum('");
- dprintfloat (e.origin_x);
- dprint (" ");
- dprintfloat (e.origin_y);
- dprint (" ");
- dprintfloat (e.origin_z);
- dprint ("', ");
- dprintfloat (e.team);
- dprint (", ");
- dprintfloat (e.waypoint_num);
- dprint (", us);\n");
- e = find (e, classname, "waypoint");
- }
- dprint (" return TRUE;\n }\n\n");
- dprint ("============\n");
- dprint ("============\n");
- sound (self, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NONE);
- dprint ("no longer spawning waypoints\n");
- spawning_waypoints = FALSE;
- };
- void () OrderCamping =
- {
- local entity head;
- local entity selected;
- local entity e;
- local entity oldself;
- local float dist;
- if ((self.classname != "player"))
- {
- return;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if ((vlen ((head.origin - self.origin)) < dist))
- {
- selected = head;
- dist = vlen ((head.origin - self.origin));
- }
- }
- }
- }
- head = head.chain;
- }
- if ((selected != world))
- {
- if (selected.camping_entity)
- {
- remove (selected.camping_entity);
- selected.camping_entity = world;
- }
- e = spawn ();
- e.classname = "waypoint";
- e.origin = (self.origin + '0 0 16');
- setorigin (e, e.origin);
- e.solid = SOLID_NOT;
- e.movetype = MOVETYPE_NONE;
- setmodel (e, string_null);
- setsize (e, VEC_ORIGIN, VEC_ORIGIN);
- e.nextthink = ((time + CAMPING_TIME) + 1);
- e.think = SUB_Remove;
- selected.camping_entity = e;
- oldself = self;
- self = selected;
- BotSayTeamStart2 ();
- if ((time < (self.escort_time + ESCORT_TIME)))
- {
- BotSayTeamMiddle ("I'll stop escorting ");
- if ((self.escort_entity == oldself))
- {
- BotSayTeamMiddle ("you");
- }
- else
- {
- BotSayTeamMiddle (self.escort_entity.netname);
- }
- BotSayTeamMiddle (" and camp here, ");
- self.escort_time = (time - 999);
- self.escort_entity = world;
- }
- else
- {
- BotSayTeamMiddle ("I'll camp here, ");
- }
- BotSayTeamMiddle (oldself.netname);
- BotSayTeamEnd ();
- self = oldself;
- selected.camping_spot = e.origin;
- selected.camping_time = time;
- }
- else
- {
- sprint (self, "No bot nearby\n");
- }
- };
- void () OrderEscort =
- {
- local entity head;
- local entity selected;
- local entity e;
- local entity oldself;
- local float dist;
- if ((self.classname != "player"))
- {
- return;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if ((vlen ((head.origin - self.origin)) < dist))
- {
- selected = head;
- dist = vlen ((head.origin - self.origin));
- }
- }
- }
- }
- head = head.chain;
- }
- if ((selected != world))
- {
- selected.escort_entity = self;
- selected.escort_time = time;
- oldself = self;
- self = selected;
- BotSayTeamStart2 ();
- if ((time < (self.camping_time + CAMPING_TIME)))
- {
- BotSayTeamMiddle ("I'll stop camping and escort you, ");
- self.camping_time = (time - 999);
- if ((self.camping_entity != world))
- {
- remove (self.camping_entity);
- self.camping_entity = world;
- }
- }
- else
- {
- BotSayTeamMiddle ("I'll escort you, ");
- }
- BotSayTeamMiddle (oldself.netname);
- BotSayTeamEnd ();
- self = oldself;
- }
- else
- {
- sprint (self, "No bot nearby\n");
- }
- };
- void () OrderDropStuff =
- {
- local entity head;
- local entity selected;
- local entity e;
- local entity oldself;
- local entity item;
- local float dist;
- local float oldweapon;
- if ((self.classname != "player"))
- {
- return;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if (((!(teamplay & TEAM_NO_RUNE_DROP) && (head.player_flag & ITEM_RUNE_MASK)) && !(self.player_flag & ITEM_RUNE_MASK)))
- {
- oldself = self;
- self = head;
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I dropped ");
- if ((head.player_flag & ITEM_RUNE1_FLAG))
- {
- BotSayTeamMiddle ("Resistance");
- }
- else
- {
- if ((head.player_flag & ITEM_RUNE2_FLAG))
- {
- BotSayTeamMiddle ("Strength");
- }
- else
- {
- if ((head.player_flag & ITEM_RUNE3_FLAG))
- {
- BotSayTeamMiddle ("Haste");
- }
- else
- {
- if ((head.player_flag & ITEM_RUNE4_FLAG))
- {
- BotSayTeamMiddle ("Regeneration");
- }
- }
- }
- }
- BotSayTeamEnd ();
- item = PlayerDropRune ();
- if ((item != world))
- {
- item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
- item.bot_ignore_team = self.team;
- }
- self = oldself;
- return;
- }
- }
- }
- }
- head = head.chain;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_LIGHTNING)) && (head.ammo_cells > action)) && !(self.items & IT_LIGHTNING)))
- {
- oldself = self;
- self = head;
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I dropped lightning gun");
- BotSayTeamEnd ();
- oldweapon = self.weapon;
- self.weapon = IT_LIGHTNING;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- item = TossWeaponBackpack (IT_LIGHTNING, oldself);
- if ((item != world))
- {
- item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
- item.bot_ignore_team = self.team;
- }
- self.weapon = oldweapon;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- self = oldself;
- return;
- }
- }
- }
- }
- head = head.chain;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_ROCKET_LAUNCHER)) && (head.ammo_rockets > action)) && !(self.items & IT_ROCKET_LAUNCHER)))
- {
- oldself = self;
- self = head;
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I dropped rocket launcher");
- BotSayTeamEnd ();
- oldweapon = self.weapon;
- self.weapon = IT_ROCKET_LAUNCHER;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- item = TossWeaponBackpack (IT_ROCKET_LAUNCHER, oldself);
- if ((item != world))
- {
- item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
- item.bot_ignore_team = self.team;
- }
- self.weapon = oldweapon;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- self = oldself;
- return;
- }
- }
- }
- }
- head = head.chain;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_GRENADE_LAUNCHER)) && (head.ammo_rockets > action)) && !(self.items & IT_GRENADE_LAUNCHER)))
- {
- oldself = self;
- self = head;
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I dropped grenade launcher");
- BotSayTeamEnd ();
- oldweapon = self.weapon;
- self.weapon = IT_GRENADE_LAUNCHER;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- item = TossWeaponBackpack (IT_GRENADE_LAUNCHER, oldself);
- if ((item != world))
- {
- item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
- item.bot_ignore_team = self.team;
- }
- self.weapon = oldweapon;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- self = oldself;
- return;
- }
- }
- }
- }
- head = head.chain;
- }
- head = findradius (self.origin, 600);
- dist = 999999;
- while (head)
- {
- if ((head.classname == "bot"))
- {
- if ((head.team == self.team))
- {
- if (BotCanSeeItem (head))
- {
- if (((((teamplay & TEAM_DROP_ITEMS) && (head.items & IT_SUPER_NAILGUN)) && (head.ammo_nails > action)) && !(self.items & IT_SUPER_NAILGUN)))
- {
- oldself = self;
- self = head;
- BotSayTeamStart2 ();
- BotSayTeamMiddle ("I dropped super nailgun");
- BotSayTeamEnd ();
- oldweapon = self.weapon;
- self.weapon = IT_SUPER_NAILGUN;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- item = TossWeaponBackpack (IT_SUPER_NAILGUN, oldself);
- if ((item != world))
- {
- item.bot_ignore_until_time = (time + TEAM_CAPTURE_CAPTURE_BONUS);
- item.bot_ignore_team = self.team;
- }
- self.weapon = oldweapon;
- if ((temp1 & TEMP1_MULTI))
- {
- set_player_weapon ();
- }
- self = oldself;
- return;
- }
- }
- }
- }
- head = head.chain;
- }
- sprint (self, "Nothing to drop\n");
- };
- void () PrintWaypointList =
- {
- local entity p;
- local float nm;
- local float nm2;
- nm = action;
- dprint ("----\n");
- dprint ("red\n");
- p = wp_first_red;
- while ((p != world))
- {
- nm = (nm + 1);
- dprint ("waypoint ");
- dprintfloat (p.team);
- dprint (" ");
- dprintfloat (p.waypoint_num);
- dprint ("\n");
- if ((p.wp_chain == world))
- {
- if ((p == wp_last_red))
- {
- dprint ("list terminated correctly\n");
- }
- else
- {
- dprint ("list terminated INCORRECTLY\n");
- }
- }
- p = p.wp_chain;
- }
- dprint ("----\n");
- dprint ("blue\n");
- p = wp_first_blue;
- while ((p != world))
- {
- nm = (nm + 1);
- dprint ("waypoint ");
- dprintfloat (p.team);
- dprint (" ");
- dprintfloat (p.waypoint_num);
- dprint ("\n");
- if ((p.wp_chain == world))
- {
- if ((p == wp_last_blue))
- {
- dprint ("list terminated correctly\n");
- }
- else
- {
- dprint ("list terminated INCORRECTLY\n");
- }
- }
- p = p.wp_chain;
- }
- dprint ("----\n");
- dprint ("general\n");
- p = wp_first_general;
- while ((p != world))
- {
- nm = (nm + 1);
- dprint ("waypoint ");
- dprintfloat (p.team);
- dprint (" ");
- dprintfloat (p.waypoint_num);
- dprint ("\n");
- if ((p.wp_chain == world))
- {
- if ((p == wp_last_general))
- {
- dprint ("list terminated correctly\n");
- }
- else
- {
- dprint ("list terminated INCORRECTLY\n");
- }
- }
- p = p.wp_chain;
- }
- dprint ("----\n");
- dprintfloat (nm);
- dprint (" linked waypoints\n");
- nm2 = action;
- p = find (world, classname, "waypoint");
- while ((p != world))
- {
- nm2 = (nm2 + 1);
- p = find (p, classname, "waypoint");
- }
- dprintfloat (nm2);
- dprint (" waypoints\n");
- if ((nm != nm2))
- {
- dprint ("ERROR\n");
- }
- };
- void (entity wp) InsertWaypointLink =
- {
- if ((wp.team == TEAM_COLOR1))
- {
- if ((wp_first_red == world))
- {
- wp_first_red = wp;
- wp_last_red = wp;
- }
- else
- {
- wp_last_red.wp_chain = wp;
- wp_last_red = wp;
- wp_last_red.wp_chain = world;
- }
- }
- else
- {
- if ((wp.team == TEAM_COLOR2))
- {
- if ((wp_first_blue == world))
- {
- wp_first_blue = wp;
- wp_last_blue = wp;
- }
- else
- {
- wp_last_blue.wp_chain = wp;
- wp_last_blue = wp;
- wp_last_blue.wp_chain = world;
- }
- }
- else
- {
- if ((wp.team == -1))
- {
- if ((wp_first_general == world))
- {
- wp_first_general = wp;
- wp_last_general = wp;
- }
- else
- {
- wp_last_general.wp_chain = wp;
- wp_last_general = wp;
- wp_last_general.wp_chain = world;
- }
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement