Remote control / Metagame interface

From Running With Rifles Wiki
Jump to: navigation, search

This page is work in progress, at this point working just as an info dump.

In general, anything stated below may change at any point during game development, there's certainly some room for cleanup/consistency improvements in there. The information on this page is representative of 0.94.1. Note that parts of the examples below haven't specifically been tested, so there may be typos in there.

Easiest way to get started with scripting, trying things, would appear to be loading into lobby and saying /_test in chat. That will attempt to launch media\packages\vanilla\scripts\start_tester.as, which only enables trackers\basic_command_handler.as, which is a simple chat command listener. Then saying /test in chat should echo with "test yourself".

Commands, i.e. inputs to RWR[edit | edit source]

start_game[edit | edit source]

  • example:
<command 
	class="start_game" 
	vehicles="1" 
	soldier_capacity_model="variable"
	soldier_capacity_variance="0.3"
	max_soldiers="100" 
	player_ai_compensation="0" 
	player_ai_reduction="0" 
	xp_multiplier="1.0"
	rp_multiplier="1.0"
	initial_xp="0.1"
	initial_rp="200"
	randomize_respawn_items="0"
	base_capture_system="any" 
	clear_profiles_at_start="0"
	team_kills_as_score="0"
	defense_win_time="-1"
	friendly_fire="0">
	
	<faction initial_occupied_bases="2" initial_over_capacity="0" ai_accuracy="0.94" capacity_multiplier="1.0" capacity_offset="10" />
	<faction initial_occupied_bases="-1" initial_over_capacity="0" ai_accuracy="0.94" capacity_multiplier="1.0" capacity_offset="10" />
</command>

restart_game[edit | edit source]

  • takes same parameters as start_game, with undefined values from the current game

change_game_settings[edit | edit source]

  • takes same parameters as start_game
  • currently can affect player_ai_compensation, player_ai_reduction, max_soldiers, base_capture_system and faction settings

change_map[edit | edit source]

  • example:
<command 
	class="change_map" 
	map="media/packages/vanilla/maps/map5">
	
	<overlay path="media/overlays/mod1" />
	<overlay path="media/overlays/mod2" />
	<overlay path="media/overlays/mod3" />

	<map_config>
		<faction file="green.xml" />
		<faction file="grey.xml" />
		<weapon file="all_weapons.xml" />
		<projectile file="all_throwables.xml" />
		<call file="all_calls.xml" />
		<vehicle file="all_vehicles.xml" />
		<carry_item file="all_carry_items.xml" />
	</map_config>
</command>
  • map config can be omitted, will use the map_config.xml provided by the map

start_server[edit | edit source]

  • example:
<command 
	class="start_server" 
	server_name="dedicated" 
	server_port="1238" 
	register_in_serverlist="0" 
	client_faction_index="-1"
	persistency="forever"
	url="http://runningwithrifles.com"
	comment="halp me" >
</command>

set_game_timer[edit | edit source]

  • example:
<command 
	class="set_game_timer" 
	time="600" 
	faction_id="0" >
</command>
<command 
	class="set_game_timer" 
	time="-1" >
</command>

update_score_display[edit | edit source]

  • example:
<command 
	class="update_score_display" 
	id="0"                            // this is the faction_id
	text="123" >
</command>

commander_ai[edit | edit source]

  • example:
<command 
	class="commander_ai" 
	faction="1"
	base_defense="0.8"
	border_defense="0.2"
	active="1">
</command>

soldier_ai[edit | edit source]

  • example:
<command 
	class="soldier_ai" 
	faction="1">
        <parameter class="willingness_to_charge" value="1.0" />
</command>

make_query[edit | edit source]

  • example:
<command
	class="make_query"
	id="my_query_tag1">

	<!-- generally, you should query as little data as possible, this is just a test -->
	
	<data class="factions" /> 
	<data class="bases" /> 

	<data class="players" /> 
	<data class="characters" faction_id="0" /> 
	<data class="characters" faction_id="1" /> 
	
	<data class="vehicles" faction_id="1" key="cargo_truck.vehicle" /> 

	<data class="hitboxes" faction_id="0" /> 

	<!-- info about specific character, you need to find out id from elsewhere, like characters-query or from incoming events -->	
	<!-- <data class="character" id="0" /> -->
	<!-- <data class="vehicle" id="0" /> -->
</command>
  • data classes available
    • general
    • faction
    • factions
    • bases
    • players
    • characters
    • character
    • vehicles
    • vehicle
    • hitboxes
    • item_containers
    • resources
    • saved_data

In most cases it is not necessary to create queries yourself. The file scripts/internal/query_helpers.as contains utility functions for the most common queries.

xp_reward[edit | edit source]

  • example:
<command 
	class="xp_reward" 
	character_id="1"
	reward="5.0">

	<!-- 1.0000 equals 10000 XP -->
	<!-- 0.0001 equals 1 XP -->
	<!-- 0.1000 equals 1000 XP, one full rank step -->

