I need some help with my custombots based on the tutorbot by coffee...
Afaik they understand teamplay and they are working good in teamplay, but i dont really understand how
the bot detects the teamthing..
The real player can choose between 2 teams (USMC Team and German Team) via ingame menu and observermode at the games start,
and they will get a different playermodel for each team..
Its still not coded in, but i will use something like "self.teambase == 1" or something (1 is USMC, 2 is german team)..
So how can i make the bots to get the same models for the team?
Here is the code, its based on tutorbot....
(all is coded from scratch using enders scratch qc, so some stuff might look strange..)
thx for the help.
Code: Select all
// ------------------------------------------------
void(float teem) create_bot =
// ------------------------------------------------
{
if (!deathmatch) // no bots in SP.
{
bprint("bots can only added in multiplayer\n");
return;
}
local entity bot, spot, plr;
// initializing the entity
bot = spawn();
spot = GetSpawnPoint();
bot.origin = spot.origin + '0 0 10';
bot.angles = spot.angles;
bot.fixangle = #TRUE;
bot.incam = FALSE;
bot.solid = #SOLID_SLIDEBOX;
bot.movetype = #MOVETYPE_STEP;
// defining his animation
setmodel(bot, "progs/p_usmc.md2"); // just for test, for teampaly he needs to get a different model.
bot.frame = $idle1;
bot.th_stand = thebot_stand1;
bot.th_walk = thebot_walk1;
bot.th_run = thebot_run1;
bot.th_pain = bot_pain;
bot.th_die = thebot_die;
bot.th_missile = thebot_mp1;
// arming and naming him
bot.CurrentSlot = "Main"; // dr_mabuse1981: only give bots PRIMARY weapons!
give_random_weapon(bot); // dr_mabuse1981: only give bots PRIMARY weapons!
bot.health = 100;
bot.classname = "bot";
if (teamplay) // dr_mabuse1981: so how does this exactly work??
{
plr = find(world, classname, "player");
plr.team = 1;
bot.team = teem;
if (teem == plr.team)
{
bot.colormap = plr.colormap;
}
}
bot.netname = bot_name();
bprint(bot.netname);
bprint(" enters the game\n");
// polishing him up
setsize (bot, #VEC_HULL_MIN, #VEC_HULL_MAX);
bot.ideal_yaw = bot.angles * '0 1 0';
bot.yaw_speed = 120;
bot.view_ofs = '0 0 22';
bot.takedamage = DAMAGE_AIM;
bot.attack_state = 0;
bot.button1 = 90;
bot.nextthink = time + 0.1 + random();
bot.think = bot.th_walk;
};