base-decl
Fallout 2 engine builtins (external - not bundled into output)
Functions
Section titled “Functions”obj_item_subtype
Section titled “obj_item_subtype”function obj_item_subtype(obj: ItemPtr): number
Returns the subtype of an item object (weapon, armor, etc.)
obj_type
Section titled “obj_type”function obj_type(obj: ObjectPtr): ObjType
Returns the type of an object (Item, Wall, Scenery, Critter, etc.)
obj_pid
Section titled “obj_pid”function obj_pid(obj: ObjectPtr): number
Returns the prototype id # (pid) of an object
obj_name
Section titled “obj_name”function obj_name(obj: ObjectPtr): string
Returns the name of an object
elevation
Section titled “elevation”function elevation(obj: ObjectPtr): 0 | 1 | 2
Returns the object’s elevation (0-2)
tile_num
Section titled “tile_num”function tile_num(obj: ObjectPtr): number
Returns the tile number of an object
obj_art_fid
Section titled “obj_art_fid”function obj_art_fid(obj: ObjectPtr): number
Returns the fid # (art index) of an object
obj_on_screen
Section titled “obj_on_screen”function obj_on_screen(obj: ObjectPtr): boolean
Returns true if the object is currently visible on-screen
obj_is_locked
Section titled “obj_is_locked”function obj_is_locked(obj: DoorPtr | ContainerPtr): boolean
Returns true if the object is locked
obj_is_open
Section titled “obj_is_open”function obj_is_open(obj: DoorPtr | ContainerPtr): boolean
Returns true if the object is open
obj_lock
Section titled “obj_lock”function obj_lock(obj: DoorPtr | ContainerPtr): void
Lock an object
obj_unlock
Section titled “obj_unlock”function obj_unlock(obj: DoorPtr | ContainerPtr): void
Unlock an object
obj_open
Section titled “obj_open”function obj_open(obj: DoorPtr | ContainerPtr): void
Open an object
obj_close
Section titled “obj_close”function obj_close(obj: DoorPtr | ContainerPtr): void
Close an object
set_obj_visibility
Section titled “set_obj_visibility”function set_obj_visibility(obj: ObjectPtr, invisible: boolean): void
Sets the OBJ_OFF flag for an object (makes it not drawn).
Note: visibility arg is inverted - set_obj_visibility(who, true) makes object invisible.
Does not work when loading game.
obj_set_light_level
Section titled “obj_set_light_level”function obj_set_light_level(obj: ObjectPtr, intensity: number, distance: number): void
Set the light level for an object to a given intensity (0-100, percentage of maximum) and distance of light in hexes (0-8).
create_object_sid
Section titled “create_object_sid”function create_object_sid(pid: number, tile: number, elev: Elevation, sid: number): ObjectPtr
Creates a new object of prototype (pid) at a given tile and elevation (0-2). If sid is not -1, it overrides the default script with the specified script #.
destroy_object
Section titled “destroy_object”function destroy_object(obj: ObjectPtr): number
Destroys an object, which will call its script in the destroy_proc section if the object is NOT the calling object.
destroy_mult_objs
Section titled “destroy_mult_objs”function destroy_mult_objs(item: ItemPtr, count: number): number
Destroys count instances of an item object
move_to
Section titled “move_to”function move_to(obj: ObjectPtr, tile: number, elev: Elevation): number
Immediately moves object to the given tile number and elevation (0-2) on the current map.
Using this to change elevations during loading an in-combat save will lead to a crash.
If called in map_enter_p_proc, wrap in not_is_loading_game to avoid the crash.
critter_attempt_placement
Section titled “critter_attempt_placement”function critter_attempt_placement(who: CritterPtr, hex: number, elev: Elevation): number
Attempts to place a critter at a given destination hex & elevation (0-2). If it fails, it tries to find a nearby hex as near as possible to the start hex.
obj_can_see_obj
Section titled “obj_can_see_obj”function obj_can_see_obj(src: ObjectPtr, dst: ObjectPtr): boolean
Returns True if the source object has line-of-sight (LOS) with the destination object. This also takes into account perception & stealth rolls if the objects are critters.
obj_can_hear_obj
Section titled “obj_can_hear_obj”function obj_can_hear_obj(src: ObjectPtr, dst: ObjectPtr): boolean
Returns true if src_obj can hear dst_obj
critter_state
Section titled “critter_state”function critter_state(who: CritterPtr): CritterState
Returns the state of a critter (dead, unconscious, etc.)
critter_inven_obj
Section titled “critter_inven_obj”function critter_inven_obj(who: CritterPtr, slot: InvenSlot): ItemPtr
get_critter_stat
Section titled “get_critter_stat”function get_critter_stat(who: CritterPtr, stat: STAT): number
Returns a critter stat value
set_critter_stat
Section titled “set_critter_stat”function set_critter_stat(who: CritterPtr, stat: STAT, mod: number): number
DOES NOT SET THE STAT.
Modifies attribute stat in critter who by value mod.
critter_is_fleeing
Section titled “critter_is_fleeing”function critter_is_fleeing(who: CritterPtr): boolean
Returns true if the critter has its FLEE flag set
critter_set_flee_state
Section titled “critter_set_flee_state”function critter_set_flee_state(who: CritterPtr, flee: boolean): void
Sets the FLEE flag on or off
critter_stop_attacking
Section titled “critter_stop_attacking”function critter_stop_attacking(who: CritterPtr): number
Flags the critter as no longer wishing to be active in combat
critter_add_trait
Section titled “critter_add_trait”function critter_add_trait(who: CritterPtr, traitType: TraitType, trait: number, amount: number): number
Adds a particular trait of a given type to a critter. Possible traits under the SPECIAL system are limited to Perks, Traits, Object-instance information (such as team #‘s, ai-packet #‘s, etc.)
critter_rm_trait
Section titled “critter_rm_trait”function critter_rm_trait(who: CritterPtr, traitType: TraitType, trait: number, amount: number): number
Removes a trait from a critter
has_trait
Section titled “has_trait”function has_trait(traitType: TraitType, who: ObjectPtr, trait: number): number
Returns the value of a critter’s trait of a given trait_type (see define.h). Can be used to determine if the player has a particular Perk, AI Packet, team num, current rotation, or Trait (finesse, bruiser, etc.) Also works with TRAIT_OBJECT for any object.
critter_mod_skill
Section titled “critter_mod_skill”function critter_mod_skill(who: CritterPtr, skill: SKILL, amount: number): number
Modifies a given skill in a critter by a given amount. Note: Only works on dude_obj! Will not work on other critters. For tagged skills, the amount will be rounded down to the closest even number.
get_poison
Section titled “get_poison”function get_poison(who: CritterPtr): number
Returns the critter’s poison level
poison
Section titled “poison”function poison(who: CritterPtr, amount: number): void
Modifies the critter’s poison level by amount (can be negative)
radiation_inc
Section titled “radiation_inc”function radiation_inc(who: CritterPtr, amount: number): void
Increments a critter’s radiation counter
radiation_dec
Section titled “radiation_dec”function radiation_dec(who: CritterPtr, amount: number): void
Decrements a critter’s radiation counter
critter_dmg
Section titled “critter_dmg”function critter_dmg(who: CritterPtr, amount: number, flags: number): void
Inflicts damage on a critter (who) of a given amount, killing it if necessary.
Use DMG_* flags to customize behaviour.
critter_heal
Section titled “critter_heal”function critter_heal(who: CritterPtr, amount: number): void
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.
critter_injure
Section titled “critter_injure”function critter_injure(who: CritterPtr, how: number): number
Injures a critter by crippling given limbs/body parts (defined by DAM_CRIP_ARM_LEFT, DAM_BLIND, etc. in define.h).
kill_critter
Section titled “kill_critter”function kill_critter(who: CritterPtr, deathFrame: number): void
Kills a critter outright, placing it in the chosen death frame. Does NOT animate the critter and does NOT refresh the screen! Meant to be used in scripts run when entering/exiting a map (map_init/map_exit).
kill_critter_type
Section titled “kill_critter_type”function kill_critter_type(pid: number): void
Kills all critters of a given type (pid) outright. NOTE: This can result in the ‘frozen bodies’ issue! kill_critter should always be used instead if possible.
add_obj_to_inven
Section titled “add_obj_to_inven”function add_obj_to_inven(who: ObjectPtr, item: ItemPtr): void
Adds an object (item) to another object’s (who’s) inventory. Note that this only works with objects of type Item.
add_mult_objs_to_inven
Section titled “add_mult_objs_to_inven”function add_mult_objs_to_inven(who: ObjectPtr, item: ItemPtr, count: number): void
Adds count instances of an item to an object’s inventory
rm_obj_from_inven
Section titled “rm_obj_from_inven”function rm_obj_from_inven(who: ObjectPtr, item: ItemPtr): void
Removes an object from another object’s inventory. NOTE: this leaves the removed object at location (0,1) on the map! You must call move_to(…) to place it back on the map.
rm_mult_objs_from_inven
Section titled “rm_mult_objs_from_inven”function rm_mult_objs_from_inven(who: ObjectPtr, item: ItemPtr, count: number): number
Removes count items from inventory, returns actual count removed
move_obj_inven_to_obj
Section titled “move_obj_inven_to_obj”function move_obj_inven_to_obj(src: ObjectPtr, dst: ObjectPtr): void
Moves all items from srcObj to destObj
obj_carrying_pid_obj
Section titled “obj_carrying_pid_obj”function obj_carrying_pid_obj(who: ObjectPtr, pid: number): ItemPtr
Returns an Object pointer to an instance of an object of type pid if the object is carrying an object of that type.
obj_is_carrying_obj_pid
Section titled “obj_is_carrying_obj_pid”function obj_is_carrying_obj_pid(who: ObjectPtr, pid: number): number
Returns the quantity of objects with matching pid in inventory
item_caps_total
Section titled “item_caps_total”function item_caps_total(obj: ObjectPtr): number
Returns the current caps total in an object’s inventory
item_caps_adjust
Section titled “item_caps_adjust”function item_caps_adjust(obj: ObjectPtr, amount: number): number
Modifies the current caps count in an object by a given amount. Can be positive or negative.
wield_obj_critter
Section titled “wield_obj_critter”function wield_obj_critter(who: CritterPtr, obj: ItemPtr): void
Sets up an animation causing a critter to wield an object in that critter’s inventory. This puts that object in the critter’s hand.
drop_obj
Section titled “drop_obj”function drop_obj(obj: ItemPtr): void
Causes self_obj to drop an object from inventory
pickup_obj
Section titled “pickup_obj”function pickup_obj(obj: ItemPtr): void
Causes self_obj to animate and pick up an object
proto_data
Section titled “proto_data”function proto_data(pid: number, field: number): number
Returns the value (can be int or string) of a data-member of a given prototype (pid).
tile_distance
Section titled “tile_distance”function tile_distance(tile1: number, tile2: number): number
Returns the tile distance between two tiles
tile_distance_objs
Section titled “tile_distance_objs”function tile_distance_objs(obj1: ObjectPtr, obj2: ObjectPtr): number
Returns the tile distance between two objects
tile_num_in_direction
Section titled “tile_num_in_direction”function tile_num_in_direction(tile: number, direction: Direction, distance: number): number
Returns the tile number of a tile offset from a starting tile in a given direction (0-5, the next tile in that direction).
tile_is_visible
Section titled “tile_is_visible”function tile_is_visible(tile: number): boolean
Returns true if a tile is currently visible on-screen
tile_contains_obj_pid
Section titled “tile_contains_obj_pid”function tile_contains_obj_pid(tile: number, elev: Elevation, pid: number): boolean
Returns true if a tile contains an object with matching pid
tile_contains_pid_obj
Section titled “tile_contains_pid_obj”function tile_contains_pid_obj(tile: number, elev: Elevation, pid: number): ObjectPtr
Returns the first object matching pid on a tile
rotation_to_tile
Section titled “rotation_to_tile”function rotation_to_tile(srcTile: number, destTile: number): Direction
Returns the rotation (0-5) to face a particular tile (destTile) from srcTile.
attack_complex
Section titled “attack_complex”function attack_complex(who: CritterPtr, calledShot: number, numAttacks: number, bonus: number, minDamage: number, maxDamage: number, attackerResults: number, targetResults: number): void
Causes self_obj (must be a critter) to attack a critter with various parameters:
- calledShot: 0/1/specific means none/random/specific (head, torso, etc.)
- numAttacks: # of extra attacks self gets before the target
- bonus: bonus to hit the target on the first turn only
- minDamage/maxDamage: damage range for the first attack
- attackerResults: what state the attacker ends in after the first attack
- targetResults: what state the target ends in after the first attack
attack_setup
Section titled “attack_setup”function attack_setup(who: CritterPtr, victim: CritterPtr): void
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.
terminate_combat
Section titled “terminate_combat”function terminate_combat(): void
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.
has_skill
Section titled “has_skill”function has_skill(who: CritterPtr, skill: SKILL): number
Returns the level of the skill (0-17) of the target critter. Returns 0-200 for Fallout 1, 0-300 for Fallout 2.
get_pc_stat
Section titled “get_pc_stat”function get_pc_stat(stat: PcStatID): number
Returns a pc-only stat value (PCSTAT_*)
do_check
Section titled “do_check”function do_check(who: CritterPtr, check: number, modifier: number): RollResult
Performs a check/test-roll versus one of the basic traits (strength, perception, etc.). Note: these cannot generate Critical Success or Critical Failure as they are a basic X==Y check.
roll_vs_skill
Section titled “roll_vs_skill”function roll_vs_skill(who: CritterPtr, skill: SKILL, modifier: number): RollResult
Returns the value of a completed skill roll made upon an object’s skill level, modified by a given amount (may be zero). This value may then be passed to is_success and is_critical to determine states, and how_much can be used to determine the difference succeeded or failed by.
skill_contest
Section titled “skill_contest”function skill_contest(skill: SKILL): RollResult
Returns the value of a completed skill vs skill contest
is_success
Section titled “is_success”function is_success(rollResult: RollResult): boolean
Returns true if the roll result is a success (including critical)
is_critical
Section titled “is_critical”function is_critical(rollResult: RollResult): boolean
Returns true if the roll result is a critical
how_much
Section titled “how_much”function how_much(val: number): number
Returns how much the rolls differed by
function anim(who: ObjectPtr, anim: number, direction: Direction): void
Sets up a single-frame animation for the object that runs in the given direction.
anim_action_frame
Section titled “anim_action_frame”function anim_action_frame(who: ObjectPtr, frame: number): number
Returns the action frame of an art frame
anim_busy
Section titled “anim_busy”function anim_busy(who: ObjectPtr): boolean
Returns True if object is currently animating, otherwise False. Can be used to determine if an object has completed an animation.
animate_move_obj_to_tile
Section titled “animate_move_obj_to_tile”function animate_move_obj_to_tile(who: CritterPtr, tile: number, speed: number): void
Sets up an animation for a critter to walk to a given tile at a given speed (walk/run). Speed can have a flag attached (see define.h) to force stopping current animation first.
animate_run_to_tile
Section titled “animate_run_to_tile”function animate_run_to_tile(tile: number): void
Animate self_obj running to a tile
animate_rotation
Section titled “animate_rotation”function animate_rotation(direction: Direction): void
Change self_obj’s facing direction (0-5)
animate_set_frame
Section titled “animate_set_frame”function animate_set_frame(frame: number): void
Change self_obj’s animation frame
animate_stand
Section titled “animate_stand”function animate_stand(): void
Run self_obj’s stand animation
animate_stand_obj
Section titled “animate_stand_obj”function animate_stand_obj(obj: ObjectPtr): void
Run an object’s stand animation
animate_stand_reverse
Section titled “animate_stand_reverse”function animate_stand_reverse(): void
Run self_obj’s stand animation in reverse
animate_stand_reverse_obj
Section titled “animate_stand_reverse_obj”function animate_stand_reverse_obj(obj: ObjectPtr): void
Run an object’s stand animation in reverse
reg_anim_func
Section titled “reg_anim_func”function reg_anim_func(cmd: number, arg: number | ObjectPtr): void
Low-level animation registration function
reg_anim_end
Section titled “reg_anim_end”function reg_anim_end(): void
Activate the animation sequence
reg_anim_animate
Section titled “reg_anim_animate”function reg_anim_animate(obj: ObjectPtr, anim: number, delay: number): void
Adds a single, in-place animation on an object to an animation sequence-list, at a given delay from the previous animation (delay should always be -1).
reg_anim_animate_forever
Section titled “reg_anim_animate_forever”function reg_anim_animate_forever(obj: ObjectPtr, anim: number, delay: number): void
Adds a single, in-place animation to the sequence that will animate continuously until something interrupts it. Delay should always be -1. Use very sparingly.
reg_anim_animate_reverse
Section titled “reg_anim_animate_reverse”function reg_anim_animate_reverse(obj: ObjectPtr, anim: number, delay: number): void
Add a reversed animation to the sequence
reg_anim_obj_move_to_obj
Section titled “reg_anim_obj_move_to_obj”function reg_anim_obj_move_to_obj(who: CritterPtr, dest: ObjectPtr, delay: number): void
Adds an animation to cause a critter to attempt to walk to another object. Delay should always be -1.
reg_anim_obj_move_to_tile
Section titled “reg_anim_obj_move_to_tile”function reg_anim_obj_move_to_tile(who: CritterPtr, tile: number, delay: number): void
Add a walk-to-tile animation
reg_anim_obj_run_to_obj
Section titled “reg_anim_obj_run_to_obj”function reg_anim_obj_run_to_obj(who: CritterPtr, dest: ObjectPtr, delay: number): void
Add a run-to-object animation
reg_anim_obj_run_to_tile
Section titled “reg_anim_obj_run_to_tile”function reg_anim_obj_run_to_tile(who: CritterPtr, tile: number, delay: number): void
Add a run-to-tile animation
reg_anim_play_sfx
Section titled “reg_anim_play_sfx”function reg_anim_play_sfx(who: ObjectPtr, sfx: string, delay: number): void
Adds an animation to cause an object to play a sound effect at a given delay.
add_timer_event
Section titled “add_timer_event”function add_timer_event(obj: ObjectPtr, ticks: number, info: number): void
Adds a timed event call to the queue at a given time offset to call an object’s script. Info is used to differentiate between timed event calls and is read back using fixed_param. Note that time is in ticks (use game_ticks(seconds) to convert from seconds).
rm_timer_event
Section titled “rm_timer_event”function rm_timer_event(obj: ObjectPtr): void
Removes (clears) all timer events hooked to a given object’s script.
game_ticks
Section titled “game_ticks”function game_ticks(seconds: number): number
Returns game ticks for a number of seconds
game_time_advance
Section titled “game_time_advance”function game_time_advance(ticks: number): void
Advances game time by ticks
metarule
Section titled “metarule”function metarule(func: number, param: ObjectPtr | number): number
Generic metarule function
metarule3
Section titled “metarule3”function metarule3(func: number, param1: ObjectPtr | number, param2: ObjectPtr | number, param3: ObjectPtr | number): number
Generic metarule3 function
inven_cmds
Section titled “inven_cmds”function inven_cmds(obj: ObjectPtr, cmd: number, param: number): ObjectPtr
Inventory commands function
global_var
Section titled “global_var”function global_var(index: number): number
Returns the value of a global variable by index.
set_global_var
Section titled “set_global_var”function set_global_var(index: number, value: number): void
Sets the value of a global variable by index to a given value.
local_var
Section titled “local_var”function local_var(index: number): number
Returns the value of a local variable by index. Errors may occur if the script doesn’t have local vars up to this number.
set_local_var
Section titled “set_local_var”function set_local_var(index: number, value: number): void
Sets the value of a local variable by index to a given value.
map_var
Section titled “map_var”function map_var(index: number): number
Returns the value of a map-global variable by index.
set_map_var
Section titled “set_map_var”function set_map_var(index: number, value: number): void
Sets a map variable value
party_add
Section titled “party_add”function party_add(who: CritterPtr): void
Adds a critter into the list of party members. This will also setup those objects so they will not be saved in maps, and certain other things.
party_remove
Section titled “party_remove”function party_remove(who: CritterPtr): void
Removes a critter from the list of party members. This will also change those objects so that certain object- and map-level things will respond differently.
party_member_obj
Section titled “party_member_obj”function party_member_obj(pid: number): CritterPtr
Returns a CritterPtr to a party member that matches a given pid. If that critter isn’t currently a member of the party, returns NULL.
dialogue_system_enter
Section titled “dialogue_system_enter”function dialogue_system_enter(): void
Request the talk system for this object
start_gdialog
Section titled “start_gdialog”function start_gdialog(msgFileNum: number, who: CritterPtr, mood: number, headNum: number, bgIdx: number): void
Start the dialogue system focusing on a critter and in a given mood. Sets up appropriate dialog windows, head art, etc. Without this call, dialog windows will not come up, only grey boxes with text.
Mood argument is unused in vanilla. Instead, LVAR 0 of the script is checked:
- LVAR > 10: good reaction (happy head)
- -10 > LVAR >= 10: neutral
- Else: angry head
With sfall StartGDialogFix enabled, mood argument works:
- If mood == -1: use vanilla behaviour (check LVAR 0)
- Else: use argument value with same thresholds
end_dialogue
Section titled “end_dialogue”function end_dialogue(): void
End the dialogue system
gSay_Start
Section titled “gSay_Start”function gSay_Start(): void
Start a dialog sequence
gSay_End
Section titled “gSay_End”function gSay_End(varIndex: number): void
End a dialog sequence
gSay_Reply
Section titled “gSay_Reply”function gSay_Reply(msgList: number, msgNum: number): void
Set up a reply (what the critter says)
gSay_Message
Section titled “gSay_Message”function gSay_Message(msgList: number, msgNum: number, reaction: number): void
Sets up a sayMessage, which is a reply with just a [Done] option. The msg_list determines which message file to look in, and msg_num determines which line to use.
gSay_Option
Section titled “gSay_Option”function gSay_Option(msgList: number, msgNum: number, target: Function, reaction: number): void
Sets up an option-choice for a reply block, getting the string from the message file and message number, which will cause a given reaction, and if chosen will jump to the given target procedure.
giQ_Option
Section titled “giQ_Option”function giQ_Option(iqTest: number, msgList: number, msgNum: number, target: Function, reaction: number): void
Sets up an option-choice for a reply block if the player’s IQ is >= iq_test, getting the string from the message file and message number, which will cause a given reaction, and if chosen will jump to the target procedure. This is the only function that automatically accounts for Smooth Talker perk.
dialogue_reaction
Section titled “dialogue_reaction”function dialogue_reaction(mood: number): void
Set up a reaction animation
gdialog_mod_barter
Section titled “gdialog_mod_barter”function gdialog_mod_barter(modifier: number): number
Switch to barter screen with modifier
gdialog_set_barter_mod
Section titled “gdialog_set_barter_mod”function gdialog_set_barter_mod(modifier: number): void
Set the barter modifier
message_str
Section titled “message_str”function message_str(list: number, msgNum: number): string
Returns a string from the message module for a given list and a given message number.
display_msg
Section titled “display_msg”function display_msg(message: string): void
Displays a string on the in-game PDA display (lower-left hand corner).
float_msg
Section titled “float_msg”function float_msg(who: ObjectPtr, message: string, color: FloatMsgColor): void
Creates a floating-text message attached to an object using colors dictated by type. There are two special types: 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 to give critters different-colored messages to differentiate them.
debug_msg
Section titled “debug_msg”function debug_msg(msg: string): void
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.
give_exp_points
Section titled “give_exp_points”function give_exp_points(points: number): void
Adds experience points to the player’s total. These points may then be used by the player to enhance skills, etc.
tokenize
Section titled “tokenize”function tokenize(str: string, offset: number | string, delim: number | string): string | 0
Tokenize a string at delimiters.
load_map
Section titled “load_map”function load_map(mapName: string, startLocation: number): void
Loads a new map, removing all scripts currently running and passing on the entrance 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).
world_map
Section titled “world_map”function world_map(): void
Brings up the World Map screen
town_map
Section titled “town_map”function town_map(): void
Brings up the Town Map screen (Fallout 1 only)
wm_area_set_pos
Section titled “wm_area_set_pos”function wm_area_set_pos(areaIdx: number, x: number, y: number): void
Sets the World Map coordinates for a town
set_map_start
Section titled “set_map_start”function set_map_start(x: number, y: number, elev: Elevation, rot: Direction): void
Sets the start location & rotation (0-5) for the next time this map is entered (loaded & run).
override_map_start
Section titled “override_map_start”function override_map_start(x: number, y: number, elev: Elevation, rot: Direction): void
Used when loading a new map, forces the player to start at a particular location (x/y), elevation (0-2) and rotation (0-5) when first coming up.
set_exit_grids
Section titled “set_exit_grids”function set_exit_grids(markElev: Elevation, mapID: number, elev: Elevation, tile: number, rot: Direction): void
Sets all exit grids on a given elevation (markElev) to point to a destination mapID (may be -1 to stay on this map), elevation, tileNum, and rotation.
game_ui_disable
Section titled “game_ui_disable”function game_ui_disable(): void
Disables game UI input (must re-enable!)
game_ui_enable
Section titled “game_ui_enable”function game_ui_enable(): void
Re-enables game UI input
gfade_out
Section titled “gfade_out”function gfade_out(time: number): void
Does a palette fade to black. The time parameter is currently not actually used.
gfade_in
Section titled “gfade_in”function gfade_in(time: number): void
Does a palette fade from black to the game palette. The time parameter is currently not actually used.
set_light_level
Section titled “set_light_level”function set_light_level(level: number): void
Sets the ambient light level (1-100). Range is Full Darkness to Full Daylight. NOTE: level is NOT percentage, full darkness is not black screen. set_light_level(0) corresponds to 25% brightness, and certain brightness levels cannot be set.
set_map_music
Section titled “set_map_music”function set_map_music(mapID: number, soundPath: string): void
Sets the map background music
play_sfx
Section titled “play_sfx”function play_sfx(sfxFileName: string): void
Starts a new sound effect to be played on the queue.
play_gmovie
Section titled “play_gmovie”function play_gmovie(movieNum: number): void
Plays one of the Fallout movies (full-screen, compressed, etc.).
endgame_movie
Section titled “endgame_movie”function endgame_movie(): void
Plays the endgame movie
endgame_slideshow
Section titled “endgame_slideshow”function endgame_slideshow(): void
Plays the endgame slideshow
jam_lock
Section titled “jam_lock”function jam_lock(obj: DoorPtr | ContainerPtr): number
Jams a lock, preventing the player from picking it for approximately 24 hours. Meant to be used when a player critically fails to pick a lock.
scr_return
Section titled “scr_return”function scr_return(): void
Sets the return value for C-engine node
script_overrides
Section titled “script_overrides”function script_overrides(): void
Tells the C-engine that the script will override default behavior for the object. The C-engine will not attempt to do things it would normally do, expecting the script to handle them. Commonly used for player actions on objects: looking at them, using them (opening doors), or using items ON them (using a picklock or key on a door lock).
random
Section titled “random”function random(min: number, max: number): number
Returns a random value between min and max, inclusive.
function floor(value: number): number
use_obj
Section titled “use_obj”function use_obj(obj: ObjectPtr): void
Use a usable object
use_obj_on_obj
Section titled “use_obj_on_obj”function use_obj_on_obj(item: ObjectPtr, target: ObjectPtr): ObjectPtr
Attempt to use an item object on a target object. This could be used to have a critter use a Stimpack on the player, or to use a key on a door.
using_skill
Section titled “using_skill”function using_skill(who: CritterPtr, skill: SKILL): boolean
Returns true if an active skill is being used
AddNamedEvent
Section titled “AddNamedEvent”function AddNamedEvent(name: string, proc: Function): void
Adds a named event handler (fires once)
AddNamedHandler
Section titled “AddNamedHandler”function AddNamedHandler(name: string, proc: Function): void
Adds a named event handler (fires many times)
ClearNamed
Section titled “ClearNamed”function ClearNamed(event: string): void
Removes all handlers for a named event
SignalNamed
Section titled “SignalNamed”function SignalNamed(event: string): void
Signals a named event
art_anim
Section titled “art_anim”function art_anim(fid: number): number
Returns the animation type of a fid
Globals
Section titled “Globals”| Name | Type | Description |
|---|---|---|
dude_obj | CritterPtr | Returns a pointer to the dude object (the player) |
self_obj | ObjectPtr | Returns a pointer to the object connected to this script |
source_obj | ObjectPtr | Returns a pointer to the source object (activator) for this action |
target_obj | ObjectPtr | Returns a pointer to the target object for this action |
obj_being_used_with | ObjectPtr | Returns a pointer to the object being used on another object |
action_being_used | number | Returns the current skill being used on a script object |
fixed_param | number | Returns the value of the script’s fixed parameter (used with add_timer_event) |
script_action | number | Returns the action that has activated this script |
cur_map_index | number | Returns the index # of the current map |
days_since_visited | number | Returns the number of days since this map was last visited, or -1 if never |
game_time | number | Returns the current game time in ticks |
game_time_hour | number | Returns the current hour (e.g., 721 = 7:21 am) |
combat_is_initialized | boolean | Returns true if the system is currently in combat mode |
game_ui_is_disabled | boolean | Returns true if the game UI is currently disabled |
difficulty_level | Difficulty | Returns the current Game difficulty level (0-2) |
combat_difficulty | Difficulty | Returns the current Combat difficulty level (0-2) |
running_burning_guy | number | Returns the running-burning-guy setting |
get_day | number | Returns the current day of the month |
get_month | number | Returns the current month of the year |
explosion | number | Sets up an explosion at a tile |