AVALANCHE Modding Guide


Contents


1. Introduction
    AVALANCHE is highly moddable, and allows you to do anything from make custom levels and items, to modify the game code and turn it into a completely different game.

    Now that you've downloaded this SDK, you have everything you need to get started on AVALANCHE modding. Here are the contents of this SDK, as outlined in the main ReadMe.txt file:

    ./
    Contains this file and the ReadMe.txt file.

    ./docsup
    Contains documentation supplement files (such as images referenced by Modding.htm).

    ./old
    Contains old SDK source distribution(s).

    ./samples
    Contains buildable samples, for AVALANCHE player models, maps, and more. For detailed descriptions and instructions for each sample, please see .samples/samples.txt.

    ./source
    The current AVALANCHE source code for the client and server logic modules. The code is set up to compile in Microsoft Visual Studio 2005, but can be adapted to other compilers if needed.

    ./tools
    Contains binary tools needed for modding AVALANCHE and building the samples.

    If you aren't familiar with AVALANCHE/R-Cube modding, I suggest getting started by making a mod.


2. Making a Mod
    2.1. Setting Up
    There are a few things to know before you make your first mod. Most importantly, AVALANCHE includes various "user" files under the rcgame folder, which are intended for user mods. If you make all of your changes in these files alone, you will not need to worry about updating or having your mod broken by future versions of AVALANCHE. These files are:

    objects/invitems.rci - You can add up to 20 user-defined inventory items in this file, anything from potions to new melee weapons.

    objects/usermod.rco - Use this to define your own game objects. You can place custom game objects in your map with the editor, or by spawning them in R-Script code.

    particles/usermod.rpl - Add all of your custom particle effects in here.

    rscript/usermod.rsc - This is your very own R-Script module. You can add all of your custom logic and routines in here.

    texshd/usermod.rsh - This allows you to define texture shaders for your custom meshes, particles, or anything else that uses textures.

    Next, you will want to turn on developer mode. Open up your rcgame/engine.cfg file in a text editor like notepad.exe, and change the developer field to "1". Additionally, you will probably find the logwindow very handy. However, the log window disables mouse focus, so hopefully you are using a gamepad in your development. If not, you should really consider picking one up. That aside, from here, you're all ready to get straight into development. Read on.

    As you may have noticed, an example mod is included with the regular AVALANCHE distribution. In order for your mod to visible for selection in the R-Cube intro dialog, the folder the mod is in must begin with mod_ and the folder must contain a mod.cfg file. Here is a sample mod.cfg file:
    usermod
    {
    	name		"Example Mod"
    	author		"Rich Whitehouse"
    	website		"http://www.telefragged.com/thefatal/"
    	descr		"Example mod."
    }
    
    Pretty straight-forward. So, if you wanted to play the example mod, you'd just rename that rcgame/examplemod folder to rcgame/mod_example, and the "Load Mod" button would show up in the R-Cube intro dialog for you activate it.

    2.2. Tutorial
    As a short tutorial example in making a mod, we'll walk through the steps in creating a new inventory item. First, create a new folder under rcgame called "mod_mymod". Now in that folder, create a file called mod.cfg, and make the contents something like this:
    usermod
    {
    	name		"My First Mod"
    	author		"Mr. Sniffles"
    	website		"http://www.mrsniffles.com/"
    	descr		"My mod!"
    }
    
    That is assuming your name is Mr. Sniffles. Now that you've done that, create another tree of folders under rcgame/mod_mymod, leading to "rcgame/mod_mymod/assets/objects/", and copy the provided invitems.rci from the normal game tree in rcgame/assets/objects to rcgame/mod_mymod/assets/objects/. Now, finally, open up rcgame/mod_mymod/assets/objects/invitems.rci in a text editor.

    We can see a couple useritem definitions here already, let's replace that first one with this:
    useritem1
    {
    	name		"SniffleBomb"
    	icon		"assets/textures/items/item_sack"
    	desc		"Sniffle explosion!"
    	useFX		"other/bombblow"
    	itemBehavior	"8"
    	itemValue	"500"
    	usable		"1"
    	cost		"100"
    	secret		"0"
    	maxAmount	"99"
    }
    
    The itemBehavior value corresponds to the list of values at the top of the invitems.rci file, so you can see we have specified INVITEM_BEHAVIOR_RADIUSDMG in this case.

    Now, start up rcube.exe. You'll notice there is a Load Mod option on the main dialog, if you set your folder and mod.cfg file up correctly. Click it, and load "My First Mod". Now start up a game as usual, and you will be able to forge SniffleBombs at the Mako Forge for 100 mako each.

    Several types of items specify a game object instead of FX. These types are swords, guns, and flashlights. If you look at the invitems.rci file in the examplemod which comes with AVALANCHE, you will see that it has specified "*obj_bpin" as the useFX. obj_bpin is then defined in the mod's usermod.rco file.

    That's all there is to it. You've created your first mod.