</command>

rp_reward[edit | edit source]

  • example:
<command 
	class="rp_reward" 
	character_id="1"
	reward="10000">
</command>

kick_player[edit | edit source]

  • example:
<command 
	class="kick_player" 
	player_id="0">
</command>

update_player[edit | edit source]

  • example:
<command 
	class="update_player" 
	player_id="0"
        color="#FF0000"
        faction_id="1">
</command>

add_hitbox_check[edit | edit source]

  • example:
<command 
	class="add_hitbox_check" 
	id="item_supply2_weapon_rack"
	instance_type="vehicle"
	instance_id="1" >
</command>
<command 
	class="add_hitbox_check" 
	id="item_supply2_weapon_rack"
	instance_type="character"
	instance_id="1" >
</command>


remove_hitbox_check[edit | edit source]

  • example:
<command 
	class="remove_hitbox_check" 
	id="item_supply2_weapon_rack"
	instance_type="vehicle"
	instance_id="1" >
</command>


update_vehicle[edit | edit source]

  • example:
<command 
	class="update_vehicle" 
	id="0"
	locked="1"
	health="0.5">
</command>

remove_vehicle[edit | edit source]

  • example:
<command 
	class="remove_vehicle" 
	id="0">
</command>

chat[edit | edit source]

  • example:
<command 
	class="chat" 
	text="hello world!"
	faction_id="-1"
	player_id="-1"
	position="512 0 512">
</command>
<command 
	class="chat" 
	key="map start with completed map"
	faction_id="-1"
	player_id="-1"
	position="512 0 512">
</command>

notify[edit | edit source]

  • example:
<command 
	class="notify" 
	text="hello world!">
</command>

set_world_situation[edit | edit source]

  • example:
<command 
	class="set_world_situation">
	<faction id="0" name="Green" color="0 1 0" />
	<faction id="1" name="Grey" color="0.5 0.5 0.5" />
	<faction id="2" name="Brown" color="1 1 0" />
	<faction id="3" name="Blue" color="0 0 1" />

        <region id='0' name='map1' position='240.318 118.728' size='339.76 297.573' texture_rect='0.00279018 0.00111607 0.317383 0.276646'>
		<occupant id="0" value="1.0"/>
        </region>
        <region id='1' name='map2' position='332.227 172.969' size='587.612 372.154' texture_rect='0.351562 0.317104 0.895647 0.661691'>
		<occupant id="0" value="0.5"/>
		<occupant id="1" value="0.5"/>
        </region>
        <region id='2' name='map3' position='253.878 391.44' size='376.674 247.852' texture_rect='0.00279017 0.317104 0.351563 0.546596'>
		<occupant id="2" value="0.8"/>
		<occupant id="3" value="0.2"/>
        </region>
        <region id='3' name='map4' position='595.898 432.874' size='314.146 360.854' texture_rect='0.351563 0.661691 0.642439 0.995815'>
		<occupant id="2" value="1.0"/>
        </region>
        <region id='4' name='map5' position='383.454 584.297' size='311.886 252.372' texture_rect='0.00279018 0.661691 0.291574 0.895368'>
		<occupant id="1" value="1.0"/>
        </region>
        <region id='5' name='map6' position='176.283 539.096' size='328.46 341.267' texture_rect='0.351562 0.00111608 0.655692 0.317104'>
		<occupant id="3" value="1.0"/>
        </region>
</command>

faction_resources[edit | edit source]

  • example
<command 
	class="faction_resources" 
	faction_id="0"
	clear_weapons="1">
	<weapon key="ak47.weapon" />
</command>
<command 
	class="faction_resources" 
	faction_id="0"
	soldier_group_name="miniboss">
	<projectile key="hand_grenade.projectile" enabled="0" />
</command>
<command 
	class="faction_resources" 
	faction_id="0"
	clear_calls="1">
	<call key="tank_drop.call"/>
</command>
<command 
	class="faction_resources" 
	faction_id="0">
	<carry_item key="vest2.carry_item" enabled="0" />
</command>


set_marker[edit | edit source]

  • example:
<command 
	class="set_marker" 
	faction_id="0"
	id="0"
	enabled="1"
	atlas_index="0"
	text="squad alpha rally point"
	position="512 0 512"
	color="#ff0000"
	range="10.0">
</command>


set_match_status[edit | edit source]

  • example:
<command 
	class="set_match_status" 
	faction_id="0"
	lose="1">
</command>
<command 
	class="set_match_status" 
	faction_id="1"
	win="1">
</command>


create_instance[edit | edit source]

  • example:
<command 
	class="create_instance" 
	faction_id="0"
	position="512 0 512"
	offset="0 0 0"
	character_id="0"
	instance_class="carry_item"
	instance_key="suitcase.carry_item" >
</command>

<command

       class="create_instance"

