Return To Castle Wolfenstein - Scripting Definitions

# Return to Castle Wolfenstein
Wolfenstein Scripting Definitions

By: Gray Matter Scripting Team

Copyright © 2000 Gray Matter Interactive Studios

HTML Adaption by GtkRadiant team - Jan 20, 2002

# AI Attributes

### running_speed 220

Sets the AI's running speed. Default: 220 Range: 1 ? 300

### walking_speed 90

Sets the AI's walking speed. Default: 90 Range: 1 ? 300

### crouching_speed 80

Sets the AI's crouching-moving speed. Default: 80 Range: 1 ? 300

### fov 240

This sets the FIELD OF VIEW for the AI. Default: 240 Range 1 ? 360

### yaw_speed 300

Sets the YAW SPEED, how fast they turn around. Default: 300 Range: 1 ? 300

### leader 0.0

(Not fully functional! Use at own risk!)
Changes the AI's personality/behavior. Default: 0 Range 0.0 ? 1.0

### aim_skill 0.5

Sets the AI's ability to shoot at specific targets. Default: 0.5 Range: 0.0 ? 1.0

### aim_accuracy 0.5

Sets the AI's accuracy. Default: 0.5 Range: 0.0 ? 1.0

### attack_skill 0.75

Sets the AI's weaponry tactics. Grenades VS. Machine Gun, etc. Default: 0.75 Range: 0.0 ? 1.0

### reaction_time 0.5

Sets the AI's reaction time in seconds. Default: 0.5 Range: 0.0 ? 1.0

### attack_crouch 0.4

Sets the AI's frequency to crouch while attacking. Default: 0.4 Range: 0.0 ? 1.0

### idle_crouch 0.0

Sets the AI's frequency to crouch while in idle. Default: 0.0 Range: 0.0 ? 1.0

### AGGRESSION

Sets the AI's aggression, good for charging it's enemies. Default: 0.5 Range: 0.0 ? 1.0

### tactical 0.8

Sets the AI's tactical abilities, using environment for protection. Default: 0.8 Range: 0.0 ? 1.0

### camper 0.0

Sets the AI's camping abilities. Default: 0.0 Range: 0.0 ? 1.0

### alertness 16000

Sets the AI's sight distance in pixel units. Default: 16000 Range: 0 ? 999999

### starting_health 100

Sets the AI's health when spawning in. Default: 100 Range: 0 ? 99999

### hearing_scale 1.0

Sets the AI's hearing. Default: 1.0 Range: 0.0 ? 10

### inner_detection_radius 512

Sets the Inner Detection Radius (IDR) for the AI in pixel units. The IDR will make the AI react to several things. Example: Bullet impacts within the IDR will affect the AI.

## AI Scripting Events

    Key:
    [word/number] = Optional
    <word/number> = Mandatory

## Attributes

Sets the AI's behavior when they first spawn in.

### spawn

Will run all of the commands within this event upon spawning.

### enemysight [ainame]

This event will trigger when they see a enemy AI. If AINAME is used, then this will only trigger upon sight of the matching enemy AI.

### sight [ainame]

This event will trigger when they see a friendly AI. If AINAME is used, then this will only trigger upon sight of the matching friendly AI.

### enemydead <ainame>

This event will trigger when the enemy AI (with corresponding AINAME) dies.

### trigger <event>

This event will trigger when called upon, either by another script calling on this, or when going through a trigger brush.

### pain <threshold>

This event will trigger when the AI is at a certain health.

### death

This event will trigger once the AI dies. NOTE: All of the commands within this event must not take any think-time. For example, you cannot have a WAIT command in this event. If you do, it will crash.

### activate <ainame (usually player)>

This event will trigger when the ?PLAYER? uses/activates this AI.

### enemysightcorpse [ainame]

This event will trigger when the AI sees an enemy corpse.

### friendlysightcorpse

This event will trigger when the AI sees a friendly corpse.

### avoiddanger [weapon]

This event will trigger when trying to avoid a weapon.

### blocked <ainame (usually player)>

This event will trigger when the player is blocking the AI from proceeding.

### statechange <current state> <result state>

