Toggle Server Mod On/Off from Console
Moderator: Moderators
Toggle Server Mod On/Off from Console
I searched on your site and TMT forums, but I couldn't find anything, maybe I wasn't looking hard enough, but does anyone know how to toggle a server-side mod on and off from the console? Somebody said something about cvars, but they didn't explain it very throughly(i'm kind of a newb) If you can help me, can you show me what to edit and how? Or if you can't, direct me to someone else or give me a link to a tutorial.
*EDIT* I know how to program in visual basic, if this helps anyone to explain the stuff to me.
*EDIT* I know how to program in visual basic, if this helps anyone to explain the stuff to me.
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
I'm trying to create a gravity/moon jump type mod. It uses mike_legs.st in global and I also need to change the sv_runspeed and sv_gravity and place them into a mod. I'm new to this but I know how to script a little 
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
Here, let me clarify. I need to be able to toggle(from the console) a .cfg file and a .pk3 file containing an altered mike_legs.st on/off. Or if theres an easier way to toggle them on and off, let me know 
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
Here you go 
Simply create two mike_legs and torso state files, for example:
mike_legs.st
mike_torso.st
alternate_legs.st
alternate_torso.st
The alternate_torso.st file is required even if you didn't change anything to this file. In that case, just copy the mike_torso.st file.
In your script, make a thread like this:
With this addition, you should be able to switch through the state file used by simply typing lite_alternate 1 or 0 in console. I made the script automatically issue a map restart, though that may not be necessary.
Simply create two mike_legs and torso state files, for example:
mike_legs.st
mike_torso.st
alternate_legs.st
alternate_torso.st
The alternate_torso.st file is required even if you didn't change anything to this file. In that case, just copy the mike_torso.st file.
In your script, make a thread like this:
Code: Select all
main:
// this part should be in your script already ;)
// (...)
level waittill spawn
// add this:
thread consolecommands
// (...)
end
// (...)
// new stuff, here goes :D
consolecommands:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
I'm a noob to this, but which .scr file do I place it in? Cause I tried placing it into mohdm2.scr and typed lite_alternate 1, and it didn't work...Also, thanks for the comments, it helped explain a little of the code
The tutorial on the site is also very helpful 
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
I typed "lite_alternate 1" and I didn't get any error or message. It just acted as though I didn't type anything in...
Here's the logfile : Here
Here an image from pak0.pk3 : Here
Heres mohdm2.scr:
// DESTROYED VILLAGE
// ARCHITECTURE: NED
// SCRIPTING: NED
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroyed Village"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm2"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm2.scr
exec global/ambient.scr mohdm2
level waittill spawn
thread consolecommands //Toggle Script on/off
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based <a href="http://go-advertising.com?go=<a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>" onmouseover="window.status = 'goto: <a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>';return 1" onmouseout="window.status=''"><a href="http://go-all.com?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a></a> here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
level waittill roundstart
end
//-----------------------------------------------------------------------------
consolecommands:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
And This is the part I changed of alternate_legs.st(I didn't do anything to alternate_torso):
state JUMP_STANDING
{
entrycommands
{
movementstealth "0.3"
moveposflags "crouching"
// modheight "duck"
modheight "jumpstart"
commanddelay 0.01 jump 1500
}
// and this also:
state JUMP_FORWARD_RUN
{
entrycommands
{
movementstealth "0.2"
moveposflags "crouching" "running"
// modheight "duck"
modheight "jumpstart"
commanddelay 0.01 jump 1500
}
Here an image from pak0.pk3 : Here
Here's the logfile : Here
Here an image from pak0.pk3 : Here
Heres mohdm2.scr:
// DESTROYED VILLAGE
// ARCHITECTURE: NED
// SCRIPTING: NED
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroyed Village"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm2"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm2.scr
exec global/ambient.scr mohdm2
level waittill spawn
thread consolecommands //Toggle Script on/off
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based <a href="http://go-advertising.com?go=<a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>" onmouseover="window.status = 'goto: <a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>';return 1" onmouseout="window.status=''"><a href="http://go-all.com?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a></a> here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
level waittill roundstart
end
//-----------------------------------------------------------------------------
consolecommands:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
And This is the part I changed of alternate_legs.st(I didn't do anything to alternate_torso):
state JUMP_STANDING
{
entrycommands
{
movementstealth "0.3"
moveposflags "crouching"
// modheight "duck"
modheight "jumpstart"
commanddelay 0.01 jump 1500
}
// and this also:
state JUMP_FORWARD_RUN
{
entrycommands
{
movementstealth "0.2"
moveposflags "crouching" "running"
// modheight "duck"
modheight "jumpstart"
commanddelay 0.01 jump 1500
}
Here an image from pak0.pk3 : Here
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
well if its server side couldnt u just use a regular cfg?
im a littel rusty on cfgs, havent made a shark script in a while, ill find one somewhere, but for right now, my idea is make a cfg, like"mike.cfg" and put it in ur main folder. in console type "exec mike.cfg" and "unexec mike.cfg" when ur done.
im a littel rusty on cfgs, havent made a shark script in a while, ill find one somewhere, but for right now, my idea is make a cfg, like"mike.cfg" and put it in ur main folder. in console type "exec mike.cfg" and "unexec mike.cfg" when ur done.
wtf is this?
// Can specify different scoreboard messages for round based <a href="http://go-advertising.com?go=<a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>" onmouseover="window.status = 'goto: <a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>';return 1" onmouseout="window.status=''"><a href="http://go-all.com?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a></a> here.
Anyway... the link to your logfile doesn't seem to work
Omniscient's idea
might be a good one, but I fear mohaa will not take the setting for g_statefile from a config file.
// Can specify different scoreboard messages for round based <a href="http://go-advertising.com?go=<a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>" onmouseover="window.status = 'goto: <a href="http://get-certified.net?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a>';return 1" onmouseout="window.status=''"><a href="http://go-all.com?go=games" onmouseover="window.status = 'goto: games';return 1" onmouseout="window.status=''">games</a></a> here.
Anyway... the link to your logfile doesn't seem to work
Omniscient's idea
Heres the link to the logfile, got kind of screwed up :/
http://adam.soul-e-art.com/qconsole.log
Anyway, I hope theres someone who can help figure out why it's not working. Could we possibly have to name the actual alternate mike files in the script instead of saying:
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
I'm trying to understand this script but maybe you cuold change this to include the '_legs.st'/'_torso.st'... :/
http://adam.soul-e-art.com/qconsole.log
Anyway, I hope theres someone who can help figure out why it's not working. Could we possibly have to name the actual alternate mike files in the script instead of saying:
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
I'm trying to understand this script but maybe you cuold change this to include the '_legs.st'/'_torso.st'... :/
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
How would I do this? Is there a possibility you could test it on your computer?
Also, is there anyway someone could create a set of jv_bots for each stock map? Or would it require too much ai?
Also, is there anyway someone could create a set of jv_bots for each stock map? Or would it require too much ai?
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
This is what I did to see if the game was even noticing the thing:
Mohdm2.scr:
// DESTROYED VILLAGE
// ARCHITECTURE: NED
// SCRIPTING: NED
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroyed Village"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Destroyed Village"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm2"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm2.scr
exec global/ambient.scr mohdm2
level waittill spawn
thread snow
thread consolecommands
thread maps/dm/dv_mod.scr
end
//-----------------------------------------------------------------------------
consolecommands:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
println local.alternate
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
set dmflags "8"
set sv_gravity "250"
set sv_runspeed "800"
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based games here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
level waittill roundstart
end
dv_mod.scr:
main:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
println "seperate"
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
When I tried this, absolutely nothing happens...
Mohdm2.scr:
// DESTROYED VILLAGE
// ARCHITECTURE: NED
// SCRIPTING: NED
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroyed Village"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Destroyed Village"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "mohdm2"
// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread
level waittill prespawn
//*** Precache Dm Stuff
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = maps/dm/mohdm2.scr
exec global/ambient.scr mohdm2
level waittill spawn
thread snow
thread consolecommands
thread maps/dm/dv_mod.scr
end
//-----------------------------------------------------------------------------
consolecommands:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
println local.alternate
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
set dmflags "8"
set sv_gravity "250"
set sv_runspeed "800"
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
//-----------------------------------------------------------------------------
roundbasedthread:
// Can specify different scoreboard messages for round based games here.
level waitTill prespawn
level waittill spawn
// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw
level waittill roundstart
end
dv_mod.scr:
main:
local.current = int(getcvar (lite_alternate))
while(1)
{
local.alternate = int(getcvar (lite_alternate))
println "seperate"
if(local.alternate != local.current)
{
setcvar lite_alternate local.alternate
if(local.alternate)
{
setcvar g_statefile "global/alternate"
map (getcvar mapname) // restart map
}
else
{
setcvar g_statefile "global/mike"
map (getcvar mapname) // restart map
}
local.current = local.alternate
}
waitframe // check every frame
}
end
When I tried this, absolutely nothing happens...
33rd[SS]SCpl.*LiTe*|AD|SP|
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
"Casualties many; Percentage of dead unknown; Combat efficiency; we're winning."
- Colonel David M. Shoup
