How to host a different game mode as dedicated server

From Running With Rifles Wiki
Jump to: navigation, search

game modes are started with a script. Back in the days, all were PHP but since workshop release, the campaign/invasion scripts have been entirely ported to AngelScript. Some older official scripts haven't been rewritten though, such as dominance, minimodes, team elimination, death match, teddy hunt, etc. Those are still written in PHP. They are still all functional though.

Here is an example about how to start deathmatch:[edit | edit source]

Created a *.bat file (just a text file with the extension *.bat) in your RWR folder and add this into that file:

rwr_server pipes debug_output 
pause

PS: if you start an AngelScript script (thus not PHP, such as e.g. invasion), you don't need to create that *.bat file but you can directly execute the rwr_server.exe and proceed to the next step.

Unpack this file in your game directory to have the PHP binaries to be able to execute the php scripts: https://www.dropbox.com/s/ejzteh5oo4er80o/php_rwr.zip?dl=0

exectute that batch file by double clicking it and a server console will appear. In there you can now launch the script you want, e.g. deathmatch but typing:

start_script ../scripts.legacy/start_deathmatch.php

The older PHP scripts are all located in the "scripts.legacy" folder, the AngelScript scripts in the "scripts" folder.

you can also create a file called "commands.xml" in your RWR folder with an alias for every mode to avoid having to type too much. This is an excerpt of mine:

<command_aliases>
 	<alias name="inva" command="start_script start_my_invasion.as"/>  
 	<alias name="domi" command="start_script ../scripts.legacy/start_classic.php"/> 
 	<alias name="dm" command="start_script ../scripts.legacy/start_deathmatch.php"/> 
 	<alias name="te" command="start_script ../scripts.legacy/start_team_elimination.php"/>
 	<alias name="tth2" command="start_script ../../teddy_hunt/scripts/start_team_teddy_hunt.php" />
 	<alias name="tth3" command="start_script ../../teddy_hunt/scripts/start_3-faction_team_teddy_hunt.php"/>  
 	<alias name="mini" command="start_script ../scripts.legacy/start_minimodes.php"/>
 	<alias name="rwd" command="start_script ../../Running_with_the_Dead_campaign/scripts/start_campaign.as"/>
 	<alias name="lab" command="start_script ../../lab_defense/scripts/start_defense_server.as"/>    
 	<alias name="racing" command="change_map lab_racing/maps/racing; execute start_server_racing.xml"/>
 	<alias name="carball" command="change_map football/maps/football; execute start_server_carball.xml"/>                    
</command_aliases>

if you type "dm" without the brackets into your server console it will launch the deathmatch script with the default server settings. You might want to customize those by e.g. specifying the port and the server name. Those files are usually in the same folder than the script file itself. In our example it's called server_settings_deathmatch.example.php. Best is you duplicate that file and rename it to like "server_settings_deathmatch.php" so that in case of a game update the *example* file won't be overwritten. the deathmatch script and the others as well, include the *example* file on default and also the one I specified. If you want to name the server setting file differently, you will have to also change the line in start_deathmatch.php to have the file inclusion pointing to your custom server setting file.

This line is:

include_once(get_include_with_fallback("server_settings_deathmatch.php", "server_settings_deathmatch.example.php"));

As for my server_settings_deathmatch.php file, it looks like this:

<?php
function get_start_server_command() {
	// CUSTOMIZE YOUR SERVER SETTINGS HERE
	$command = 
		"<command class='start_server' " .
		"	server_name='Deathmatch Jack' " .
		"	server_port='1666' ".
		"	comment='pure PvP server' ".
		"	url='' ".
		"	register_in_serverlist='1'".
		"	mode='DM'".
    " max_players='16'" .
		"	persistency='match'>".

		"</command>";

	return $command;
}
?>