Fallout 1 and Fallout 2 scripting - commands, reference, tutorials

### Introduction

The goal of this page is to consolidate any and all references, guides, and tidbits of information surrounding the Star-Trek Scripting Language used in Fallout 2. Included is a comprehensive list of all available script commands tailored to Fallout 2's game engine. Many of the entries in this list originated from Chris Avellone's documentation, namely the Fallout 2 editor introduction.

Albeit a less-pronounced focus of the page, information regarding Fallout 1 scripting is included as well. Aside from TeamX sniffing around in the original engine, this topic has seen neglect due to its lack of relevance thanks to the title's successor.

* It's important to note that not all of the commands listed below will compile when scripting for Fallout 1. Many symbols were implemented during development of Fallout 2 and thus aren't backward-compatible with the original engine. It is very easy to tell if the command is not supported in Fallout 1 because during compiling you will see an error message like this:

```
Compiling OBJ_DUDE.ssl
OBJ_DUDE.ssl(87): Error! **Undefined symbol** fallout2scriptcommand.

```

Having prior programming experience in either C or Pascal will prove useful--though not entirely necessary--as the syntax of the scripting language is derived from that of both languages. Since the commands for the scripting language are written in plain English, it's easy enough to pick up in practice. For example, both code snippets below would (theoretically) render the same result:

**C Syntax**

```
int main()
{
   std::cout << "Hello, world!\n";
}

```

**SSL Syntax**

```
procedure HelloWorld
begin
      display_msg("Hello, world!");
end

```

### Script commands (alphabetically)

Here are links to the original files that much of this list came from. This wiki page contains updates on many of them, but the formatting of this wiki doc is poor compared to the originals. For reference:
http://www.mediafire.com/view/?i723xdhw8718tlq (.pdf) ***starts at page 9***
## http://www.mediafire.com/view/?yennrt3n26xxr09 (.doc) ***starts at page 9***

#### A

**action\_being\_used** int

Script Returns the current skill () being used on a script object.

*Usually seen in the form of "if action\_being\_used == ## then"*

**add\_obj\_to\_inven** void Inven

```
who (ObjectPtr)
item (ObjectPtr)

```

Adds an object (item) to another object’s (who’s) inventory. Note that this only works with objects of type Item.

**AddNamedHandler** void Inven

```
name (ObjectPtr)
proc (Procedure)

```

Adds named handler (proc) for event (name). Can be signaled many times.

**AddNamedEvent** void Inven

```
name (ObjectPtr)
proc (Procedure)

```

Adds named handler (proc) for event (name). Can be signaled only once, and removed afterwards.

**add\_mult\_objs\_to\_inven** void Inven

```
who (ObjectPtr)
item (ObjectPtr)
count (int)

```

Adds (count) instances of an object (item) to another object’s (who’s) inventory. Note that this only works with objects of type Item.

**add\_timer\_event** void Meta(Time)

```
obj (ObjectPtr)
time (int)
info (int)

```

Adds a timed event call to the queue, at a given time offset, to call an object’s (obj) script. Info is used to let scripts differentiate between timed event calls so that they can be hooked in multiple times. Info is read back by the script using the fixed\_param operator. Note that time is in ticks (you can use game\_ticks(seconds\_num) to get the time in ticks from time in seconds).

**anim**  void Anim

```
who (ObjectPtr)
anim (int)
direction (int)

```

Sets up a single-frame animation (anim) for the object (who) that runs in the given direction.

**anim\_action\_frame** int Anim

```
who (ObjectPtr)
frame (int)

```

Returns the action frame of the given art frame on a given object (who). This can be used as the delay in an animation registration sequence.

**anim\_busy** int (boolean) Anim

```
who (ObjectPtr)

```

Returns True if object (who) is currently animating, otherwise False. This can be used to determine if a given object has completed an animation.

**animate\_move\_obj\_to\_tile** void Anim

```
who (ObjectPtr)
tile (int)
speed (int)

```

Sets up an animation for a critter (who) to walk to a given tile (hex) at a given speed (speed). Speed (walk/run) can also have a flag attached (see define.h) to force the object (who) to stop it’s current animation (for instance, if it was already walking somewhere) and then walk/run to the new location (tile).

**animate\_rotation** void Anim  ***[Fallout 2 only!]***

```
direction (0-5)

```

Changes the orientation (facing) of the self-object to the given direction.
*Note: In Fallout 1 this can be done with the anim() command.* An example:

```
anim(dude_obj, 1000, rotation_to_tile(tile_num(dude_obj), tile_num(Critter)));

```

**animate\_run\_to\_tile** void Anim  ***[Fallout 2 only!]***

```
tile (int)

```

Sets up an animation for the self-object to RUN to a given tile (hex).

**animate\_set\_frame** void Anim

```
newFrame (int)

```

Changes the current animation frame of the self-object to the given frame # (newFrame). This can be used to make lights go to broken lights or to alarm/siren lights, for example. Should be used in place of animate\_stand for 2-frame anims.

**animate\_stand** void Anim

Sets up an animation for the currently focused object (self) to run it’s stand animation. This can be used to open doors, open container items (Refridgerator, for example) or to run a critter’s fidget animation.

**animate\_stand\_obj** void Anim

```
obj (ObjectPtr)

```

Sets up an animation for an object (obj) to run it’s stand animation. This can be used to open doors, open container items (Refridgerator, for example) or to run a critter’s fidget animation.

**animate\_stand\_reverse** void Anim

