]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix Instant Action mode not always applying the correct (random) number of bots if...
authorterencehill <piuntn@gmail.com>
Sun, 2 May 2021 12:17:55 +0000 (14:17 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 2 May 2021 12:17:55 +0000 (14:17 +0200)
* 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

qcsrc/menu/xonotic/dialog_singleplayer.qc

index c490b699c2e0225e3b5492cf429d45cccdee9bf9..509a620623276c1cb5dd1eccbc3b3130b5d679c2 100644 (file)
@@ -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");