home *** CD-ROM | disk | FTP | other *** search
- /*
- ==============================================================================
-
- BOT
-
- ==============================================================================
- */
-
- // Prototypes
-
- void () botrespawn;
- void () Bot_Precache;
- void () BotCreate;
- void () four; // BGADMbot - Spawn 4 in one impulse
- void () BotFire;
- entity () SelectSpawnPoint;
- void (vector org, vector vec) LaunchLaser;
- void (vector org) spawn_tfog;
-
- void (vector org, entity death_owner) spawn_tdeath;
- //=============================================================
- // Bot_Precache - called by Worldspawn
- //=============================================================
- void () Bot_Precache =
- {
- precache_model2 ("progs/enforcer.mdl");
- precache_model2 ("progs/h_mega.mdl");
- precache_model2 ("progs/laser.mdl");
-
- precache_sound2 ("enforcer/death1.wav");
- precache_sound2 ("enforcer/enfire.wav");
- precache_sound2 ("enforcer/enfstop.wav");
- precache_sound2 ("enforcer/idle1.wav");
- precache_sound2 ("enforcer/pain1.wav");
- precache_sound2 ("enforcer/pain2.wav");
- precache_sound2 ("enforcer/sight1.wav");
- precache_sound2 ("enforcer/sight2.wav");
- precache_sound2 ("enforcer/sight3.wav");
- precache_sound2 ("enforcer/sight4.wav");
- };
-
-
- //=============================================================
- // BotActivate - Activates the bot
- //=============================================================
- void () BotCreate =
- {
- // sounds and models precached in the world.qc file
-
- local entity newbot;
- local entity spot;
- local float cyc,one,two;
-
- newbot = spawn();
- totalbots=totalbots + 1; //* BGADMbot - for counting bots, this will
- // come in handy for rankings; defined in
- // defs.qc as global
- newbot.whichbot = totalbots;
- newbot.solid = SOLID_SLIDEBOX;
- newbot.movetype = MOVETYPE_STEP;
-
- newbot.angles = self.angles;
- newbot.classname = "bot";
- newbot.health = 250; //* BGADMbot - changed to 250 for
- newbot.max_health = 250; // more challenge
- newbot.takedamage = DAMAGE_AIM;
- newbot.goalentity = self;
- newbot.movetarget = self;
- newbot.pausetime = time + 2;
- newbot.ideal_yaw = newbot.angles * '0 1 0';
- newbot.yaw_speed = 90;
- newbot.weapon = 2;
- newbot.ammo_shells = 100;
- newbot.view_ofs = '0 0 25';
- newbot.th_stand = bot_stand1;
- newbot.th_walk = bot_walk1;
- newbot.th_run = bot_run1;
- newbot.th_pain = bot_pain;
- newbot.th_die = bot_die;
- newbot.th_missile = bot_atk1;
- setmodel (newbot, "progs/enforcer.mdl");
- setsize (newbot, '-16 -16 -24', '16 16 40');
-
-
-
- spot=SelectSpawnPoint(); //*BGADMbot - for finding a deathmatch origin
-
- newbot.netname="bot"; //* BGADMbot - sets netname and frags,
- newbot.frags=0; // if i could figure
- // rankings, this would help
-
-
- setorigin(newbot, spot.origin);
- spawn_tdeath(newbot.origin, newbot);
-
- spawn_tfog (newbot.origin + v_forward*20);
- bprint("New Bot Created \n");
-
- newbot.nextthink = time + 0.1;
- newbot.think = newbot.th_stand;
- };
-
- /*
- ==============================================
- BotFire - Have bot fire at its current target
- ==============================================
- */
- void () BotFire =
- {
- // local entity oldself;
- local vector org;
-
- // oldself = self;
- // self = self.bot;
-
- if (self.enemy != world && self.enemy.health > 1
- && !(self.enemy.items & IT_INVISIBILITY) && visible(self.enemy))
- {
- sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
- enforcer_fire();
- }
- else
- {
- sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
- self.effects = self.effects | EF_MUZZLEFLASH;
- makevectors (self.angles);
- org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
- LaunchLaser(org, v_forward);
- }
-
- // self = oldself;
- return;
- };
- //* BGADMbot - NEW RESPAWN - this "respawns" the current bot that died //
- // without actually doing a spawn so that the current bot is still active,
- // and thus all stats not changed here are still in effect //
-
- void () botrespawn = {
- local entity spot;
- self.solid = SOLID_SLIDEBOX;
- self.movetype = MOVETYPE_STEP;
-
- self.angles = self.angles;
- self.classname = "bot";
- self.health = 250;
- self.max_health = 250;
- self.takedamage = DAMAGE_AIM;
- self.deadflag = DEAD_NO;
- self.goalentity = self;
- self.movetarget = self;
- self.pausetime = time + 2;
- self.ideal_yaw = self.angles * '0 1 0';
- self.yaw_speed = 90;
- self.items=IT_SHOTGUN & IT_AXE;
-
- self.weapon = 2;
- self.ammo_shells = 100;
- self.view_ofs = '0 0 25';
- self.th_stand = bot_stand1;
- self.th_walk = bot_walk1;
- self.th_run = bot_run1;
- self.th_pain = bot_pain;
- self.th_die = bot_die;
- self.th_missile = bot_atk1;
- setmodel (self, "progs/enforcer.mdl");
- setsize (self, '-16 -16 -24', '16 16 40');
- spot = SelectSpawnPoint();
- setorigin(self, spot.origin);
- spawn_tfog (self.origin + v_forward*20);
- spawn_tdeath(self.origin, self);
- bprint ("Bot respawned\n");
- if (random () < 0.25) { // prints the total number of bots
- bprint ("Total Bots: "); // originally for debugging
- bprint (ftos(totalbots));
- bprint ("\n");
- }
- bot_stand1();
- };
-
- //** Spawn 4 bots with one impulse **//
- void () four = {
- local float detour;
- detour=4;
- while (detour>0) {
- BotCreate();
- detour=detour - 1;
- }
-
- };
-