f = f.ctf_worldflagnext;
}
return world;
-};
+}
entity havocbot_ctf_find_enemy_flag(entity bot)
{
f = f.ctf_worldflagnext;
}
return world;
-};
+}
float havocbot_ctf_teamcount(entity bot, vector org, float radius)
{
if not(teamplay)
return 0;
- float c;
+ float c = 0;
entity head;
FOR_EACH_PLAYER(head)
}
return c;
-};
+}
void havocbot_goalrating_ctf_ourflag(float ratingscale)
{
}
if (head)
navigation_routerating(head, ratingscale, 10000);
-};
+}
void havocbot_goalrating_ctf_ourbase(float ratingscale)
{
return;
navigation_routerating(head.basewaypoint, ratingscale, 10000);
-};
+}
void havocbot_goalrating_ctf_enemyflag(float ratingscale)
{
}
if (head)
navigation_routerating(head, ratingscale, 10000);
-};
+}
void havocbot_goalrating_ctf_enemybase(float ratingscale)
{
return;
navigation_routerating(head.basewaypoint, ratingscale, 10000);
-};
+}
void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
{
if(mf.tag_entity)
navigation_routerating(mf.tag_entity, ratingscale, 10000);
-};
+}
void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float radius)
{
head = head.ctf_worldflagnext;
}
-};
+}
void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
{
}
head = head.chain;
}
-};
+}
void havocbot_role_ctf_setrole(entity bot, float role)
{
break;
}
dprint("\n");
-};
+}
void havocbot_role_ctf_carrier()
{
return;
}
}
-};
+}
void havocbot_role_ctf_escort()
{
havocbot_goalrating_items(10000, self.origin, 10000);
navigation_goalrating_end();
}
-};
+}
void havocbot_role_ctf_offense()
{
havocbot_goalrating_items(1000, self.origin, 10000);
navigation_goalrating_end();
}
-};
+}
// Retriever (temporary role):
void havocbot_role_ctf_retriever()
havocbot_goalrating_items(500, self.origin, radius);
navigation_goalrating_end();
}
-};
+}
void havocbot_role_ctf_middle()
{
havocbot_goalrating_ctf_enemybase(2500);
navigation_goalrating_end();
}
-};
+}
void havocbot_role_ctf_defense()
{
navigation_goalrating_start();
// if enemies are closer to our base, go there
- entity head, closestplayer;
- float distance, bestdistance;
- distance = 10000;
+ entity head, closestplayer = world;
+ float distance, bestdistance = 10000;
FOR_EACH_PLAYER(head)
{
if(head.deadflag!=DEAD_NO)
havocbot_goalrating_items(5000, self.origin, 10000);
navigation_goalrating_end();
}
-};
+}
void havocbot_calculate_middlepoint()
{
entity f;
- vector p1, p2;
+ vector s = '0 0 0';
+ vector fo = '0 0 0';
+ float n = 0;
f = ctf_worldflaglist;
while (f)
{
- if(p1)
- p2 = f.origin;
- else
- p1 = f.origin;
-
+ fo = f.origin;
+ s = s + fo;
f = f.ctf_worldflagnext;
}
- havocbot_ctf_middlepoint = p1 + ((p2-p1) * 0.5);
- havocbot_ctf_middlepoint_radius = vlen(p2-p1) * 0.5;
-};
+ if(!n)
+ return;
+ havocbot_ctf_middlepoint = s * (1.0 / n);
+ havocbot_ctf_middlepoint_radius = vlen(fo - havocbot_ctf_middlepoint);
+}
void havocbot_ctf_reset_role(entity bot)
{
havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
else
havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
-};
+}
void havocbot_chooserole_ctf()
{
havocbot_ctf_reset_role(self);
-};
+}