Inside3D tutorials.
Created By: | Pob the Impaler (Paul Johnstone) |
eMail: | itac025@lauder.ac.uk |
Difficulty Scale: | Medium |
All of this is done in Bot_ai.qc so open it up and find the function runawayfloat () RunAway = { At the top add: //---Begin Code---// local float runawayspeakchance; runawayspeakchance = random(); // this is the chance that a bot will speak //---End Code---// Now find: if ( (self.enemy.items & IT_INVULNERABILITY) ) { beneath this line add: //---Begin Code---// if (runawayspeakchance <= 0.1) { bprint(self.netname); bprint(": Run for it, "); bprint(self.enemy.netname); bprint(" has a pentagram of protection!\n"); } //---End Code---// Now find: if ( (self.health < 45.000) ) { under this line add: //---Begin Code---// if (runawayspeakchance <= 0.001) { bprint(self.netname); bprint(": I'm low on health!\n"); } if ((runawayspeakchance <= 0.002) && (runawayspeakchance > 0.001)) { bprint(self.netname); bprint(": Run Away!\n"); } //---End Code---// Now find: if ( (self.enemy.items & IT_QUAD) ) { under this line add: //---Begin Code---// if (runawayspeakchance <= 0.1) { bprint(self.netname); bprint(": Run for it, "); bprint(self.enemy.netname); bprint(" has Quad Damage!\n"); } //---End Code---// Now find: if ( (self.enemy.weapon & ((IT_ROCKET_LAUNCHER + IT_LIGHTNING) + IT_SUPER_NAILGUN)) ) { under this line add: //---Begin Code---// if (runawayspeakchance <= 0.1) { bprint(self.netname); bprint(": Run for it, "); bprint(self.enemy.netname); bprint(" is totally tooled up!\n"); } //---End Code---// Now find: if ( (self.health < 70.000) ) { under this line add: //---Begin Code---// if (runawayspeakchance <= 0.1) { bprint(self.netname); bprint(": I'm being mobbed!"); } //---End Code---//
Find the function Bot FoundTargetfloat () BotFoundTarget = { At the top add this: (you'd be quicker using cut & paste here) //---Begin Code---// local float huntspeakchance; huntspeakchance = random(); //---End Code---// Now find: BotHuntTarget (); under this line add: //---Begin Code---// if (huntspeakchance <= 0.01) { bprint(self.netname); bprint(": I'm gonna rip your heart out "); bprint(self.enemy.netname); bprint("!\n"); } if ((huntspeakchance <= 0.02) && (huntspeakchance > 0.01)) { bprint(self.netname); bprint(": This is gonna hurt you so much "); bprint(self.enemy.netname); bprint("!\n"); } if ((huntspeakchance <= 0.03) && (huntspeakchance > 0.02)) { bprint(self.netname); bprint(": I can see you "); bprint(self.enemy.netname); bprint("!\n"); } if ((huntspeakchance <= 0.04) && (huntspeakchance > 0.03)) { bprint(self.netname); bprint(": You are so dead "); bprint(self.enemy.netname); bprint("!\n"); } if ((huntspeakchance <= 0.05) && (huntspeakchance > 0.04)) { bprint(self.netname); bprint(": "); bprint(self.enemy.netname); bprint(" is going to die in about 10 seconds"); bprint("!\n"); } if ((huntspeakchance <= 0.006) && (huntspeakchance > 0.005)) { bprint(self.netname); bprint(": "); bprint(self.enemy.netname); bprint(" has 5 seconds to live"); bprint("!\n"); } if ((huntspeakchance <= 0.007) && (huntspeakchance > 0.006)) { bprint(self.netname); bprint(": This ain't no party, it's a freakin' GIB-FEST!\n"); } if ((huntspeakchance <= 0.008) && (huntspeakchance > 0.007)) { bprint(self.netname); bprint(": Come on you Gib-Meat newbies, I'll frag you all!\n"); } if ((huntspeakchance <= 0.009) && (huntspeakchance > 0.008)) { bprint(self.netname); bprint(": Try taking the safety off "); bprint(self.enemy.netname); bprint(" HA HA!\n"); } if ((huntspeakchance <= 0.010) && (huntspeakchance > 0.009)) { bprint(self.netname); bprint(": GIB GIB GIB GIB BLOOD GIB GIB SPOOGE!\n"); } if ((huntspeakchance <= 0.011) && (huntspeakchance > 0.010)) { bprint(self.netname); bprint(": What's the matter "); bprint(self.enemy.netname); bprint("? Has you're gun jammed?\n"); } //---End Code---// Now save and compile!
Step 3
Actually we might as well put CallForHelp in while we're at it.... Step 3. Open bot_ai.qc again Find the function CallForHelpvoid () CallForHelp = { Make it look like this (sorry I can't just say what lines to change, 'cos a lot has changed in it!) (You would probably be safer just using copy & paste for this..) //---Begin Code---// void () CallForHelp = { local entity e; local entity p; local entity tmp; local float d; local entity protect; // protect is the beastie that the player needs protecting from. HELPING = TRUE; if (self.classname == "player") { sprint(self,self.netname); sprint(self,": Help Me!\n"); } e = find (world,classname,"dmbot"); while ( e ) { if ( (e != self) ) { if ( (e.team == self.team) || (coop == 1) ) { if ( (e.health > 80.000) ) { p = BestChaseRoute (e,self.enemy); traceline (e.origin,self.enemy.origin,TRUE,e); if ( ((trace_fraction == TRUE) || (p.enemycache == self.enemy)) ) { e.enemy = self.enemy; if (self.classname == "player") { protect = findradius(self.origin,8000); while (protect) { if ((protect.enemy.classname == "player") && (protect.flags & FL_MONSTER)) // protect agains monsters { e.enemy = protect; p = BestChaseRoute (e,e.enemy); sprint (self,e.teamname); sprint (self,e.netname); sprint (self,": I'm coming to help you nail that "); sprint(self,e.enemy.classname); sprint(self,"\n"); } if ((protect.enemy == self) && (protect.classname == "dmbot")) // protect against enemy bots { e.enemy = protect; p = BestChaseRoute (e,e.enemy); sprint (self,e.teamname); sprint (self,e.netname); sprint (self,": I'm coming to help you nail "); sprint(self,e.enemy.netname); sprint(self,"\n"); } protect = protect.chain; } } tmp = self; self = e; BotFoundTarget (); if ( (self.goalentity.classname != "BotTarget") ) { objerror ("bad bot target in bot_ai! 1\n"); } setorigin (self.goalentity,p.origin); self = tmp; } } } } e = find (e,classname,"dmbot"); } HELPING = FALSE; }; //---End Code---// Now save and open bot_imp.qc Find the function botRestrictedCommand void () botRestrictedCommand = { Find the line: if ( (self.impulse == 217.000) ) { delete the lines: tmp = ftos (NUMPATHS); dprint (tmp); dprint (" botpaths placed\n"); now add: //---Begin Code---// CallForHelp() //---End Code---// Underneath this line there should be a line which reads: DropBotPath(); If it isn't there, then add it. Ok now save and compile. In the game, bind a key (like "h") to impulse 217 You will now be able to call for help if you are under attack from enemy teambots or monsters!! |=========================================================| Well that's it folks! see 'ya next time!