relaxed query - When the AI changes state from ?relaxed? to ?query? then this even will trigger.
relaxed alert - When the AI changes state from "relaxed" to "alert" then this even will trigger.
relaxed combat - When the AI changes state from "relaxed" to "combat" then this even will trigger.
query relaxed - When the AI changes state from "query" to "relaxed" then this even will trigger.
query alert - When the AI changes state from "query" to "alert" then this even will trigger.
query combat - When the AI changes state from "query" to "combat" then this even will trigger.
alert combat - When the AI changes state from "alert" to "combat" then this even will trigger.
combat alert - When the AI changes state from "combat" to "alert" then this even will trigger.

### bulletimpact

This event will trigger when the AI detects a bullet within their IDR.

### inspectbodystart [ainame]

When the AI first sees a dead body this will trigger. you are able to put an ainame following the command which will only trigger when that AI is dead. You can place a ?DENY? in this even to stop the AI from inspecting the body.

### inspectbodyend

This will trigger when the AI reaches the dead body.

### inspectsoundstart

This will trigger when the AI hears a sound. He will then go and investigate that sound. You can place a ?DENY? in this event to stop the AI from inspecting the sound.

### inspectsoundend

This will trigger when the AI has reaches the location of the sound.

### playerstart

This will trigger once the player clicks on the 'next (arrow) button just after the loading.

### fakedeath

This is triggered when the ZOMBIE does his ?fake death.?

### attacksound

If used, then once the AI starts to attack the player, and make a noise, this will trigger. Able to put ?Deny? in order to prevent the AI to use generic sounds.

### bulletimpactsound

If you want to have the AI say something when bulletimpact is triggered, use this event, do not use ?bulletimpact.?

### inspectfriendlycombatstart

This is triggered when the AI sees a friendly AI in combat.

## AI Scripting Commands

### gotomarker <targetname> [firetarget] [noattack] [nostop]

Tells the AI to go to an AI_MARKER using the current "MOTETYPE"; FIRETARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving. NOSTOP- increases the AI_MARKER size by 32 pixels so that it gives a nice transition from 1 marker to the next.

### runtomarker <targetname> [firetarget] [noattack] [nostop]

Tells the AI to run to an AI_MARKER. FIRETARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving. NOSTOP- increases the AI_MARKER size by 32 pixels so that it gives a nice transition from 1 marker to the next.

### walktomarker <targetname> [firetarget] [noattack] [nostop]

Tells the AI to walk to an AI_MARKER. FIRETARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving. NOSTOP- increases the AI_MARKER size by 32 pixels so that it gives a nice transition from 1 marker to the next.

### crouchtomarker <targetname> [firetarget] [noattack] [nostop]

Tells the AI to crouch to an AI_MARKER. FIRETARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving. NOSTOP- increases the AI_MARKER size by 32 pixels so that it gives a nice transition from 1 marker to the next.

### gotocast <ainame> [firetarget] [noattack]

Tells the AI to go to an AI character using the current MOVETYPE. FIREATTARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving.

### runtocast <ainame> [firetarget] [noattack]

Tells the AI to run to an AI character. FIREATTARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving.

### walktocast <ainame> [firetarget] [noattack]

Tells the AI to walk to an AI character. FIREATTARGET- Shoots at this target while moving; NOATTACK- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving.

### crouchtocast <ainame> [firetarget] [noattack]

Tells the AI to crouch to an AI character. FIREATTARGET- Shoots at this target while moving; NOATTACK -4- Does not attack while moving, may be used with firetarget so the AI faces/tracks a certain target while moving.

### wait <duration> [moverange] [facetarget]

Tells the AI to wait for a certain duration. MOVERANGE- Used to set the amount of mobility the AI is able to use while waiting. FACETARGET- Used to track/look at a target.

### trigger <ainame/scriptname> <event>

This will call/trigger an AI or Script_mover to run it's "trigger <event>"

### followcast <ainame>

This will tell the AI to follow an AI Character.

### playsound <soundname OR scriptname>

This will play a sound.wav or a script name in one of the .sounds files.

### noattack <duration>

This will tell the AI not to attack for the duration.

### attack [ainame]

This will tell the AI to attack an AI.

### playanim <animation> [legs/torso/both]

