From 5065ca5641d767ada3e1c4a98a6860c941a85345 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 25 Dec 2018 19:49:40 +0100 Subject: [PATCH] Bot AI: allow turning in a more natural way when a low skilled bot is walking --- qcsrc/server/bot/default/aim.qc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/bot/default/aim.qc b/qcsrc/server/bot/default/aim.qc index 633fdf243..c69442f19 100644 --- a/qcsrc/server/bot/default/aim.qc +++ b/qcsrc/server/bot/default/aim.qc @@ -206,6 +206,11 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation) // invalid aim dir (can happen when bot overlaps target) if(!v) return; + float skill_save = skill; + // allow turning in a more natural way when bot is walking + if (!this.bot_aimtarg) + skill = max(4, skill); + // get the desired angles to aim at //dprint(" at:", vtos(v)); v = normalize(v); @@ -326,6 +331,8 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation) //if (diffang_y >= 180) // diffang_y = diffang_y - 360; + skill = skill_save; + //dprint("e ", vtos(diffang), " < ", ftos(maxfiredeviation), "\n"); // decide whether to fire this time @@ -340,8 +347,6 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation) } //dprint(ftos(maxfiredeviation),"\n"); //dprint(" diff:", vtos(diffang), "\n"); - - //return this.bot_canfire && (time < this.bot_firetimer); } vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay) -- 2.39.2