faction_id="0" position="512 0 512" instance_class="character" instance_key="default" /> </command>

update_static_object[edit | edit source]

  • example:
<command
        class="update_static_object"
        key="wall_door"
        destroyed="1" >
</command>

create_call[edit | edit source]

  • example:
<command 
	class="create_call" 
	faction_id="0"
	position="512 0 512"
	key="cover_drop.call">
</command>

update_inventory[edit | edit source]

  • example:
<command 
	class="update_inventory" 
	character_id="0"
	container_type_class="stash"
	add="1"
	instance_class="carry_item"
	instance_key="painting.carry_item">
</command>
<command 
	class="update_inventory" 
	character_id="0"
	container_type_class="backpack"
	add="1"
	instance_class="carry_item"
	instance_key="painting.carry_item">
</command>

update_character[edit | edit source]

  • example:
<command
        class="update_character"
        id="123"
        dead="1" />
</command>



set_comms[edit | edit source]

  • example:
<command 
	class="set_comms" 
	faction_id="1"
	enabled="0">
</command>


set_soldier_spawn[edit | edit source]

  • example:
<command 
	class="set_soldier_spawn" 
	faction_id="1"
	enabled="0">
</command>


save_data[edit | edit source]

  • example:
<command 
	class="save_data">
	<root>
		<foo bar="0" />
	</root>
</command>

Events, i.e. outputs from RWR[edit | edit source]

match_result[edit | edit source]

  • example:
<match_result>
	<win_condition type="map_capture" faction_id="0" faction_name="Greenbelts" />
</match_result>

faction_lost[edit | edit source]

  • example:
<faction_lost>
	<lose_condition type="time_expired" faction_id="1" faction_name="Graycollars" />
</faction_lost>

comms_change_event[edit | edit source]

  • example:
<comms_change_event
	faction_id="0"
	state="0" />

vehicle_holder_change_event[edit | edit source]

  • example:
<vehicle_holder_change_event
	vehicle_id="0"
	holder_id="0"
	owner_id="1" />

vehicle_destroyed_event[edit | edit source]

  • example:
<vehicle_destroyed_event
	vehicle_id="0"
	character_id="0" />

base_owner_change_event[edit | edit source]

  • example:
<base_owner_change_event
	base_id="0"
	owner_id="0" />


chat_event[edit | edit source]

  • example:
<chat_event
	player_id="0"
	player_name="pasik"
	message="OMG JEEP"
	global="1" />

player_connect_event[edit | edit source]

  • example:
<player_connect_event>
	<player 
		name="pasik" 
		player_id="0"
		faction_id="0"
		profile_hash="........."
		ip="192.168.1.5"
		port="43243"
		character_id="123" />
</player_connect_event>


player_disconnect_event[edit | edit source]

  • example:
<player_disconnect_event>
	<player 
		name="pasik" 
		player_id="0"
		faction_id="0"
		profile_hash="........."
		ip="192.168.1.5"
		port="43243"
		character_id="123" />
</player_disconnect_event>

player_kill[edit | edit source]

  • example:
<player_kill>
	<killer
		name="pasik" 
		player_id="0"
		faction_id="0"
		profile_hash="........."
		ip="192.168.1.5"
		port="43243"
		character_id="123" />
	<target
		name="JackMayol" 
		player_id="1"
		faction_id="1"
		profile_hash="........."
		ip="xxx.xxx.xxx.xxx"
		port="43221"
		character_id="124" />
</player_kill>

player_die[edit | edit source]

  • example
<player_die>
	<target
		name="JackMayol" 
		player_id="1"
		faction_id="1"
		profile_hash="........."
		ip="xxx.xxx.xxx.xxx"
		port="43221"
		character_id="124" />
</player_die>

player_spawn[edit | edit source]

  • example
<player_spawn>
	<player
		name="JackMayol" 
		player_id="1"
		faction_id="1"
		profile_hash="........."
		ip="xxx.xxx.xxx.xxx"
		port="43221"
		character_id="125" />
</player_spawn>

hitbox_event[edit | edit source]

  • example
<hitbox_event hitbox_id="blahblah" instance_type="character" instance_id="125" />
<hitbox_event hitbox_id="blahblah" instance_type="vehicle" instance_id="125" />

item_drop_event[edit | edit source]

  • example
<item_drop_event 
	character_id="0" 
	item_class="0"
	item_type_id="0"
	target_container_type_id="0"
	item_key="ak47.weapon"
	position="512 0 512"
	player_id="0" />


call_request_event[edit | edit source]

  • example:
<call_request_event
	character_id="0" 
	call_id="0"
	call_key="cover_drop.call"
	target_position="512 0 512"
	player_id="0" />
This event is only emitted when the call has the attribute notify_metagame set to "1" like
<call key="cover_drop.call" notify_metagame="1">
  <!-- defition goes here -->
 </call>

user_quit_event[edit | edit source]

  • example:
<user_quit_event />