Sets up an animation for the currently focused object (self) to run it’s stand animation in reverse. This is used only for non-critters, to cause them to close (close doors, open containers, etc.

**animate\_stand\_reverse\_obj** void Anim

```
obj (ObjectPtr)

```

Sets up an animation for an object (obj) to run it’s stand animation in reverse. This is used only for non-critters, to cause them to close (close doors, open containers, etc.)

**art\_anim**  void Anim

```
fid (int)

```

Returns the animation that this fid represents (ANIM\_stand, ANIM\_pickup, etc.).

**attack**  void Combat

```
who (ObjectPtr)

```

Causes the focused object (self) to attempt to attack an object (who). Note that this is a macro to attack\_complex() below.

**attack\_complex** void Combat

```
who (ObjectPtr)
called_shot (int)
num_attacks (int)
bonus (int)
min_damage (int)
max_damage (int)
attacker_results (int)
target_results (int)

```

Causes the current object (self – must be a critter) to attempt to attack a critter (who) with various parameters modifying the combat:

```
called_shot – 0/1/specific means none/random/specific (head, torso, etc.)
num_attacks – the # of extra attacks the self object gets before the target
bonus – the bonus to hit the target on the first turn only
min_damage – the minimum damage that will be done the first attack
max_damage – the maximum damage that will be done the first attack
attacker_results – what state the attacker ends in after the first attack
target_results – what state the target ends in after the first attack

```

**attack\_setup** void Combat

```
who (ObjectPtr)
victim (ObjectPtr)

```

Sets up an attack from who on victim, without expecting this script to be involved. Can be used to setup attacks on critters from the map script. car\_current\_town int Map Returns the current town area the car can be found at. Area #’s can be found in scripts\headers\maps.h car\_give\_to\_party int Map Gives the car to the party, and takes them to the worldmap.

#### C

**car\_give\_gas** int Map   *''* **[Fallout 2 only!]**

```
amount (int)

```

Gives the car a given amount (amount) of gas.

**combat\_difficulty** int

Returns the current Combat difficulty level of the game (defined in the options screen).

**combat\_is\_initialized** int

Returns True if the system is currently in combat mode, False otherwise.

**ClearNamed** void

```
event (string)

```

Removes all handlers for named event (event).

**create\_object** int (?) Object

```
pid (int)
tile_num (int)
elev (0-2)

```

Creates a new object of prototype (pid), placing it at a given tile # and at a given elevation. If the prototype indicates a script should be attached, then it will be.

**create\_object\_sid** int (?) Object

```
pid (int)
tile_num (int)
elev (0-2)
sid (int)

```

Creates a new object of prototype (pid), placing it at a given tile # and at a given elevation. If sid is not -1, then it indicates that the default script should be overriden by this new script #.

**critter\_add\_trait** int Critter

```
who (ObjectPtr)
trait_type (int)
trait (int)
amount (int)

```

Adds a particular trait (trait) of a given type (trait\_type) to a particular critter (who). Possible traits under the SPECIAL system are limited to:

```
Perks
Traits
Object-instance information (such as team #’s, ai-packet #’s, etc.)

```

**critter\_attempt\_placement** int Map

```
who (ObjectPtr)
hex (int)
elev (0-2)

```

Attempts to place a critter at a given destination hex & elevation, if it fails, then it tries to find a nearby hex that is that is as near as possible to the start hex. No LONGER checks to see if the hex is visible on-screen.

**critter\_damage**  void Critter    ***[Macros Fallout 2]***

```
who (ObjectPtr)
dmg_amount (int)

```

Inflicts damage on a critter (who) of a given amount, killing it if necessary.

**critter\_heal** void Critter

```
who (ObjectPtr)
amount (int)

```

Heals a critter for a given amount (if given a value above their MaxHP will go up to their maximum HP). *[Note: can also input negative amounts, causing the critter to be hurt for that amount. This is useful because it bypasses all resistances and thresholds.* Sduibek (talk) 18:03, August 4, 2012 (UTC)*]*

**critter\_injure** int Critter

```
who (ObjectPtr)
how (int)

```

Injures a given critter (who) by crippling given limbs/body parts (defined by DAM\_CRIP\_ARM\_LEFT, DAM\_BLIND, etc. in define.h)

**critter\_inven\_obj** (ObjectPtr) Critter/Inven

```
who (ObjectPtr)
where (int)

```

Returns a pointer to an object that is in a given spot (NULL if none). The appropriate values for where are: INVEN\_TYPE\_WORN, INVEN\_TYPE\_RIGHT\_HAND, and INVEN\_TYPE\_LEFT\_HAND.

**critter\_is\_fleeing** int Critter

```
who (ObjectPtr)

```

Returns True if the critter object (who) has its FLEE flag set.

**critter\_mod\_skill** int Critter

```
who (ObjectPtr)
skill (int)
amount (int)

```

Modifies a given skill in a given critter object (who) by a given amount. Note: this currently is only valid on the player (obj\_dude) object.

**critter\_rm\_trait** int Critter

```
who (ObjectPtr)
trait_type (int)
trait (int)
amount (int)

```

Removes a particular trait (trait) of a given type (trait\_type) from a particular critter (who). (See critter\_add\_trait.)

**critter\_set\_flee\_state** int Critter

```
who (ObjectPtr)
flee_on (Boolean)

```

Sets the FLEE flag on or off. This controls whether the critter flees during combat.

**critter\_skill\_level** int Critter  *[Fallout 2 only]*

```
who (ObjectPtr)
skillNum (int)

```

Returns the current skill level of a particular object’s (who) skill (skillNum).

**critter\_state** int Critter

```
who (ObjectPtr)

```

Returns the state of a given critter object (from combat data), used to determine if a critter is dead, unconscious, etc.

**critter\_stop\_attacking** int Critter

```
who (ObjectPtr)

```

Flags the critter object (who) as no longer wishing to be active in combat.

**cur\_map\_index** int Map

Returns the index # of the current map, to be matched with the define-constant in Maps.h.

**cur\_town** int Map

Returns the index # of the current town, to be matched with the define-constant in Maps.h.

**days\_since\_visited** int Map

Returns the number of days since this map was last visited, or (-1) if it has never been visited before.

#### D

**debug\_msg** void Debug

```
text (string)

```

Prints a string to the debug monitor. Should be used exclusively for debug information, instead of display\_msg()! *The user will never see these messages unless they have debugging enabled and activated.* If they have debugging enabled and DEBUGLOG set, the messages will only show up in debug.log file.

**destroy\_object** int Object

```
obj (ObjectPtr)

```

Destroys an object (obj), which will call its script in the destroy\_proc section if the object is \*NOT\* the calling object.

**destroy\_mult\_objs** int Object

```
item (ObjectPtr)
count (int)

```

Destroys count number of instances of an item object. This function will figure out which inventory this item is in (if it isn’t on the ground). If it is on the ground, of course, there is only one instance of this object, so only one will be destroyed.

**dialogue\_reaction** void Dialog

```
mood (int)

```

Set up a reaction animation in the dialogue system.

**dialogue\_system\_enter** void Dialog

Tells the dialog system that this object is requesting the talk system. This is used when the script wants to start dialog instead of waiting for the player to initiate it. The script will be called back in its talk\_proc section.

**difficulty\_level** int

Returns the current Game difficulty level of the game (defined in the options screen).

**display\_msg** void

```
message (string)

```

Displays a string on the in-game PDA display (lower-left hand corner).

**do\_check** int (roll\_result) Skill

```
who (ObjectPtr)
check (int)
modifier (int)

```

Do a check/test-roll versus one of the various basic traits (strength, perception, etc.). Note: these cannot generate Critical Success or Critical Failure as they are a basic X==Y check.

**drop\_obj** void Inven

```
obj (ObjectPtr)

```

Causes the critter self-object to remove a given object (obj) from it’s inventory and place it on the ground at its hex. This animates the self\_obj.

**drug\_influence** int Critter

```
who (ObjectPtr)

```

Returns True if a given critter object (who) is currently under any drug influences, False otherwise. dude\_obj (ObjectOtr) Returns a pointer to the dude object (the player).

#### E

**elevation**  int Map

```
obj (ObjectPtr)

```

Returns the current elevation being displayed.

**end\_dialogue** void Dialog

Terminates the dialogue system. endgame\_movie void Meta Plays the endgame movie.

**endgame\_slideshow** void Meta

Plays the endgame slideshow. The slideshow will fade in to its palette, so it is proper to call gfade\_out(1) and then expect this command to fix the palette for you.

**explosion** int Anim

```
where (int)
elevation (0-2)
damage (int)

```

Sets up an explosion at a given tile number (where) on a given elevation, that will cause damage in a radius.

#### F

**fixed\_param** int

Returns the value of the script's fixed parameter. This is used with `add_timer_event`, for instance, to pass the info parameter back to the script.

**float\_msg** void

```
who (ObjectPtr)
msg (str)
type (int)

```

Attempts to create a floating-text message (str) attached to an object (who) using colors dictated by type. There are two special types, WARNING and SEQUENTIAL. WARNING is used to print a message centered on the screen (such as for end-of-quest notifications), and SEQUENTIAL will cycle through the colors, in an attempt to give critters different-colored messages to differentiate them.

#### G

**game\_ticks** int Time

```
seconds (int)

```

Returns the number of game ticks equal to a given # of seconds.

**game\_time** int Time

Returns the current game time in ticks.

**game\_time\_advance** void Time

```
amount (int)

```

Advances the current game time by (amount) ticks.

**game\_time\_hour** int Time

Returns the current hour of the day in a normal format, but without the colon. For example, the current starting game time is 721 (which is 7:21 am).

**game\_ui\_disable** void Meta

Disables game user-interface input from the player (to ‘lock-out’ the player). You \*MUST\* make sure to re-enable the UI at some point afterwards.

**game\_ui\_enable** void Meta

Re-enables game user-interface input from the player. This \*MUST\* be called relatively soon after disabling the UI or the player will be stuck, unable to do anything.

**game\_ui\_is\_disabled** int Meta

Returns True if the game UI is currently disabled (the player is currently ‘locked-out’), and False otherwise.

**gdialog\_barter** int Dialog

Tells the dialog system to switch to the barter screen. (Sets the barter modifier to 0).

**get\_critter\_stat** int Critter

```
who (ObjectPtr)
stat (int)

```

Returns the value of a desired attribute/stat in a critter object (who).

**get\_day** int Time

Returns the current day of the month.

**gdialog\_mod\_barter** int Dialog

```
modifier (+/- percent)

```

Tells the dialog system to switch to the barter screen, using a given modifier.

**get\_month** int Time

Returns the current month of the year.

**get\_pc\_stat** int Critter

```
pcStat (int)

```

Returns the value of a desired pc-only stat of the obj\_dude. These are found in define.h all starting with “PCSTAT\_”.

**get\_poison**

```
Critter
who (ObjectPtr)

```

Returns the value of a given critters’ (who) poison level. *NOTE: In Fallout 1 this gives an error message. Instead use:*

```
get_critter_stat(dude_obj, 36)

```

**gdialog\_set\_barter\_mod** void Dialog

```
mod (int)

```

Sets the current modifier for barter to a given percentage (mod). Used to make barter easier/harder, even if the player initiates barter (as opposed to the script starting it.)

**gfade\_in** void Meta

```
time (int)

```

Does a palette fade to black. The Time parameter is currently not actually used.

**gfade\_out**  void Meta

```
time (int)

```

Does a palette fade from black to the game palette. The Time parameter is currently not actually used.

**giQ\_Option**  void Dialog

```
iq_test (int)
msg_list (int)
msg_num (int)
target (procedure)
reaction (int)

```

Sets up an option-choice for a reply block if the player’s IQ statistic is equal to or greater than a given value (iq\_test), getting the string from the message file (msg\_list) and message number (msg\_num), which will cause a given reaction (reaction), and if chosen will jump to the given (target) procedure.

**give\_exp\_points**  void

```
points (int)

```

Adds experience points (points) to the player’s total. These points may then be used by the player to enhance skills, etc.

**global\_var** int Map

```
var_index (unsigned int)

```

Returns the value of a global variable # (var\_index).

**goto\_xy**

```
Map

```

(Moves the character to the specific map?) Sduibek (talk) 18:03, August 4, 2012 (UTC)

**gSay\_End** void Dialog

```
var_index (unsigned int)

```

Ends a dialog sequence, which will bring up the sequence (actually display it).

**gSay\_Message** void Dialog

```
msg_list (int)
msg_num (int)
reaction (int)

```

Sets up a sayMessage, which is a reply with just a [Done] option. The msg\_list determines which message file to look in, and the msg\_num determines which line to use from the file.

**gSay\_Option**  void Dialog

```
msg_list (int)
msg_num (int)
target (procedure)
reaction (int)

```

Sets up an option-choice for a reply block, getting the string from the message file (msg\_list) and message number (msg\_num), which will cause a given reaction (reaction), and if chosen will jump to the given (target) procedure.

**gSay\_Reply** void Dialog

```
msg_list (int)
msg_num (int)

```

Sets up a reply block (what the \*CRITTER\* says). gSay\_Start void Dialog Starts a new dialog sequence.

#### H

**has\_skill** int Skill

```
who (ObjectPtr)
skill (int)  [0 to 17]

```

This returns the level of the skill of the target critter. (0 to 200 for Fallout 1), (0 to 300 for Fallout 2)

**has\_trait** int Critter

```
trait_type (int)
who (ObjectPtr)
trait (int)

```

Returns the value of a given critter object’s (who) trait of a given Trait\_type (see define.h). This can be used to determine if the player has a particular Perk, AI Packet, team num, current rotation, or Trait (finesse, bruiser, etc.).

**how\_much** int Skill

```
val (int)

```

Returns the value of a completed skill vs. skill contest (how much the rolls differed by). This requires that you first call one of the contest roll commands, such as roll\_vs\_skill, skill\_contest, etc...

#### I

**inven\_count** int Critter

```
what (ObjectPtr)

```

Returns the count of how many inventory slots are filled on a given object (what).

**inven\_ptr**  (ObjectPtr) Critter

```
what (ObjectPtr)
slotNum (int)

```

Returns a pointer to the object in slot # (slotNum) in a given object (what).

**inven\_unwield** void

Critter Attempts to cause a critter to unwield any wielded weapons/items. If animations are currently disabled, it will just instantly change the art.

**is\_critical**  int Skill

```
val (int)

```

Returns True if a given contest roll result is a critical result, otherwise False.

**is\_loading\_game** boolean Map

Returns True if the game is currently loading, False otherwise. This is used so that bad things don’t happen on game load because a script is doing map\_enter setup stuff.

**is\_skill\_tagged** int Skill  ***(Fallout 2 only!)***

```
skillNum (int)

```

Returns True if a given skill is tagged.

**is\_success** int Skill

```
val (int)

```

Returns True if a given contest roll result value is a success, otherwise False. Can generate Critical Success or Critical Failure as well.

**item\_caps\_adjust** int Inven

```
obj (ObjectPtr)
amount (int)

```

Modifies the current caps count in an object (obj) by a given amount (amount). Can be positive or negative.

**item\_caps\_total** int Inven

```
obj (ObjectPtr)

```

Returns the current caps total in a given object’s (obj) inventory.

#### J

**jam\_lock** int Object

```
lockableObj (ObjectPtr)

```

Jams a lock, which prevents the player from picking the lock for approximately 24 hours. Meant to be used when a player critically fails to pick a lock.

#### K

**kill\_critter** void

```
obj (ObjectPtr)
death_frame (int)

```

Kills a critter (obj) outright, placing it in the chosen death frame. Note: this does NOT animate the critter, and does NOT refresh the screen! It is meant to be used in scripts run when entering/exiting a map (map\_init/map\_exit).

**kill\_critter\_type** void Map

```
pid (int)

```

Kills all critters of a given type (pid) outright. See kill\_critter above. **NOTE: This can result in the "frozen bodies" issue! kill\_critter should always be used instead if possible, for this reason.** Frozen bodies causes no actual gameplay issues, but it looks unrealistic and ridiculous.

#### L

**language\_filter\_is\_on** int (boolean) Meta Returns True if the language filter is currently filtering harsh language, False otherwise.

**load\_map** void Map

```
map_name (string or int)
start_location (int)

```

Loads a new map (map\_name), removing all scripts currently running and passing on the entrance location (start\_location) to the new map’s map\_init script. Can also use the number representing the map in the map list (for example, between 0 to 64 in Fallout 1)

**local\_var** int Map

```
var_index (unsigned int)

```

Returns the value of a local variable of given index # (var\_index). If the user is not allowed local vars up to this number in the list of critters, this can generate errors. (see debug.log)

**map\_first\_run** int Map Returns True if the current map is being run for the first time (in other words, this map was not loaded from a save-game).

#### M

**map\_is\_known** int Meta

```
mapNum (int)

```

Returns True if a given map index (mapNum) is known, False otherwise.

**map\_known** int Meta

```
mapNum (int)

```

Returns True if a given map # (mapNum) is known, False otherwise.

**map\_var** int Map

```
var_index (unsigned int)

```

Returns the value of a map-global variable of a given index # (var\_index).

**message\_str**  char \*

```
list (int)
msg_num (int)

```

Returns a string from the message module for a given list and a given # (msg\_num).

**move\_to** int Map

```
obj (ObjectPtr)
tile_num (int)
elev (0-2)

```

Immediately moves an object (obj) to the given tile number and elevation on the current map.

**move\_obj\_inven\_to\_obj** int Inven

```
srcObj (ObjectPtr)
destObj (ObjectPtr)

```

Moves an object’s (srcObj) entire inventory into another object’s (destObj) inventory.

#### O

**obj\_art\_fid** (ObjectPtr) Object

```
obj (ObjectPtr)

```

Returns the fid # (used to index art) of a given object (obj). obj\_being\_used\_with (ObjectPtr) Object Returns a pointer to the object being used on another object.

**obj\_can\_hear\_obj** boolean Map

```
src_obj (ObjectPtr)
dst_obj (ObjectPtr)

```

Returns True if the source object (src\_obj) is capable of hearing the destination object (dst\_obj). This includes distance factors, current activity (standing/walking/running), and skill use (stealth/etc.).

**obj\_can\_see\_obj** boolean Map

```
src_obj (ObjectPtr)
dst_obj (ObjectPtr)

```

Returns True if the source object (src\_obj) has line-of-sight (LOS) with the destination object (dst\_obj). This also takes into account perception & stealth rolls of the objects are critters.

**obj\_carrying\_pid\_obj** (ObjectPtr) Object

```
who (ObjectPtr)
pid (int)

```

Returns an Object pointer to an instance of an object of type pid if an object (who) is carrying an object of that type.

**obj\_close** void Object

```
what (ObjectPtr)

```

Attempts to close a given object (what) if it is of an openable type.

**obj\_drop\_everything**  void Inven

```
who (ObjectPtr)

```

Causes a critter object (who) to drop all objects in it’s inventory and drop it on the ground at its feet.

**obj\_is\_carrying\_obj\_pid**  boolean Object

```
obj (ObjectPtr)
pid (int)

```

Returns the quantity of objects with matching prototype index #’s (pid) carried in the inventory of another object (obj).

**obj\_is\_locked** int Object

```
what (ObjectPtr)

```

Returns True if a given object (what) is a locked object, False if it is unlocked or not a lockable object.

**obj\_is\_visible\_flag** int Object   ***[Fallout 2 only!]***

```
who (ObjectPtr)

```

Returns True if a given object (who) is turned on (visible), False otherwise.

**obj\_is\_open** int Object

```
what (ObjectPtr)

```

Returns True if a given object (what) is an open object, False if it is closed or not an openable object.

**obj\_item\_subtype** int Object

```
obj (ObjectPtr)

```

Returns the subtype of an object of type 'item'. Examples would be food, armor, weapons, etc.

**obj\_lock** void Object

```
what (ObjectPtr)

```

Attempts to lock a given object (what) if it is of a lockable type.

**obj\_name** void Object

```
what (ObjectPtr)

```

Returns a string representing the name of the given object (what).

**obj\_on\_screen** int Object

```
what (ObjectPtr)

```

Returns True if a given object (what) is currently being drawn on-screen, False if it is not.

**obj\_open** void Object

```
what (ObjectPtr)

```

Attempts to open a given object (what) if it is of an openable type.

**obj\_pid** int Object

```
obj (ObjectPtr)

```

Returns the prototype id # (pid) of an object (obj).

**obj\_set\_light\_level** void Object

```
obj (ObjectPtr)
intensity (1-100)
distance (0 - 8)

```

Set the light level for an object to a given intensity (percentage of possible maximum intensity), and distance of light in hexes.

**obj\_type** int Object

```
obj (ObjectPtr)

```

Returns the type of an object (obj). This would be ‘Item’, ‘Wall’, ‘Scenery’, etc.

**obj\_unlock**  void Object

```
what (ObjectPtr)

```

Attempts to unlock a given object (what) if it is of a lockable type.

**override\_map\_start** void Map

```
x (int)
y (int)
elev (0-2)
rot (0-5)

```

Used when loading a new map, this forces the player (obj\_dude) to start at a particular location and rotation when first coming up.

[***How do we know where the X and Y coordinates are?*** Sduibek (talk) 18:03, August 4, 2012 (UTC)]

#### P

**party\_add** void Party

```
who (ObjectPtr)

```

Adds a given critter (who) into the list of party members. This will also setup those objects so that they will not be saved in maps, and certain other things.

**party\_member\_obj** ObjectPtr Party

```
pid (int)

```

Returns an ObjectPtr to a party member that matches a given pid. If that critter isn’t currently a member of the party, then it will return NULL.

**party\_member\_count**  ObjectPtr Party

```
countHidden (int)

```

Returns the count of the currently in-party party members. (countHidden) determines whether or not to count the hidden members (hangers-on).

**party\_remove** void Party

```
who (ObjectPtr)

```

Removes a given critter (who) from the list of party members. This will also change those objects so that certain object- and map-level things will respond differently to them.

**pickup\_obj** void Inven

```
obj (ObjectPtr)

```

Causes the critter self-object to animate and attempt to pick up a given object (obj).  *If used in regard to a critter, this flag is pinged when a steal detect fails.* In other words when detected stealing, pickup\_obj is called for the person you were stealing from.

**play\_gmovie**

```
Meta

```

Plays one of the Fallout movies (full-screen, compressed, etc.).

**play\_sfx**

```
Sound

```

Starts a new sound effect to be played on the queue.

**poison** Critter

```
who (ObjectPtr)
amount (int)

```

Modifies the critter's poison level by a given amount. ***Positive numbers increase their level of poisoning, negative numbers decrease it.*** Thus, by using

```
poison(Critter, get_critter_stat(Critter, 36))

```

you can remove all poisoning of the critter.

**proto\_data** int OR string Object

```
pid (int)
data_member (int)

```

Returns the value of a data-member of a given prototype (pid).

.

#### R

**radiation\_dec**

```
Critter
who (ObjectPtr)
amount (int)

```

Decrements a critter’s radiation counter by a given amount. NOTE: This should only be done to the player (obj\_dude) in Fallout due to design restrictions!

**radiation\_inc**

```
Critter
who (ObjectPtr)
amount (int)

```

Increments a critter’s radiation counter by a given amount. NOTE: This should only be done to the player (obj\_dude) in Fallout due to design restrictions!

**random**  int Script

```
min (int)
max (int)

```

Returns a random value between (min) and (max), inclusive.

**reg\_anim\_animate** void Anim

```
what (ObjectPtr)
anim (int)
delay (int)

```

Adds a single, in-place animation on an object (what) to an animation sequence-list, at a given delay from the previous animation (delay should always be -1)!

**reg\_anim\_animate\_forever**  void Anim

```
what (ObjectPtr)
anim (int)
delay (int)

```

Adds a single, in-place animation on an object (what) to an animation sequence-list, at a given delay from the previous animation (delay should always be -1)! This animation will animate continuously until something in the system interrupts it. To be used \*very\* sparingly, for instance Gizmo’s sign and the ‘pray’ signs in the children of the cathedral (which will have to be toned down).

**reg\_anim\_animate\_reverse** void Anim

```
what (ObjectPtr)
anim (int)
delay (int)

```

Adds a single, in-place reversed animation on an object (what) to an animation sequence-list, at a given delay from the previous animation (delay should always be -1)! reg\_anim\_begin void Anim Tells the system to start an animation sequence-list.

**reg\_anim\_clear** void Anim

```
object (ObjectPtr)

```

Terminates all animations that are currently registered for a given object. reg\_anim\_end void Anim Activates the animation sequence-list. Without this call the animation will never occur. Note: All animation sequences must be registered at ONCE! In other words, you cannot let the script end and finish registering the animations later.

**reg\_anim\_obj\_move\_to\_obj**  void Anim

```
who (ObjectPtr)
dest_obj (ObjectPtr)
delay (int)

```

Adds an animation to cause a critter object (who) to attempt to walk to another object (dest\_obj) at a given delay from the previous animation (delay should always be -1)!

**reg\_anim\_obj\_run\_to\_obj**  void Anim

```
who (ObjectPtr)
dest_obj (ObjectPtr)
delay (int)

```

Adds an animation to cause a critter object (who) to attempt to run to another object (dest\_obj) at a given delay from the previous animation (delay should always be -1)!

**reg\_anim\_obj\_move\_to\_tile** void Anim

```
who (ObjectPtr)
dest_tile (int)
delay (int)

```

Adds an animation to cause a critter object (who) to attempt to walk to a given destination tile number (dest\_tile) at a given delay from the previous animation (delay should always be -1)!

**reg\_anim\_obj\_run\_to\_tile** void Anim

```
who (ObjectPtr)
dest_tile (int)
delay (int)

```

Adds an animation to cause a critter object (who) to attempt to run to a given destination tile number (dest\_tile) at a given delay from the previous animation (delay should always be -1)!

**reg\_anim\_play\_sfx**  void Anim

```
who (ObjectPtr)
sfx_name (string)
delay (int)

```

Adds an animation to cause an object (who) to attempt to play a given sound effect (sfx\_name) at a given delay from the previous animation!

**rm\_fixed\_timer\_event**  void Meta(Time)

```
who (ObjectPtr)
fixed_val (int)

```

Removes (clears) all timer events hooked to a given object’s (obj) script that have a given fixed\_value (fixed\_val).

**rm\_obj\_from\_inven** void Inven

```
who (ObjectPtr)
obj (ObjectPtr)

```

Removes an object (obj) from another object’s (who’s) inventory. Note: this leaves the removed object in at location (0,1) on the map! You must call move\_to(…) to place it back on the map.

**rm\_mult\_objs\_from\_inven** int Inven

```
who (ObjectPtr)
obj (ObjectPtr)
count (int)

```

Removes (count) instances of an object (obj) from another object’s (who’s) inventory. Note: this leaves the removed object in at location (0,1) on the map! You must call move\_to(…) to place it back on the map. NOTE: This function returns the actual count that was removed (if you attempted to remove more instances than existed). You \*MUST\* store this value in a variable (though you don’t have to actually do anything with it).

**rm\_timer\_event**  void Meta(Time)

```
obj (ObjectPtr)

```

Removes (clears) all timer events hooked to a given object’s (obj) script.

**roll\_dice** Critter skill

```
Critter (obj)
Skill (int)

```

Returns the value of the completed dice roll. NOTE: Avellone says this is unimplemented

**roll\_vs\_skill** int (roll\_result) Skill

```
who (ObjectPtr)
skill (int)
modifier (int)

```

Returns the value of a completed skill roll made upon an object’s (who’s) skill level with a given skill, and modified by a given amount (may be zero). This value may then be passed to is\_success and is\_critical to determine the appropriate states, and the how\_much call can be used to determine the difference succeeded or failed by.

**rotation\_to\_tile** int (1…5) Map

```
srcTile (int)
destTile (int)

```

Returns the rotation (0…5) to face a particular tile (destTile) from a particular tile (srcTile).

**running\_burning\_guy** int

Returns the setting for the running-burning-guy in the game (defined in the options screen).

#### S

**scr\_return** void Script

Sets the return value for a scripts C-engine node, to be used by C code.

**script\_action** int

Script Returns the action that has activated this script. Examples include requests for the description of an object (description\_proc), notifications of a spatial script being activated by something hitting its boundary (spatial\_proc), or a critter being given its heartbeat (critter\_proc, in other words being told to move).

**script\_overrides** void Script

Tells the C-engine that the script will override default behavior for the object. What this means is that the C-engine will not attempt to do things that it would normally do, in expectation that the script will handle those things itself. This is an IMPORTANT command! It is commonly used for the general player actions upon objects, such as looking at them (requesting a description), using them (opening doors, for example), or using items ON them (using a picklock or a key on a door lock).

**self\_obj** (ObjectPtr) Script

Returns a pointer to the object connected to this script.

**set\_critter\_stat**  int Critter

```
who (ObjectPtr)
stat (int)
val (int)

```

Sets the value of a desired attribute/stat in a critter (who) to a given value (val).

**set\_exit\_grids** void Map

```
markElev (elevation)
mapID (int)
elevation (int)
tileNum (int)
rotation (int)

```

Sets all exit grids on a given elevation (markElev) to point to a destination mapID (may be -1 which means stay on this map), elevation, tileNum, and rotation.

**set\_global\_var** void

```
var_index (unsigned int)
value (int)

```

Sets the value of a global variable (var\_index) to a given (value).

**set\_light\_level**  void Map

```
level (int: 1-100)

```

Sets the ambient light level. The range is Full Darkness to Full Daylight.

**Caution:** Full darkness is not black screen! set\_light\_level(0) actually corresponds to 25% brightness, and has 2 huge jumps in the middle. Certain brightness levels simply cannot be set. Refer to light levels page for disambiguation.

**set\_local\_var** void Map

```
var_index (unsigned int)
value (int)

```

Sets the value of a local variable (var\_index) to a given (value).

**set\_map\_var** void Map

```
var_index (unsigned int)
value (int)

```

Sets the value of a map-global variable (var\_index) to a given (value).

**set\_map\_start** void Map

```
x (int)
y (int)
elev (0-2)
rot (0-5)

```

Sets the start location & rotation for the next time this map is entered (loaded & run).

**set\_obj\_visibility** void Object

```
obj (ObjectPtr)
visibility (boolean)

```

Sets the OBJ\_OFF flag for an object (makes it not drawn).

**signal\_end\_game** void

Tells the system that a script is indicating the game should be ended. This will return the player to the main-menu.

**SignalNamed** void

```
event (string)

```

Calls events and/or handler for given name (event). See AddNamedEvent and AddNamedHandler to add handlers. This basically just calls the appropriate procedures.

**skill\_contest** [NOTE: UNIMPLEMENTED in *Fallout 1*]

```
Skill

```

Returns the value of a completed skill vs skill contest (to run through is\_success & is\_critical).

**source\_obj** (ObjectPtr) Script

Returns a pointer to the source object (activator) for this action. The source object for a pickup\_proc (pickup an object script\_action) would be the critter picking the object up, for instance.

**start\_dialogue** void Dialog

```
who (ObjectPtr)
mood (int)

```

Start the dialogue system focusing on a critter (who) and starting in a given (mood). This call sets up the appropriate dialog windows, head art, etc. If this call is not made before the normal dialog calls (sayReply, sayMessage, sayOption, etc.) then the dialog windows will not come up, and only grey boxes will appear with the text.

**start\_gialog**  void Dialog

```
msgFileNum (int)
who (ObjectPtr)
mood (int)
headNum (int)
backgroundIdx (int)

```

Start the dialogue system focusing on a critter (who) and starting in a given (mood). This call sets up the appropriate dialog windows, head art, etc. If this call is not made before the normal dialog calls (sayReply, sayMessage, sayOption, etc.) then the dialog windows will not come up, and only grey boxes will appear with the text.

#### T

**target\_obj** (ObjectPtr) Script

Returns a pointer to the target object for this action. The target object is what is being acted upon. terminate\_combat void Combat Tells the combat system to terminate prematurely. USE WITH CAUTION. This doesn’t prevent another (or even the SAME) script from re-starting combat, so make sure you turn off any hostile flags, etc.

**tile\_contains\_obj\_pid**  boolean Map

```
tile (int)
elev (0-2)
pid (int)

```

Returns True if a particular tile contains an object with a matching prototype index # (obj pid).

**tile\_contains\_pid\_obj** boolean Map

```
tile (int)
elev (0-2)
pid (int)

```

Returns a pointer to the first object that matches a particular pid # that is on a particular tile and elevation.

**tile\_distance** int Map

```
tile1 (int)
tile2 (int)

```

Returns the tile distance between two tile #'s.

**tile\_distance\_objs** int Map

```
obj1 (ObjectPtr)
obj2 (ObjectPtr)

```

Returns the tile distance between two objects (between their tile #’s).

**tile\_is\_visible** boolean Map

```
tile (int)

```

Returns True if a given hex (tile) is currently visible, i.e. an object on it could conceivably be displayed on-screen. This includes hexes that may technically have bases that are off-screen, but on whom objects could exist that would bound into the actual display area.

**tile\_num** int Map

```
obj (ObjectPtr)

```

Returns the tile number of object (obj).

**tile\_num\_in\_direction** int Map

```
start_tile (int)
dir (0-5)
distance (int)

```

Returns the tile number of a tile offset from a starting tile in a given direction (the next tile in that direction).

**town\_known** int Meta

```
townArea (int)

```

Returns True if a given town area (townArea) is known, False otherwise.

**town\_map** void Sends a request for the game engine to bring up the Town Map screen, for the player to go to different locations in an area (different areas in Vault13, for example).

This function is only available in FO1 (ref)

#### U

**use\_obj**  (ObjectPtr) Script

```
obj (ObjectPtr)

```

**use\_obj\_on\_obj** (ObjectPtr) Script

```
item (ObjectPtr)
targetObj (ObjectPtr)

```

Attempt to use an item object on a target object (targetObj). This could be used to have a critter use a Stimpack on the player, for instance, or to use a key on a door.

**using\_skill**  boolean Skill

```
who (ObjectPtr)
skill (int)

```

Returns True if an active skill is being used, False otherwise. Examples of active skills are Stealth and First Aid.

#### V

**violence\_level\_setting** int (boolean) Meta  ***[*Fallout 2 *only!]***

Returns the current setting of the violence level. See define.h for values.

#### W

**wield\_obj** void Inven

```
obj (ObjectPtr)

```

Sets up an animation causing a critter (self\_obj) to wield an object (obj) in that critters’ inventory. This puts that object in the critter’s hand.

**wield\_obj\_critter**  void Inven

```
who (ObjectPtr)
obj (ObjectPtr)

```

Sets up an animation causing a critter (who) to wield an object (obj) in that critters’ inventory. This puts that object in the critter’s hand.

The documentation is incomplete here. Wielding an armor actually wears it, although wielding it to the obj\_dude is a bit bugged in that it only changes the obj\_dude's stats and doesn't update the displayed model until the PC opens the inventory and closes it. Velizar 12:06, July 19, 2019 (UTC)

**wm\_area\_set\_pos** void

```
areaIdx (int)
xPos (int)
yPos (int)

```

Sets the World Map coordinates for a given area/town (areaIdx) to a given x and y position.

**world\_map**  void

Sends a request for the game engine to bring up the World Map screen, for the player to move around to different locations.

**world\_map\_x\_pos** int

Returns the current X Position of the party on the World Map.

**world\_map\_y\_pos** int

Returns the current Y Position of the party on the World Map.

.

## Script Functions Reference

.

**proto\_data(obj\_pid(dude\_obj), 1)**

This is a string containing the player's name.

### *Fallout 1*

#### procedure critter\_p\_proc (script\_action == 12)

* *NOTE*: Can also appear as "Critter\_Action"
* EXPLANATION/FUNCTION: Do they see you, should they wander, should they attack you, etc. This is "pinged" constantly (10 times a second I believe), so you should use it for things that need to be checked on a continous basis.

* *Is not called or run during combat.*
* **For some critters, it ONLY works if you name as Critter\_Action, and will be ignored if you put your code in critter\_p\_proc. It's not known why this is the case.**

[need to check if it also isn't checked during combat for Dude\_obj] Sduibek (talk) 21:17, August 6, 2012 (UTC)

#### procedure combat\_p\_proc (script\_action == 13)

* EXPLANATION/FUNCTION: In other words, does COMBAT\_IS\_INITIALIZED global flag == 1 (true)?

subset-- (fixed\_param == 4) end of round
subset-- (fixed\_param == 2) attack connects (e.g. used by Radscorpions for poisoning obj\_dude)

#### procedure damage\_p\_proc (script\_action == 14)

* EXPLANATION/FUNCTION: has this Critter or Object been shot, hit with TNT, punched, etc.
* EXAMPLE:

```
procedure damage_p_proc
begin
/*
   When critter takes damage, and damage came from player or player's buddy,
   AND the critter can SEE who hurt them, attack whomever hurt them.
   Also check to make sure combat isn't already taking place, to avoid crashes:
*/
	variable LVar7 := 0;    // Temporary variable, name doesn't matter
	LVar7 := source_obj;    // Who or what is "creating" the damage?

// Damage came from player, or party member (e.g. Ian)
	if ((LVar7 == dude_obj) or party_member_obj(LVar7))

// Is source of damage seen by recipient of damage?
             and obj_can_see_obj(self_obj, LVar7)

// Make sure combat isn't already running
             and not(combat_is_initialized)
        then begin
		attack_complex(LVar7, 0, 1, 0, 0, 30000, 0, 0);  //Attack source
	end
end
Sduibek (talk) 21:17, August 6, 2012 (UTC)

```

#### critter\_injure(dude\_obj, 1);

* This is seen in a number of scripts. As far as I can tell, it does nothing. Sduibek (talk) 21:17, August 6, 2012 (UTC)

#### pc\_stat(1)

Integer that hold's the player's current experience level. So running "get\_pc\_stat(1)" checks and returns the number of the player's current level.

#### get\_critter\_stat(dude\_obj, #) :

0 Strength
1 Perception
2 Endurance
3 Charisma
4 Intelligence
5 Agility
6 Luck

.

## Getting Started!

### Fallout 1

While there has not been as much focus on Fallout 1 scripting in the modding community than Fallout 2 (except by TeamX perhaps) the good news is that scripting in Fallout 1 is easier, from getting set up, to editing, to compiling! Ironically the hurdles you have to overcome to get going on Fallout 1 scripting are much, much smaller than those for Fallout 2. The scripting itself is more messy however because direct references have to be used instead of words sometimes [for example, float\_msg("hi", 2) instead of float\_msg("hi", TEXT\_COLOR\_RED)].

*(If you are familiar with the C programming language, this is because Fallout 1 scripting doesn't support #define commands, so all commands are used directly.)*

**Unlike Fallout 2, Fallout does *not* require any of the following to get going on scripting:**

* **Deleting files**
* **Messing with Mapper2**
* **Running weird batch files (unless you make one yourself; see below)**
* **Environmental Variables**
* **Watcom**

{C}All you need to do is extract the INT (encoded script) files from your master.dat, convert them to SSL (i.e. decompile them) and begin editing in your favorite text editor. So what you need is:

* master.dat from Fallout 1
* f1undat (or other Fallout1-compatible .DAT-file extractor/explorer)
* int2ssl
* Decompiled script (INT) files
* Text editor
* sslc\_f1 (to compile your edited SSL scripts back to INT format for usage in Fallout; see below)

{C}The files you need are in master.dat/DATA/SCRIPTS and are {scriptname}**.int** files

Easy, right? Yep.

1. First, extract them using F1UNDAT -- download here Then put f1undat into your Fallout folder and run this command: f1undat -es master.dat int

1. You will see output something like this, for about 950 files (ZAX.INT should be the last one)File:Fo1scripting.png
2. Next, you need to decompile these so they're readable and editable. download int2ssl hereand unzip it to whatever directory you just extracted the INT files into.
3. I've made a batch file to decompile these files for you. Download hereand run it in the folder containing your .int files and int2ssl.exe. Note: this conversion process may take several minutes. Go grab a coffee or something while you wait.
4. Edit them in your favorite text editor :)
5. To recompile the scripts (so that Fallout 1 can use them) you need to run sslc\_f1 on each script. I also have a batch file for this, download here
6. Run the tool from #6 whenever you're done working on your scripts and want them all moved into the Fallout folder.

**\*\*\*NOTE: That batch files assumes Fallout is installed in C:\Games\Fallout and also will automatically overwrite all .INT (script) files in the path C:\Games\Fallou\DATA\SCRIPTS -- Furthermore, it will delete all .INT and .BAK files in the directory it's run in. *You have been warned! I'm not responsible for data loss. Sduibek (talk) 20:45, August 6, 2012 (UTC)***

### *Fallout 2*

(stuff here later)

.

## See also (tutorials, etc.)

Commands, macros, procedures, variables, operators and headers

How to decompile a script

Dialogue scripting

Scripting - Now that you've started...

Fallout scripting language (de dood)

FSE tool – advanced options, script editing

## External Links

### Fallout 1

Fallout 1 - Reference tables for scripts, stats, critters.

### Fallout 2

Scripting and dialogues -- Fallout 2 Survivor mod forums