This will tell the AI to play a certain animation once. LEGS- Only to play the LEGS animation. TORSO- Only to play the torso animation. BOTH- Play both LEGS and TORSO.

### setammo <pickupname> <count>

Sets the amount of ammo given to the AI.

### selectweapon <pickupname>

Tells the AI to select a certain weapon.

### giveweapon <pickupname>

Tells the AI to give him/her-self a certain weapon.

### givearmor <pickupname>

Tells the AI to give him/her-self armor.

### giveinventory <pickupname>

Tells the AI to give him/her-self an inventory item.

### takeweapon <pickupname>

Tells the AI to get rid of a certain weapon.

### movetype <walk/run/crouch/default>

Tells the AI to either walk/run/crouch everywhere. Default=run.

### alertentity <targetname>

This will trigger/activate certain entities in the map. Usually just TARGET_RELAYS.

### savegame

This will save the game for the player.

### fireattarget <targetname> [duration]

This will tell the AI to fire at a specific target once. If you add a DURATION you the AI will shoot for the duration.

### godmode <on/off>

This will give the AI invincibility.

### accum <buffer_index> <command> <paramater>

Accum is used for "what if" statements. Accums store integers which are used to trigger scripts.

### accum <n> inc <m>

This is used to "increase"/add to value already stored in the accum.

### accum <n> abort_if_less_than <m>

This is used to abort the script if the value of accum <n> is less than <m>.

### accum <n> abort_if_greater_than <m>

This is used to abort the script if the value of accum <n> is greater than <m>.

### accum <n> abort_if_equal <m>

This is used to abort the script if accum <n> is equal to <m>.

### accum <n> abort_if_not_equal <m>

This is used to abort the script if accum <n> is not equal to <m>.

### accum <n> set <m>

This is used to set the value of accum <n> to <m>.

### accum <n> bitset <m>

This will set accum n's bitset of 0-31 to ON or 1, whichever you prefer.

### accum <n> bitreset <m>

This will set accum n's biteset of 0-31 to OFF or 0, whichever you prefer.

### accum <n> abort_if_bitset <m>

This will abort if the bitset is ON or 1. So, the bitset needs to be OFF or 0.

### accum <n> abort_if_not_bitset <m>

This will abort if the bitset is OFF or 0. So, the bitset needs to be ON or 1.

### accum <n> random <m>

This is used so that accum <n> will randomly choose a number.

### missionfailed

This is used to fail the PLAYER from completing his mission objectives.

### objectivemet <n>

This is used to tell the player and update the journal that he/she has completed their objective.

### objectiveneeded <n>

This is used in the ?player? spawn to tell the player how many objectives he/she needs to complete the mission.

### noaidamage <on/off>

This tells the AI not to take damage from any other AI.

### print <text>

This will PRINT text up on the screen/console.

### facetargetangles <targetname>

This will tell the AI to match the same angle as the Target. The target's angle is determined within Radiant.

### resetscript

This will tell the AI to FORGET everything he is doing and everything he has done and either continue the script or go into dynamic mode.

### mount <targetname>

This will tell the AI to mount a fixed weapon. Must have a fixed weapon nearby.

### unmount

This will tell the AI to dismount the fixed weapon he is currently on.

### savepersistant <next_mapname>

???

### changelevel <mapname> [nostats] [persistant]

This will change the map to the "mapname." NOSTATS- This will not display the PLAYERS score/kills. PERSISTANT- This will bring all of the items

### teleport <targetname>

This will teleport the AI to the origin of the ?targetname? instantly.

### foundsecret

This will increase the "Found Secrets" on the score board by 1.

### nosight <duration>

This will make the A.I. Blind for a duration.

### sight

This will make the A.I. See if the AI is already blind.

### noavoid

This will tell the A.I. Not to avoid anything. Including AI/Player/Script_movers.

### avoid

This will tell the A.I. To avoid other AI/Player/Script_movers. Note: By default, this is always on unless you tell it to "noavoid."

### attrib <attribute> <value>

This will change any of the AI's attributes during a scripted event. Note: STARTING_HEALTH cannot be used in this command.
See SETHEALTH for details.

### denyaction ("activate" Event only.)

This will deny the player from hitting his "use/activate" button on this particular AI.

### headlook <on/off>