3. Development Commands
    After you set developer to 1 in the engine.cfg file, you will have access to a bunch of developer-only commands. Note that if you use a developer command and save your game, your savegame will be flagged in multiplayer matches. So don't cheat! You can enter these commands in the log window, or through chat (pressing T in the keyboard by default) and prepending the command with /devcmd (e.g. "/devcmd gvarlist"). Here is a list of developer commands:

    spawn objname - objname is the name of any object defined in the rco files. So, "spawn obj_e30purple" would spawn a Fighter, for example.

    noclip - No clipping mode (fly through walls and such).

    jesus - Undying mode.

    notarget - Enemies will not see you.

    npsngs - Nothing will die.

    aipath - Toggle display of dynamic AI navigation paths.

    getpos - Print the player's position.

    setpos (# # #) - Set the player's position to (# # #) referring to (x y z) coordinates.

    <3 - Max health, all abilities.

    mako # - Give # mako. # can be a negative value to subtract mako.

    str # - Set strength stat to #.

    def # - Set defense stat to #.

    dex # - Set dexterity stat to #.

    luck # - Set luck stat to #.

    killemall - Kill all enemies on the level.

    giveitup - Stomps over the inventory with all items.

    timescale # - Sets the global time scale, where 1.0 is regular, 0.5 is half speed, 2.0 is double speed, and so on.

    testfx fxname - fxname is the name of a particle system. The effect will be played on the location of the player.

    runscript scriptname - scriptname is the name of any R-Script routine. The routine will be executed on the spot.

    map mapname - mapname is the name of one of the rcm files in the assets/maps folder. This changes the map.

    gvar name value - Sets gvar "name" to "value".

    gvarlist - Lists all gvars.

    mscript scriptname - scriptname is the name of a menu script. This broadcasts a message to clients to run a specific menu script.

    The following commands can only be issued through the log window (since they are special case client commands):

    multishot # - Takes multiple screenshots of a single frame with a sub-pixel jitter, up to # times. This had to be implemented for nice screenshots, because my terrible laptop GeForce doesn't support HDR and FSAA.

    scut # string - # is 0-8, and string is a dev command. Assigns the shortcut buttons on the log window.

    reloadmenus - Reload menus.

    reloadpcl - Reload particles.


4. Texture Shaders
    Texture shaders allow you to specify diffuse, normal, or other custom shader textures, in addition to custom fragment programs and other parameters such as parallax mapping and specular factors. There is no documentation for the system currently, but there are examples to choose from in the existing files in the assets/texshd folder. Models, particles, sprites, and so on may reference a texture by filename or the name of a texture shader.


5. Particles
    Particle systems can be played by code, script, or certain types of game objects. They are composed of various primitives, such as sprites, lines, and lights. As with texture shaders, no documentation currently exists, but you can find examples of everything you want to do in the assets/particles folder. Remember that you can use the testfx dev command to preview particle systems as well.


6. Game Objects
    Game objects are defined by the rco files in the assets/objects folder. In purpose, they can range from anything to a player inventory item bolt-on (for swords, guns, etc) to a unique self-operating object like a monster or a usable trigger like a teleport pad. When placing game objects in the editor, you can also add key/value pairs to them. Some objects make extensive use of these key/value pairs to extend functionality. A list of objects with keys and descriptions of what their values do follows. Keep in mind that there are also many variants of these basic types which use the same or similar keys/values. You can open up any of the AVALANCHE maps in the editor and take a look at which objects is being used for whichever purpose you desire.

    6.0.1. Universal Values
    These are keys which work on pretty much any object.

    targname - Specifies the "target name" of the object. This is used to look up the object by name in script, or in code.
    objMins - Value is in the form of (-x -y -z). Overrides the bounding box mins for the object. Useful for triggers.
    objMaxs - Value is in the form of (x y z). Overrides the bounding box maxs for the object. Useful for triggers.

    6.0.2. obj_dynamiclight
    This is the standard dynamic light type, and will be used to light all of your maps.

    radius - The radius of the light, in game units. Defaults to 512.
    color - The light's color, with the value in the form of "(r g b)". r, g, and b will generally be in the range of 0.0 to 1.0, but can be above 1.0 in order to over-saturate and bloom out with HDR.
    shadows - If the value is "0", the light will not cast shadows. The default is "1", which casts shadows.
    notmapstatic - If set to "1", this will affect static behavior and calculation for the light. Set this on lights that are expected to move around frequently.
    fullambient - Becomes a pure ambient light, which renders a soft omni-directional pass over all geometry. If the geometry has lightmaps, they will be included in this pass.
    novolumes - Allows a light to cast shadowmaps on geometry which uses shadowmaps, but it will not cast stencil volumes. Useful for lights that do character-only shadows.
    spotlight - If "1", the light is a spotlight. The default is "0", which is omnidirectional.
    spotcone - If the light is a spotlight, this specifies the cone size in degrees. The default is "90".
    spottex - Specifies the attenuation map for spotlights. This defaults to "assets/textures/2dattn".
    startoff - Starts the light invisible. It can be turned on by being unhidden with a trigger or in script.
    tracker - Special-case behavior, which causes the light to do position tracking of all "living" game objects.

    6.0.3. obj_triggerbox
    Trigger Boxes are the primary means of triggering events and placing player-usable objects.

    script - R-Script to run when something enters the box. The targname of the object entering the box is pushed to the R-Script stack.
    onlyuseon - Value is the targname of an object. Box can only be used by this object. You can specify "__the_player" or "__the_camera" as special cases for the player and camera objects.
    removeonuse - If "1", the box will be removed completely on use.
    removeon - Value is the targname of an object. Box is removed if it is used by this particular object.
    startoff - Start off. It can be turned on be being unhidden in script code.
    debounce - Milliseconds to wait between triggering.
    buttonuse - Player must push jump to use.
    beambox - Special case, make it solid and draw beams across the longest x/y axis.
    fx - Value is the name of a particle system to ermit while active.
    fxdelay - Delay between fx emissions.
    fxofs - (x y z) offset from center to emit particles.
    fxang - (pitch yaw roll) angles to play particle system.
    enemyMax - Don't activate if more than this many active enemies on the map.
    deactonuse - Deactivate on use.
    gvar - If the gvar named in the value is not set or is 0, the trigger will be removed on spawn.
    holospawn - Special hologram spawner option, value is the name off the object to spawn on use.
    mponly - Trigger is only present in multiplayer.

    6.0.4. obj_cinemaprop
    Cinematic prop objects are used in the in-game cutscenes, for animating and moving character models.

    model - Specifies a model for the cinema prop, such as "assets/models/tifa.rdm".
    anim - Specifies an animation set for the cinema prop, such as "assets/models/tifa.rda".
    In the following, # is the number of any given animation frame. When the prop animates to that frame, the given event will trigger.
    fs_# - Frame sound. Value is the name of a wave/ogg file.
    fx_# - Frame effect. Value is the name of a particle system.
    fr_# - R-Script. Value is the name of an R-Script routine.

    6.0.5. obj_rscript
    This is the main interface for running scripts on map startup.

    script - Name of the script routine to run, such as "d1_startup".
    startdelay - Amount of time in milliseconds before the script is run.

    6.0.6. obj_particleemitter
    Particle emitters can emit particle systems at specified offsets and intervals.

    pcl - The name of the particle system (e.g. "other/bombblow"). pclofs - Vector in the format of "(x y z)", specifying an absolute positional offset for the particle system being emitted. Useful to emit a particle system from within a solid object or somewhere where visibility checks would fail on the emitter object.
    delay - Interval in milliseconds between emissions.
    onetime - Remove after emitting the particle system.
    startoff - Starts off, and must be activated by a trigger or script to begin emission.

    6.0.7. obj_soundemitter
    Sound emitters can play sounds at specified offsets and intervals.

    sound - The name of the sound (e.g. "assets/sound/beamoff.wav"). delay - Interval in milliseconds between emissions.
    volume - 0.0 to 1.0 volume scale of the sound. onetime - Remove after emitting the sound.
    startoff - Starts off, and must be activated by a trigger or script to begin emission.

    6.0.8. obj_item_drop
    Used for placing item pickups in the map.

    item - The name of the item (e.g. "Potion" or "Phoenix Down"). gvar - If this gvar is set, the item does not get spawned. When the item is picked up, this gvar is automatically set to 1.



7. Editor
    The editor can be accessed from the R-Cube intro dialog by clicking "Editor" when developer mode is enabled in the engine.cfg. You can open up existing maps from there to see how things are set up. It is currently in a bit of a hobble and broken in numerous ways, but it serves its purpose. Basic controls for editor use are:

    Right Mouse+Move - Move around on x/y.
    Ctrl+Right Mouse+Move - Move up and down ("back and forth" in top-down view).
    Ctrl+Left Mouse - Select an object. Keep clicking to cycle through overlapping objects.
    Left Mouse+Move - Moves the selected object(s) around.

    You can also use the map objects list in the Map Object Properties dialog to select objects in the map.

    The map editor isn't meant to be used to craft actual geometry, this is done in another editor, like 3D Studio Max or GtkRadiant, depending on the mesh format you choose to import your level pieces from. Level pieces are defined as game objects, in the assets/objects/mapobj.rco file (but can be defined in any rco file, including usermod.rco). For an example map object, take a look at obj_chocow, obj_d1, etc. in the mapobj.rco file.

    A simple map setup in the editor can be found in this SDK's ./samples/Sample Mod/ sample. In order to get yourself loaded up with the sample map in the editor, follow these steps:

    1. Open the rcgame/engine.cfg file in your AVALANCHE installation, and change the value of "developer" (near the top of the file) from "0" to "1".
    2. Copy the ./samples/Sample Mod/mod_sdksample folder from this SDK to the rcgame/ folder in your AVALANCHE installation. You should end up with a rcgame/mod_sdksample/* file/folder structure.
    3. Start AVALANCHE (rcube.exe), and click the Load Mod option on the startup dialog. If the Load Mod option is not visible, you did not complete step 2 correctly. In the window that pops up after clicking Load Mod, select "SDK Sample" and push OK.
    4. Now click "Editor" from the main intro dialog to launch into the editor. If the Editor option is not visible, you did not complete step 1 correctly.
    5. Once the editor has loaded up, click File and Load map. Browse to your rcgame/mod_sdksample/assets/maps/ folder, and open samplemap.rcm.
    6. After the map has loaded, in the "Map Object Properties" window under "Map objects:", you can click on the objects to go to them in the "Selection" window and see how they are set up. You can change object types by selecting an object and then changing the "Type" in the type dropdown, then hitting Apply. You can also add new objects with the "Add object" button on the main editor window.

    Note that all of the obj_* entries are loaded directly from the assets/objects/*.rco files. If you make a new entry in any of those files, it will automatically show up in the editor object list. This should get you started and show you how to make new maps of your own. You can look at more complex map setups by opening some of the original AVALANCHE .rcm files in the editor, as well.

    A lot of AVALANCHE's map geometry was crafted in GtkRadiant, and converted from q3bsp format with mesh2rdm. In this SDK, a sample (with batch file) demonstrating this asset pipeline can be found in ./samples/Maps/. In order to make/modify the source .map file there, you will need GtkRadiant, downloadable here:

    http://zerowing.idsoftware.com/files/radiant/GtkRadiant-1.5.0.msi

    It's easiest to configure GtkRadiant to work with Quake 3 and load the provided ./samples/Maps/ baseq3 data into your Quake3/baseq3 file structure. This way, you can load and even test your map in Quake 3 itself, before taking the final step to fully lighting the map and importing it into AVALANCHE. However, if this is not an option for you, you can still force GtkRadiant to work with the provided sample's baseq3 data, and build your models all the way to rdm to test each time.

    In addition to normal map editor, the animation editor can be accessed from the Tools menu in the main map editor. The animation editor allows you to import models and animations, and tweak and re-export animations. You can also bolt models to each other in the animation scene, and animate with the loaded map super-imposed over the scene. Bolting is useful for animating with bolted items or weapons, like swords or guns, and animating over level geometry is useful for cinematic sequences.


8. Importing Models/Animations
    All model/animation importing is done with mesh2rdm, which is included in this SDK. Mesh formats are typically imported from 3DS, md5mesh, or smd. Tools for exporting md5meshes from gmax and max are available here. smd or md5mesh are typically used for models which must be animated or boned.

    A good example of this is the bowling pin model included with the AVALANCHE example mod. In the rcgame/examplemod/modelsource directory, the original 3DS and md5mesh files for the bowling pin are included. The following mesh2rdm command line was used to convert the pin model:

    mesh2rdm.exe bpin.md5mesh bpin.rdm

    Additionally, here are some example command lines that were used for other resources in AVALANCHE, from files imported from BSP, 3DS, and md5mesh:

    mesh2rdm.exe choco04.bsp chocow.rdm -scale 6.0 -bspleafmerge
    mesh2rdm.exe choco_clip.bsp chocow_clip.rdm -scale 6.0 -bspclip
    mesh2rdm.exe sephboss.bsp sephboss.rdm -scale 20.0 -bspleafmerge
    mesh2rdm.exe sephboss.bsp sephboss_clip.rdm -scale 20.0 -bspclip
    mesh2rdm.exe reactor66.bsp reactor10.rdm -scale 6.0
    mesh2rdm.exe reactor_clip.bsp reactor10_clip.rdm -scale 6.0 -bspclip
    mesh2rdm.exe glock.md5mesh glock.rdm -scale 0.1
    mesh2rdm.exe terrain2_01.3ds terrain2_01.rdm -forceskin *

    For more information, run mesh2rdm with no command arguments, and you will get a full run-down of all of the export options for that version.

    8.1. Weapon Models
    There is a specific method for importing and setting up models to be used in AVALANCHE's inventory system. First, go into the animation editor. Import the assets/models/tifa.rdm model, and tifa.rda animation for the model. Answer "No" when asked if you wish to append frames. Next, import your converted weapon rdm. We'll use the bpin.rdm from the example mod as an example. Once you do this, you should have a scene that looks something like this:
    Animation editor
    Next, select the pin model (model1), and set the "Scene pos" from (0.0 0.0 0.0) to (0.0 0.0 -90.0). Then, click the "Bolt" button. When asked to select the model to bolt to, click "model0" in the scene objection selection. Next you will be asked to select a bone to bolt to. Scroll down to the bottom of the bone selection, and click "b32". You'll notice the bowling pin has been attached to Tifa's right arm.

    Now, select the pin (model1) again. It clearly is not oriented correctly and is too small, so we'll want to change it. Select "Bone01" in the bone selection list. Rotate the bone angles to "(0.0 82.0 90.0)", and change the bone translation to "(-10.21 -99.79 8.0)". Then, finally, change the bone scale to "2.0" and hit apply for the bone selection. You'll see that we've oriented the pin to look correct relative to Tifa's arm orientation, and it should look like this:
    Animation editor
    Next, we are going to change the bolt and create a new frame. This new frame will be the pin's offset when it is not unholstered and is bolted to Tifa's back instead. With model1 still selected, click the "Duplicate" button under Frames. You should see the frame count grow. Move the animation slider on over to frame 2/2 now.

    Next, click bolt again, still with model1 selected. The bolt you set will clear. Now click bolt again. This time, select model0 to bolt to, and b1 in the bone list instead of b32. Now that the bolt is set, select model1 (pin) again. We want to change the "Scene pos" again from "(0.0 0.0 -90.0)", this time we change it to "(-80.0 5.0 -120.0)". This is the offset used in code to place the weapon when it is in its holstered position.

    Now that we've done this, we'll see the pin is floating out in mid-air again. It's time to pose frame 2 in order to adjust it to the correct position. Make sure you are on frame 2 and not frame 1, and select Bone01 again. Now, change the bone angles to "(0.0 164.78 90.0)", and the bone offset to "(89.2 -33.8 100.8)", and click Apply for the bone selection. We've changed the offset and rotation again to fit the pin snugly to Tifa's back. It should look like this:
    Animation editor
    Now we're almost done. We just have to go select frame 1 again, and hit duplicate. This should create a third frame, which is identical to the first frame in the bowling pin frameset. The third frame is used as a custom offset for some animations, such as Tifa's in-air downward slash animation. However, it is generally a subtle difference from frame 1, so we'll just leave it the same for the bowling pin. Now, finally, while model1 is selected (not model0), we can export the animation to a RDA file.

    Now that we have our final rdm and rda, we can just set up an object entry that specifies them, and create a new inventory item which references the object entry. Take a look at the files in rcgame/examplemod/assets/objects to see exactly how this is done.

    8.2. Player Models
    Nothing special needs to be done to import player models, except that they must be weighted ("rigged") to the AVALANCHE player skeleton. In the SDK this document was included in, you will see a ./samples/Player Models/ folder. That folder contains numerous models in .max and .smd formats, weighted to the AVALANCHE skeleton. Just import your model into a scene with one of those models, and weight it around the existing skeleton. Then export it to a format supported by mesh2rdm (such as .smd, .md5mesh, or a number of others), and use a command line for mesh2rdm.exe like the ones used in ./samples/Player Models/build_models.bat.

    Once you have built your player .rdm file, you can create a new costume to make use of it (see useritem3 in assets/objects/invitems.rci for an example - if you'd like that item to be immediately buyable from the Mako Forge, just give it a non-0 value for "cost"). You can also make a mod, and in your mod folder, put your player model .rdm in the assets/models/ folder and rename it to tifa.rdm. This will replace all instances of the Tifa model in your mod with your custom model.

    8.3. Level Models
    Level/map files are also expected by the R-Cube Engine in the same format as weapon models, player models, and all other kinds of models. Any solid object, defined in the assets/objects/*.rco file, placed in a map in the R-Cube editor, can be considered a "level model". Lots of formats can be imported as level models, and can be partitioned in numerous ways by mesh2rdm, to include quadtree or bsptree data. However, included in the SDK is also a ./samples/Maps/ folder. It contains a sample .map file built with free Quake 3 tools and GtkRadiant (a Quake 3 map editor), and a batch file to compile that map file with a custom q3map2 (included in the SDK), and finally turn it into a .rdm file.

    For a full demonstration of how to implement the sample map .rdm file as a level running in-game, take a look at the .samples/Sample Mod/ sample. It defines an object (.rco) entry for the model, and includes a custom map (.rcm) file saved from the R-Cube editor placing the model object.

    Using q3bsp as your level model source can be quite useful. The tools are all free, and the Quake 3 map compiler included in this SDK has been modernized in many ways, to support new next-gen rendering/technology features. It is also a very simple approach, and does not require you to learn how to use any additional 3D modeling software.


9. R-Script
    R-Script is a simple, but rather effective means of control game events and behaviors. It is used extensively in AVALANCHE for linear sequences such as cinematics, as well as for specifying events and simple logic in trigger sequences. All standard string arguments in R-Script commands can be prepended with $$ to specify the contents of a gvar, or "#stack0"-"#stack15" to specify a string on the R-Script stack. For example, statmsg "$$lshub_gotchoco" would print the contents of the lshub_gotchoco gvar to the HUD.

    9.1. Basic Commands
    This is a list of basic R-Script commands. For example usage, take a look at the files in assets/rscript.

    delay "ms"
    Delays the script for the specified millisecond count.

    delayrand "lowms" "highms"
    A random delay between the count of lowms and highms.

    cacheres "res"
    Caches a specified resource, using a character prefix to specify resource type.

    cacheobj "objname"
    Caches the game object objname and all associated resources.

    runscript "gameobjname" "scriptname"
    Creates an obj_rscript of name gameobjname, which runs the R-Script routine scriptname.

    changemap "mapname"
    Triggers a map change to mapname.

    waitonscript "gameobjname"
    Spins in place in the script execution until the script being run by gameobjname is completed.

    waitonframe "gameobjname" "framenum"
    Spins in place until gameobjname's animation frame reaches framenum.

    waitoninput "buttonnum"
    Spins in place until buttonnum is pressed the player.

    waitonenemiesdead
    Spins in place until no more living enemies are present on the map.

    waitondyingenemies
    Spins in place until enemies are gone, including bombs or other monsters which may already be dead but still present in the world.

    waitonenemiesnum "enemynum"
    Spins in place until the enemy count is less than or equal to enemynum.

    waitondead
    Spins in place if the player is dead.

    killenemies
    Kill all enemies in the player's name.

    killenemiespassive
    Kill all enemies but do not drop items or mako.

    killenemiesquiet
    Remove all enemies with no death sequence at all.

    togglenotarget
    Toggle AI notarget mode.

    toggleconfuse
    Toggle AI confusion mode.

    statmsg "msg"
    Prints msg in the HUD status area for all clients.

    setfade "val"
    Sets screen fade, where val is between 0.0 and 1.0.

    setfadecolor "(r g b a)"
    Sets the color of the screen fade, where each component (r/g/b/a) is between 0.0 and 1.0.

    lerpfade "val" "speed"
    Lerps the screen fade value toward val at speed.

    setpicfade "val"
    Sets foreground picture fade to val.

    lerppicfade "val" "speed"
    Lerps the foreground picture fade value toward val at speed.

    pushpic "texturename"
    Sets the foreground picture to texturename.

    showhud "bool"
    Toggles display of HUD based on whether bool is 1 or 0.

    runmenuscript "clindex" "menuscript"
    Activates menuscript on client clindex.

    setcinema "bool"
    Toggles cinema mode (affects various game behaviors, and enables fast-forward on kick button).

    setmusic "assets/music/track.ogg"
    Sets the active background music.

    setbattlemusic "bool"
    Toggles the automated battle music on and off.

    setskymodel "assets/models/skymodel.rdm"
    Sets the model for the skybox, to be rendered in sky surfaces.

    setskyterrain "assets/models/terrain.rdm"
    Sets the model which is overlaid on top of the skybox, if any.

    setskycolor "(r g b)"
    Sets sky blend color (0.0-1.0).

    setskycolorrand
    Sets the sky color to something random.

    setpropframes "proptargname" "startframe" "endframe" "frameduration" "looping_bool"
    Sets a cinema prop's animation state.

    forcenextanim "objtargname"
    Forces objtargname to enter its next frame of animation immediately regardless of blend considerations.

    setplmovespeed "val"
    Set player's move speed to val.

    setplcamtarg "targobj"
    Set player's camera target to targobj.

    setplcamrange "val"
    Set the player's camera range.

    giveplitem "itemname"
    Gives the player item of name itemname.

    giveplmako "val"
    Gives player val amount of mako.

    giveplcharge "val"
    Increases the player's charge meter by val.

    setcambolt "targobj" "bonename" "(x y z) offset"
    Bolts the camera to targobj on bone bonename, with the specified offset on the bone axis.

    setcamabsofs "targobj" "(x y z) offset"
    Bolts the camera to targobj with the specified offset in world space.

    setcamslack "val"
    Sets the camera's slack factor to val.

    setcamfov "val"
    Sets the camera's field of view to val.

    lerpcamfov "val" "speed"
    Lerps the camera's field of view to val at speed.

    setactiontime "ms"
    Sets the time type to "action time" (slow motions) for ms milliseconds.

    setactiontimescale "val"
    Sets the time scale multiplier for action time to val.

    setambientlight "(r g b)"
    Sets ambient light to r/g/b (0.0-1.0, or > 1.0 for over-saturated lighting).

    lerpambientlight "(r g b)" "speed"
    Lerp the ambient light to (r g b) at speed.

    setviewtrails "val" "decay"
    Set view trails to val, decrement at decay.

    setbloommod "val"
    Set the bloom modifier to val.

    setpcltimescale "val"
    Sets the time scale for the client-side particle system.

    setviewflash "dur" "(r g b)"
    Set the view to flash for dur at color (r g b).

    setviewshake "val"
    Sets view shake factor to val.

    setenspawnblock "bool"
    Toggles block on enemy spawns.

    objcreate*
    Various functions to spawn objects in, at, or near things. See their example uses in existing scripts.

    objremove "objname"
    Remove objname from the world.

    objactivate "objname"
    If objname has an activate behavior, run it.

    objmovepos "objname" "(x y z)" "movespeed"
    Moves objname to (x y z) at movespeed.

    objsetpos "objname" "(x y z)"
    Sets objname's position to (x y z).

    objputground "objname" Puts objname on the ground by tracing downward.

    objgivehealth "objname" "healthamt"
    Increases objname's health by healthamt.

    objsettarget "objname" "targname"
    Sets objname's target to targname.

    objsetdebounce "objname" "debounce"
    Set objname's debounce time to debounce.

    objmoveang "objname" "(pitch yaw roll)" "speed"
    Move objname's angles to (pitch yaw roll) at speed.

    objlookat "objname" "targname" "speed"
    Move objname's angles to look at targname at speed.

    objsetang "objname" "(pitch yaw roll)"
    Set objname's angles to (pitch yaw roll).

    objsound "objname" "assets/sound/soundname.wav"
    Play sound at objname.

    objsoundrand "objname" "assets/sound/soundname.wav" "rfac"
    Play sound at objname randomly based on rfac.

    objfx "objname" "(x y z)" "(pitch yaw roll)" "bonename" "particles"
    Play particle system particles on objname, with optional specified offsets and bone name. Offsets and bone name can be "".

    objfxbolted "objname" "(x y z)" "(pitch yaw roll)" "particles"
    Same as objfx, but stays bolted to objname with relative movement.

    objrfxsetbit "objname" "rfxbit"
    Sets the rfxbit bit in objname's renderEffects field.

    objrfxunsetbit "objname" "rfxbit"
    Unsets the rfxbit bit in objname's renderEffects field.

    objrfx2setbit "objname" "rfxbit"
    Sets the rfxbit bit in objname's renderEffects2 field.

    objrfx2unsetbit "objname" "rfxbit"
    Unsets the rfxbit bit in objname's renderEffects2 field.

    objsetanim "objname" "animname"
    Looks for animname in objname's animation table. If it is found, the animation is played on objname.

    objsetanimnum "objname" "animnum"
    Plays animation on objname with animnum as a direct index into objname's animation table.

    objsetaigoal "objname" "goalname" "range"
    Causes AI objname to seek goalname until it is within range units.

    objsetaienemy "objname" "enemyname"
    Sets objname's enemy to enemyname.

    objsetailookgoal "objname" "goalname"
    Sets AI objname's look goal to goalname.

    objsetaimovespeed "objname" "speed"
    Sets AI objname's move speed to speed.

    objtalkbubble "objname" "name" "text" "duration"
    Puts a text bubble above objname's head, with name and text specifying the contents, for duration milliseconds. If duration is 0, bubble stays up indefinitely. Often used together with waitoninput to remove the bubble manually after the player presses jump.

    objdamage "objname" "dmg"
    Inflicts dmg damage on objname.

    objsetlight "objname" "(r g b)"
    If objname is a light, sets the light's color to (r g b).

    9.2. R-Op Commands
    R-Op Commands are a set of R-Script commands which provide access to arbitrary logic and arithmetic operations, in much the same way that an assembly language would. These commands are intended for advanced R-Script users. There are 8 R-Script registers, referred to as "r0" through "r7". Examples of the use of most of these commands can be found in existing AVALANCHE script code.

    rop_cmpi/rop_cmpu/rop_cmpf/rop_cmps "a" "b"
    Sets the conditional internal register based on the results of a comparison between a and b, where a and b are integers, unsigned integers, floating point values, or strings, in the case of i/u/f/s.

    rop_jmp "label"
    Jumps in the point of script execution to the point of label. Labels are defined in R-Script with the syntax "$l: labelname".

    rop_jr
    Jumps back to the command that was being executed prior to the last jump.

    rop_je/rop_jne/rop_jge/rop_jle/rop_jg/rop_jl "label"
    Conditional jumps to label, with the condition based on the internal register set by the rop_cmp commands. Conditions are, in order, if equal, if not equal, if greater than or equal, if less than or equal, if greater than, if less than.

    rop_push "str"
    Pushes str to the R-Script stack.

    rop_pop
    Pops a string off the R-Script stack.

    rop_popgvar "gvar"
    Pops a string off the R-Script stack and stores it in gvar.

    rop_ldri/rop_ldru/rop_ldrf "r0" "val"
    Loads integer/unsigned integer/float val into r0.

    rop_ldro "r0" "objname" "fieldname"
    Loads data from a specified field on objname into r0. The following values can be specified as fieldname:
    "hurtable"
    "health"
    "numAnims"
    "curAnim"
    "isOnFire"
    "alwaysSend"
    "canPush"
    "canBePushed"
    "localFlags"
    "net.index"
    "net.type"
    "net.pos[0]"
    "net.pos[1]"
    "net.pos[2]"
    "net.ang[0]"
    "net.ang[1]"
    "net.ang[2]"
    "net.vel[0]"
    "net.vel[1]"
    "net.vel[2]"
    "net.mins[0]"
    "net.mins[1]"
    "net.mins[2]"
    "net.maxs[0]"
    "net.maxs[1]"
    "net.maxs[2]"
    "net.renderEffects"
    "net.renderEffects2"
    "net.effectLen"
    "net.solid"
    "net.owner"
    "net.frame"
    "net.lerpDuration"

    rop_ldrinv "r0" "itemname"
    Fills r0 with the number of itemname in the player's inventory.

    rop_stro "r0" "objname" "fieldname"
    Writes into objname's fieldname field with the contents of r0.

    rop_strgi/rop_strgf "r0" gvarname"
    Sets gvar gvarname as an integer or float with the contents of r0.

    rop_addi/rop_addu/rop_addf "r0" "r1"
    Adds r1 to r0 as integers/unsigned integers/floating point values. r1 may also be an immediate mode value (raw decimal/float).

    rop_subi/rop_subu/rop_subf "r0" "r1"
    Subtracts r1 from r0 as integers/unsigned integers/floating point values. r1 may also be an immediate mode value (raw decimal/float).

    rop_muli/rop_mulu/rop_mulf "r0" "r1"
    Multiplies r0 with r1 as integers/unsigned integers/floating point values. r1 may also be an immediate mode value (raw decimal/float).

    rop_divi/rop_divu/rop_divf "r0" "r1"
    Divides r0 by r1 as integers/unsigned integers/floating point values. r1 may also be an immediate mode value (raw decimal/float).

    rop_shl "r0" "r1"
    Performs a bitwise left shift on r0 by r1. r1 may also be an immediate mode value (raw decimal/float).

    rop_shr "r0" "r1"
    Performs a bitwise right shift on r0 by r1. r1 may also be an immediate mode value (raw decimal/float).

    rop_and "r0" "r1"
    Performs a bitwise and on r0 by r1. r1 may also be an immediate mode value (raw decimal/float).

    rop_or "r0" "r1"
    Performs a bitwise or on r0 by r1. r1 may also be an immediate mode value (raw decimal/float).

    rop_xor "r0" "r1"
    Performs an exclusive or on r0 with r1. r1 may also be an immediate mode value (raw decimal/float).