Scripting 102 - The "timed_event_p_proc"
An exploration of the "timed_event_p_proc".
Fallout 2's scripting language, the StarTrek Scripting language (.ssl), has several pre-defined procedures that hook directly into the game engine at specific points to allow the scripter to run scripts in these very specific situations.
Creating a new critter template in the Sfall Script Editor will list the most common ones, and of these the most used are look_at_p_proc and description_p_proc, but in this video I focus mainly on the timed_event_p_proc (which for some reason isn't included in the critter template despite its usefulness).
The timed_event_p_proc is generally used to set path-ing and action animations on critters, though it can be used for just about anything that requires a delay or the ability to loop through a function at a specific rate, then turn off that loop or enable another if some condition is met.
This video focuses mostly on an animation loop as its easy to visually see what the loop is doing as I write it.
This video is a heavily edited version of my livestream.
I made an effort to keep the code progression legible while skipping over all the extraneous stuff that I wrote as I tried to come up with examples while live, but let me know if anything gets confusing and you'd like a more in depth explanation.
I'm also still practicing and learning the engine, so there might be a few things I describe incorrectly, please feel free to comment if I got something wrong :)
0:00 Start
0:36 Intro and Setup
2:45 timed_event_p_proc description
6:22 Adding a new map to MAPS.TXT
7:30 add_timer_event()
10:36 2x timer events
11:26 Using fixed_param
13:54 Delaying timer events
14:34 Using game_ticks() vs just a number
16:06 Overlapping timer events
18:00 Using a flag to swap timer events
18:40 Calling timed events from inside a timed event
21:10 Ping-ponging timed events
23:40 Code walkthrough
25:20 Problems with random walks
27:30 Save/Reload bug when using map_enter_p_proc as a trigger
29:30 Leaving and re-entering maps clears timer events
32:00 rm_timer_event() doesn't work on save/load
33:20 rm_timer_event() working inside another timed event
34:20 rm_fixed_timer_event()
36:05 Defining a fixed param shortcut with a name
40:05 Part 2! - Examples
42:10 Example 1
34:10 Ways to make Example 1 work
45:34 Example 2
46:40 Using anim_busy()
48:14 Example 3
49:45 Example 4 - Using map_update_p_proc to call timers
52:37 Using critter_p_proc
54:13 Example 5 (3 sir?)
56:30 Calling timer event on another critter
58:30 tile_contains_pid_obj() - Getting a pointer to a critter object using the tile they're standing on
1:01:10 Handling critters getting stuck
1:05:20 Calling another critters timer event does not use the originating scripts timer event scripts
1:07:15 Outro
The largest collection of scripting tutorials I've found to date:
https://falloutmods.fandom.com/wiki/Category:Fallout_2_tutorials_-_scripting
Backup link:
https://falloutmods.fandom.com/wiki/Fallout_2_tutorials
List of (original) Scripting Commands:
https://falloutmods.fandom.com/wiki/Fallout_1_and_Fallout_2_scripting_-_commands,_reference,_tutorials
"Miria Mod" scripting tutorial:
https://falloutmods.fandom.com/wiki/Building_a_Better_Miria_Mod
"for" loop examples:
1) FO1in2 mod - https://github.com/rotators/Fo1in2/blob/0fc7da4d5dedadd7838b24ec1a9f95afaa1f301c/Fallout2/Fallout1in2/Mapper/source/scripts/headers/command.h#L1036
2) sfall sample script - https://github.com/phobos2077/sfall/blob/master/artifacts/example_mods/ComputeDamage/gl_compute_damage.ssl#L102
Other Videos By Quantum Apprentice
2024-02-03 | Free Games - 02 February 2024 |
2024-01-28 | Oblivion Lost mod - part 5 |
2024-01-27 | Free Games - 26 January 2024 |
2024-01-21 | Oblivion Lost mod - part 4 |
2024-01-20 | Free Games - 19 January 2024 |
2024-01-14 | Oblivion Lost mod - part 3 |
2024-01-08 | Oblivion Lost mod - part 2 (restart) |
2024-01-07 | Free Games - 05 January 2024 |
2023-12-23 | Fallout 2 - Vic's Favorite Food | quantumapprentice on #Twitch |
2023-12-17 | Free Games - 15 December 2023 |
2023-12-16 | Scripting 102 - The "timed_event_p_proc" |
2023-12-07 | Fallout Shorts 14 - TV Show Trailer 1 Reaction |
2023-11-25 | Free Games - 24 November 2023 |
2023-11-18 | Free Games - 17 November 2023 |
2023-11-17 | KC:D - mass grave | quantumapprentice on #Twitch |
2023-11-05 | Free Games - 4 November 2023 |
2023-10-01 | FO2 Scripting - Reading a Decompiled Map Script (arvillag.int) |
2023-08-12 | Free Games - 11 August 2023 |
2023-07-15 | Free Games - 14 July 2023 |
2023-06-10 | Free Games - 9 May 2023 |
2023-05-27 | Free Games - 26 May 2023 |
Other Statistics
Fallout 2 Statistics For Quantum Apprentice
Quantum Apprentice currently has 204,709 views spread across 186 videos for Fallout 2. Roughly 17 days worth of Fallout 2 videos were uploaded to his channel, or 30.99% of the total watchable video on Quantum Apprentice's YouTube channel.