This will turn on/off the head look for the AI. This is an ambient head motion. NOTE: The AI's tactical must be set to 0.5+

### deny ("avoiddanger" event only)

This will tell the AI to not avoid danger. Example, when a bazooka is fired at this AI he will not avoid the rocket.

### backupscript

This will backup the last script running for the AI.

### restorescript

This will restore the last script the AI was running. Must have backupscript before restorescript can function.

### statetype <alert>

This changes the AI's STATE. Currently, there's only ALERT.

### knockback <on/off>

This enables/disables knockback, by default, it's ON. Knockback is the ability to knock the AI backwards due to a bullet hitting them.

### clearanim

This stops the current animation the AI is playing and resets them to their default animation, depending on their state.

### zoom <on/off>

This enables/disables the AI to use his binoculars. This also increases their IDR by 10 times the set amount. It also decreases their FOV by 80%.

### parachute <on/off>

This enables/disables the AI to use a PARACHUTE movetype. This will enable them to play the parachute animation and shoot at the same time. As PLAYANIM is not able to do this, yet.

### cigarette <on/off>

This enables/disables the AI to have a cigarette in his left hand or not.

### sethealth <n>

Since "attrib starting_health" does not work, we added this command so it does work.

### notarget <on/off>

This will enable notarget for the AI, just like notarget is for the player.

### startcam <camera file>

This is used to call a camera and have it play.

### startcamblack <camera file>

This is used to start a camera and have it play with a fade-up from black.

### stopcam

This immediately stops the current camera.

### cvar <cvarname> <value>

This is used to set "ROM" cvar commands.

### mu_start <wav file> <n>

This is used to start the music file. The wav file is located in the main/music folder. <n> is the time you want to fade-up.

### mu_stop <n>

This is used to stop the music file.

### mu_fade <wav file> <n>

This is used to start the music file. The wav file is located in the main/music folder. <n> is the time you want to fade-up.

### mu_queue <wav file>

This is used to start the next sound track right as soon as the current one stops playing.

### explicit_routing <on/off>

This is used to turn on/off the AI's ability to dynamically navigate. Default, it's on.

### lockplayer <on/off>

This is used to lock the player's movement. However, the player is still able to look around.

### pushaway <ainame>

This is used to push the entity away, that is in front of the AI. Example; village1 when Kessler pushes the player out of the way, if the player tried to block him.

### catchfire

This will instantly catch the AI on fire. This was used to prevent a bug from happening on faster machines in crypt2, where the guy comes around the corner on fire and then dies.

## Brush Scripting Events

### spawn

Will run all of the commands within this event upon spawning.

### trigger <event>

Will run all of the commands within this event when called/trigger upon.

### death (NOTE: Must have a "health" specified in entity.)

Will run all of the commands within this event when this AI dies. NOTE: You cannot use "wait"

## Brush Scripting

### gotomarker <targetname> <speed> [accel/deccel] [turntotarget] [wait]

This will tell the SCRIPT_MOVER to move to a target, usually a Path_corner. Targetname is "name" of the PATH_CORNER; SPEED is used for how fast the SCRIPT_MOVER will move to the PATH_CORNER; ACCEL/DECCEL are used to accelerate/deccelerate to a PATH_CORNER. NOTE: For ACCEL, the SCRIPT_MOVER needs to start at speed of 0, and DECCEL needs to end at a speed of 0; TURNTOTARGET will face towards the targer (PATH_CORNER) depending on the angle; WAIT is used so that the script will not read ahead until the SCRIPT_MOVER has reached the TARGETNAME.

### wait <duration>

This will tell the SCRIPT_MOVER to not move for the duration.

### trigger <aiName/scriptName> <trigger>

This will call/trigger an AI or Script_mover to run it's "trigger <event>"

### playsound <soundname OR scriptname> [LOOPING]

This will play a sound.wav or a script name in one of the .sounds files. LOOPING will loop the sound until "STOPSOUND" is used.

### playanim <startframe> <endframe> [looping forever/duration] [rate FPS]

This will play an animation that the model has. STARTFRAME is the frame number you want to start on. ENDFRAME is the last frame number you want to play. LOOP FOREVER/DURATION is used if you want the animation to loop forever, or for a duration. RATE is used so that you can slow down the FPS.

