From: terencehill Date: Sun, 2 May 2021 12:17:55 +0000 (+0200) Subject: Fix Instant Action mode not always applying the correct (random) number of bots if... X-Git-Tag: xonotic-v0.8.5~424 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bb20bbeaf6ced164cb1a33b4181fc2c9113dabc7;p=xonotic%2Fxonotic-data.pk3dir.git Fix Instant Action mode not always applying the correct (random) number of bots if started while playing the campaign: * example where cvar_set doesn't work: start Xonotic, set bot_number to 0, start a campaign level, start an Instant Action game: bot_number is set to 0 * example where cvar_set works: start an Instant Action game twice, start a campaign level, start an Instant Action game: bot_number is correctly set --- diff --git a/qcsrc/menu/xonotic/dialog_singleplayer.qc b/qcsrc/menu/xonotic/dialog_singleplayer.qc index c490b699c..509a62062 100644 --- a/qcsrc/menu/xonotic/dialog_singleplayer.qc +++ b/qcsrc/menu/xonotic/dialog_singleplayer.qc @@ -100,7 +100,10 @@ void InstantAction_LoadMap(entity btn, entity dummy) pmin = pstep * ceil(pmin / pstep); pmax = pstep * floor(pmax / pstep); p = pmin + pstep * floor(random() * ((pmax - pmin) / pstep + 1)); - cvar_set("bot_number", ftos(p - 1)); + + // cvar_set doesn't always work starting an InstantAction game while playing the campaign + //cvar_set("bot_number", ftos(p - 1)); + localcmd(strcat("bot_number ", ftos(p - 1), "\n")); // make sure we go back to menu cvar_set("lastlevel", "1");