entity bot = spawnclient();
if (bot)
{
+ setItemGroupCount();
currentbots = currentbots + 1;
bot_setnameandstuff(bot);
ClientConnect(bot);
if(autocvar_bot_god)
this.flags |= FL_GODMODE;
- this.bot_nextthink = this.bot_nextthink + autocvar_bot_ai_thinkinterval * pow(0.5, this.bot_aiskill);
- if(this.bot_nextthink < time)
- this.bot_nextthink = time + autocvar_bot_ai_thinkinterval * pow(0.5, this.bot_aiskill);
+ this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * (0.5 ** this.bot_aiskill) * min(14 / (skill + 14), 1));
+
//if (this.bot_painintensity > 0)
// this.bot_painintensity = this.bot_painintensity - (skill + 1) * 40 * frametime;
if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
{
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.bot_nextthink = time + 0.5;
return;
}
// (simulated network latency + naturally delayed reflexes)
//this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
// minimum ping 20+10 random
- this.ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
+ CS(this).ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
// skill 10 = ping 0.2 (adrenaline)
// skill 0 = ping 0.7 (slightly drunk)
if (time < game_starttime)
{
// block the bot during the countdown to game start
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.bot_nextthink = game_starttime;
return;
}
// if dead, just wait until we can respawn
if (IS_DEAD(this))
{
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
if (this.deadflag == DEAD_DEAD)
{
PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
prio = 6;
- #define READSKILL(f,w,r) if(argv(prio) != "") this.f = stof(argv(prio)) * (w); else this.f = (!autocvar_g_campaign) * (2 * random() - 1) * (r) * (w); ++prio
+ #define READSKILL(f, w, r) MACRO_BEGIN { \
+ if(argv(prio) != "") \
+ this.f = stof(argv(prio)) * w; \
+ else \
+ this.f = (!autocvar_g_campaign) * (2 * random() - 1) * r * w; \
+ prio++; \
+ } MACRO_END
//print(bot_name, ": ping=", argv(9), "\n");
READSKILL(havocbot_keyboardskill, 0.5, 0.5); // keyboard skill
if(prevbot)
prevbot.nextbot = it;
else
- {
bot_list = it;
- bot_list.nextbot = NULL;
- }
prevbot = it;
++currentbots;
}
});
+ if(prevbot)
+ prevbot.nextbot = NULL;
LOG_TRACE("relink: ", ftos(currentbots), " bots seen.");
bot_strategytoken = bot_list;
bot_strategytoken_taken = true;
bestbot = max(bestbot, it.totalfrags - it.totalfrags_lastcheck);
));
- LOG_TRACE("autoskill: best player got ", ftos(bestplayer), ", ");
- LOG_TRACE("best bot got ", ftos(bestbot), "; ");
+ LOG_DEBUG("autoskill: best player got ", ftos(bestplayer), ", ");
+ LOG_DEBUG("best bot got ", ftos(bestbot), "; ");
if(bestbot < 0 || bestplayer < 0)
{
- LOG_TRACE("not doing anything");
+ LOG_DEBUG("not doing anything");
// don't return, let it reset all counters below
}
else if(bestbot <= bestplayer * factor - 2)
{
if(autocvar_skill < 17)
{
- LOG_TRACE("2 frags difference, increasing skill");
+ LOG_DEBUG("2 frags difference, increasing skill");
cvar_set("skill", ftos(autocvar_skill + 1));
bprint("^2SKILL UP!^7 Now at level ", ftos(autocvar_skill), "\n");
}
{
if(autocvar_skill > 0)
{
- LOG_TRACE("2 frags difference, decreasing skill");
+ LOG_DEBUG("2 frags difference, decreasing skill");
cvar_set("skill", ftos(autocvar_skill - 1));
bprint("^1SKILL DOWN!^7 Now at level ", ftos(autocvar_skill), "\n");
}
}
else
{
- LOG_TRACE("not doing anything");
+ LOG_DEBUG("not doing anything");
return;
// don't reset counters, wait for them to accumulate
}