From e5adccb9626217b44fb561de1780642e04b16dc4 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 9 Jun 2018 15:16:06 +0200 Subject: [PATCH] Bot AI: improve flag carrier escort role --- qcsrc/server/mutators/mutator/gamemode_ctf.qc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 1b3e54407..059af1e49 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -1515,7 +1515,12 @@ void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale) if (head) { if (head.ctf_status == FLAG_CARRY) + { + // adjust rating of our flag carrier depending on his health head = head.tag_entity; + float f = bound(0, (head.health + head.armorvalue) / 100, 2) - 1; + ratingscale += ratingscale * f * 0.1; + } navigation_routerating(this, head, ratingscale, 10000); } } @@ -1737,8 +1742,7 @@ void havocbot_role_ctf_escort(entity this) // If the flag carrier reached the base switch to defense mf = havocbot_ctf_find_flag(this); - if(mf.ctf_status!=FLAG_BASE) - if(vdist(ef.origin - mf.dropped_origin, <, 300)) + if (mf.ctf_status != FLAG_BASE && vdist(ef.origin - mf.dropped_origin, <, 900)) { havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE); return; @@ -1763,9 +1767,10 @@ void havocbot_role_ctf_escort(entity this) { navigation_goalrating_start(this); - havocbot_goalrating_ctf_enemyflag(this, 30000); - havocbot_goalrating_ctf_ourstolenflag(this, 40000); - havocbot_goalrating_items(this, 10000, this.origin, 10000); + // role: escort + havocbot_goalrating_ctf_enemyflag(this, 10000); + havocbot_goalrating_ctf_ourstolenflag(this, 6000); + havocbot_goalrating_items(this, 21000, this.origin, 10000); navigation_goalrating_end(this); -- 2.39.2