This is a butt-simple tutorial, but it may give your bot a little personality. For the longest time, there wasn't one Quake bot who ever stopped running. That's all bots did for like a year after Quake came out, just ran and ran and never stopped.
Maybe that's no big deal, but it sure is boring. If you want your bot to look like a real player, sometimes he has to act like one. Sometimes that includes camping near good weapons.
Even though the native Tutor Bot source code does not yet pick up items per se, this can still be a nifty little feature. If you are still using bot_grab_items(), open tutor.qc and scroll down to that routine, which looks like this:
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void() bot_grab_items = // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ { // sees if he's close enough to pick that item up if (self.goalentity == world) return; if (vlen(self.origin - self.goalentity.origin) <= 70) {We want to put another if ... then condition inside this one. So after that bracket we want to add this crap:
if (self.goalentity.classname == "weapon_rocketlauncher" && time > self.pausetime + 15) { self.pausetime = time + 120; self.think = self.th_stand; self.nextthink = time + 0.1; }Alright, it's time for one of my famous "English" explanations:
"If I'm within 70 units of my goal, and my goal is a rocket launcher, and I haven't camped in the last 15 seconds, I will decide to just stand here for two minutes."
Well, whatever you say about my AI knowledge, I'm sure good at English, huh?
The "&& time > self.pausetime + 15" is necessary because after those 120 seconds, he would still be touching the same item and decide to camp all over again. Life is messy sometimes.
Okay, so you may not use bot_grab_items() anymore; you may have altered the code in items.qc to allow your bot to pick up things directly. If so, open up that file and slip down to the sub called weapon_touch(). Toward the middle you shouldsee this:
else if (self.classname == "weapon_rocketlauncher") {Right after the bracket, add this:
if (other.classname == "bot" && time > other.pausetime + 15) { other.pausetime = time + 120; other.think = other.th_stand; other.nextthink = time + 0.1; }Hmm, interesting. This is something we haven't seen too much of at the AI Cafe, yet I use this technique. Here, the rocket launcher itself is telling the bot to camp for two minutes. This is helpful because the bot doesn't have to do any work.