I use this code in my map rotation to call up different mods of the same map and it works when i use console to set dm2vers.
Instead of using console to select the version however, i would like it to rotate automatically through the different versions (each map rotation cycles to next version) by changing the value at the end.
local.variable + 5 // this will return an error because the script interpreter won't find the left side (you know, from maths point of view ;) )
local.variable += 5 // this will add 5 to the variable's value
As to NIL & NULL, Mefy and I provided a good explanation of them recently, search the scripting forum.
ok next part to this - is it possible to make a condition or case statement based on number of clients on the server? How could i do something Like this -
if total_clients is = or < 6 then
play version 1
if total_clients is > 6 and < 15 then
play version 2
if total_clients is > 14 then
play version 3
I want to be able to turn on and off the mod rotation switch that bdbodger wrote ^ when off stock map will run when on the switch rotates through the different mod versions.
/*
"Modrotation"
mohdm2 (used in this script as an example)
SCRIPTING: bdBodger
cut/paste: ViPER
RUN MULTIPLE MODDED VERSIONS IN YOUR MAP ROTATION
instructions -
set modrotation 0(off) or 1(on) in your server.cfg
Rename your stock mohdm2.scr and modded versions of that map! Give them unique names like
mohdm2_v1
mohdm2_v2
mohdm2_v3 etc.....
Name this script mohdm2.scr
In this example I included the stock script in the mod rotation!
If you apply this script to other maps besure to change your var "dm2vers" , the max case # in the last if statement and map names!
Put in as many or as few as you like!
modrotation will turn them all on or off.
*/
local.modrotation = (int(getcvar modrotation))
switch(local.modrotation) // THIS TURNS MODROTATION ON/OFF
{
case 0:
exec maps/dm/mohdm2_v1.scr;break //stock
case 1:
local.dm2vers = (int(getcvar dm2vers))
if(local.dm2vers == 0 || local.dm2vers == NIL)
local.dm2vers = 1
switch(local.dm2vers) // THIS IS YOUR MODROTATION
{
case 1:
exec maps/dm/mohdm2_v2.scr;break //mod version2
case 2:
exec maps/dm/mohdm2_v3.scr;break //mod version3
case 3:
exec maps/dm/mohdm2_v4.scr;break //mod version4
case 4:
exec maps/dm/mohdm2_v1.scr;break //stock
}
local.dm2vers++
if(local.dm2vers > 4)
local.dm2vers = 1
setcvar dm2vers local.dm2vers
}
else
{
switch(local.dm2vers) // THIS IS YOUR MODROTATION
{
case 1:
exec maps/dm/mohdm2_v2.scr;break //mod version2
case 2:
exec maps/dm/mohdm2_v3.scr;break //mod version3
case 3:
exec maps/dm/mohdm2_v4.scr;break //mod version4
case 4:
exec maps/dm/mohdm2_v1.scr;break //stock
}
The modrotation cvar is an on off switch! If you had 12 different maps running with 4 different mods each you may want to shut off the advancement of dmXvers!
each map rotation or map restart will advance the dm2vers !
You can turn them all off with "modrotation"
or set up different configs with modrotation cvar!
hmmm - I'm not explaining very well ! Let me try this - Imagine a map rotation of mohdm 1-7 (for each, 1 is stock and 2 or more are variations with modding)