Difference between revisions of "Map scripts"

From OdaWiki
m (link to map list)
m
 
Line 2: Line 2:
  
 
== Overview ==
 
== Overview ==
'''startmapscript''' and '''endmapscript''' are ways of setting gameplay variables, or [[CVARS]], for the start and end of a map.
+
'''sv_startmapscript''' and '''sv_endmapscript''' are ways of setting gameplay variables, or [[CVARS]], for the start and end of a map.
  
 
== Syntax ==
 
== Syntax ==
Line 17: Line 17:
  
 
== Usage ==
 
== Usage ==
These scripts are entered into either your '''odasrv.cfg''', when odasrv is running by setting startmapscript/endmapscript to the script line, startmapscript and endmapscript can also be set to execute an external file containing a script, for example:
+
These scripts are entered into either your '''odasrv.cfg''', when odasrv is running by setting sv_startmapscript/sv_endmapscript to the script line, sv_startmapscript and sv_endmapscript can also be set to execute an external file containing a script, for example:
  
 
<pre>
 
<pre>
set startmapscript "+exec script.cfg"
+
set sv_startmapscript "+exec script.cfg"
 
</pre>
 
</pre>
  
Line 26: Line 26:
  
 
<pre>
 
<pre>
if curmap eq MAP01 SKILL 3
+
if sv_curmap eq MAP01 SKILL 3
 
</pre>
 
</pre>
  
Line 32: Line 32:
 
to MAP30
 
to MAP30
 
<pre>
 
<pre>
if curmap eq MAP30 hostname "join if you dare"
+
if sv_curmap eq MAP30 hostname "join if you dare"
 
</pre>
 
</pre>
  

Latest revision as of 03:51, 13 August 2010

For relevant information regarding Map lists, visit Map List.

Overview

sv_startmapscript and sv_endmapscript are ways of setting gameplay variables, or CVARS, for the start and end of a map.

Syntax

A little knowledge of scripting/programming will help when creating map scripts.

if

if is a widely used conditional statement in both programming and scripting, here is an example on its use in a map script:

if CVAR1 eq VALUE1 CVAR2 VALUE2

Basically, this says "if the value of CVAR1 is equal to VALUE1 then set CVAR2 to VALUE2"

Usage

These scripts are entered into either your odasrv.cfg, when odasrv is running by setting sv_startmapscript/sv_endmapscript to the script line, sv_startmapscript and sv_endmapscript can also be set to execute an external file containing a script, for example:

set sv_startmapscript "+exec script.cfg"

Now for an example, say we wanted to set the skill to 3 for the next level at the end of MAP01.

if sv_curmap eq MAP01 SKILL 3

If you wanted to change the hostname of the server when the map changes to MAP30

if sv_curmap eq MAP30 hostname "join if you dare"

See Also

External Links