### alertentity <targetname>

This will trigger/activate certain entities in the map. Usually just TARGET_RELAYS.

### accum <buffer_index> <command> <paramater>

Accum is used for "what if" statements. Accums store integers which are used to trigger scripts.

### accum <n> inc <m>

This is used to "increase"/add to value already stored in the accum.

### accum <n> abort_if_less_than <m>

This is used to abort the script if the value of accum <n> is less than <m>.

### accum <n> abort_if_greater_than <m>

This is used to abort the script if the value of accum <n> is greater than <m>.

### accum <n> set <m>

This is used to set the value of accum <n> to <m>.

### accum <n> bitset <m>

This will set accum n's bitset of 0-31 to ON or 1, whichever you prefer.

### accum <n> bitreset <m>

This will set accum n's biteset of 0-31 to OFF or 0, whichever you prefer.

### accum <n> abort_if_bitset <m>

This will abort if the bitset is ON or 1. So, the bitset needs to be OFF or 0.

### accum <n> abort_if_not_bitset <m>

This will abort if the bitset is OFF or 0. So, the bitset needs to be ON or 1.

### accum <n> random <m>

This is used so that accum <n> will randomly choose a number.

### missionfailed

This is used to fail the PLAYER from completing his mission objectives.

### missionsuccess <mission_level>

This is used to tell the PLAYER he/she has completed the mission.

### print <text>

This will PRINT text up on the screen/console.

### faceangles <pitch> <yaw> <roll> <duration/GOTOTIME>

This will tell the SCRIPT_MOVER to rotate. DURATION/GOTOTIME, Duration will determine how long it takes the SCRIPT_MOVER to get to the ANGLES you inputed. GOTOTIME will calculate the time it takes for the SCRIPT_MOVER to reach it's target (PATH_CORNER).

### resetscript

This will tell the AI to FORGET everything he is doing and everything he has done and either continue the script or go into dynamic mode.

### attachtotag <targetname/scriptname> <tagname>

This will attach this SCRIPT_MOVER to the TAG on another SCRIPT_MOVER. NOTE: The SCRIPT_MOVER you will attach to must havea TAG with a TAGNAME. The modeller (Jason) will do this for you.

### stopsound

This will stop the sound the SCRIPT_MOVER is playing.

### halt

This will stop the SCRIPT_MOVER in it's tracks.

### backupscript

This will backup the last script running for the script_mover.

### restorescript

This will restore the last script the script_mover was running. Must have backupscript before restorescript can function.

### sethealth <n>

This resets the health of the script_mover to <n>.

### Basic Player Scripting structure

    player
    {
      spawn
      {
      }

      trigger <event>
      {
      }

      death
      {
      }
    }

### Basic AI Scripting structure

    ainame
    {
      attributes
      {
      }

      spawn
      {
      }

      trigger <event>
      {
      }

      pain <threshold>
      {
      }

      death
      {
      }

      enemysight
      {
      }
    }

### Basic AI Marching Loop

    nazi1
    {
      attributes
      {
        aim_accuracy 0.75
        attack_crouch 0.1
        idle_crouch 0.1
      }

      spawn
      {
        trigger nazi1 marchloop // This will begin the Marching loop.
      }

      trigger marchloop
      {
        walktomarker n1spot1
        walktomarker n1spot2
        facetargetangles n1spot2
        wait 4000
        walktomarker n1spot3
        walktomarker n1spot4
        facetargetangles n1spot4
        wait 4000
        trigger nazi1 marchloop // Restarts the marching loop.
      }

      death
      {
      }

      enemysight
      {
      }
    }

### Basic Brush Scripting Structure

    scriptname
    {
      spawn
      {
      }

      trigger <event>
      {
      }

      death
      {
      }
    }

### Basic Brush Scripting Clock Arm Rotating.

    clockarm1
    {
      spawn
      {
        trigger clockarm1 rotateloop // Begins the rotate loop.
      }

      trigger rotateloop
      {
        faceangles -90 0 0 1000
        faceangles -180 0 0 1000
        faceangles -270 0 0 1000
        faceangles -360 0 0 1000
        trigger clockarm1 rotateloop // Triggers the rotate loop over again.
      }

      death
      {
      }
    }