Lets be honest now. The tutor bot can't hit moving targets. This is simply a fact. I want it to be an opinion.
Think of it this way. You have a bot shooting straight at you, but if you strafe out of the way, he will simply miss. If you simply strafe constantly in one direction, he will NEVER hit you. This has to change.
If you did this in a 'real' deathmatch, your opponent would counter this by shooting a little in front of you (lead you), so that by the time the shot reached you, you would be where the shot was directed. This bot doesn't do this. I'm going to make it do it.
This tutorial is pretty short, so let's begin. Open up tutor.qc and scroll down to bot_aim_at_enemy(). It should look a little like this:
// ------------------------------------- vector() bot_aim_at_enemy = // ------------------------------------- { return normalize(self.enemy.origin - self.origin); };Now replace that WHOLE thing with this:
// ------------------------------------- vector() bot_aim_at_enemy = // ------------------------------------- { if (self.weapon == IT_SHOTGUN || self.weapon == IT_SUPER_SHOTGUN || self.weapon == IT_LIGHTNING) return normalize((self.enemy.origin - self.enemy.velocity * 0.15) - self.origin); else return bot_lead(); };Now there is a bit to understand in there. The routine decides whether the bot is firing a shotgun/lightning gun or a projectile weapon. If the bot has fired a shotgun/thunderbolt, it runs the next line. Simple, eh?
// ------------------------------------- vector () bot_lead = // ------------------------------------- { local vector targ_loc, dir; local float move_fract, speedy; local entity targ; targ = self.enemy; speedy = 1000; if (self.weapon == IT_GRENADE_LAUNCHER) speedy = 500; move_fract = vlen(targ.origin - self.origin)*1.000 / (speedy - vlen(targ.velocity)*1.000); targ_loc = targ.origin + targ.velocity * move_fract; traceline (self.origin, targ_loc, TRUE, self); if (trace_fraction == 1) { dir = targ_loc - self.origin; dir = normalize(dir); return dir; } else return targ.origin; };Don't even attempt to understand this code. I don't understand all of it, and I wrote the thing! It's just maths which tells the bot to aim a certain amount in front of the target. The amount is worked out based on the target's velocity, the distance between the bot and the target and the velocity of the projectile. But you don't need to know any of that.