Fallout Tactics utility FTSE - Fallout Tactics Scripting Engine (0.56a)

Melindil

It Wandered In From the Wastes
Project page (GitHub): https://github.com/melindil/FTSE
Download link (current): https://github.com/melindil/FTSE/blob/master/Release/FTSE_0.56a.zip?raw=true
Documentation link: https://melindil.github.io/FTSE/manual/01-introduction.md.html

This mod enhances the game Fallout Tactics, adding the following capabilities:

Configurable EXE patching
Most of the known hex-edits for the BOS executable file are included. Each can be selectively enabled or disabled from a configuration file. New edits can also be added without needing to hex edit, or rebuild the mod.

Custom Scripting Engine
The mod will patch the BOS executable to load an included DLL, containing a Lua language interpreter, and interfaces to the Fallout Tactics data. The Lua code can specify code to execute at certain pre-defined trigger points within the game, and modify game variables in real-time to produce customized behaviors.

Installation Instructions (NOTE this has changed for 0.45a)

IMPORTANT: If upgrading from a version earlier than 0.45a, it is highly advised to remove any existing ftse.lua script file, and reapply any customizations to the new ftse.lua file generated after installation. This ensures that the old Lua code for fixing the burst bug is properly removed from ftse.lua, since it is now included in ftse_base.lua.

Download the latest .ZIP release from the Release directory, and uncompress. Included is FTSESetup.exe - running this will bring up a small UI. Select the BOS.EXE file, and click "Install". The setup utility will patch the EXE and copy all necessary files to the game directory. A backup of the EXE will be produced.

Note that the installer will check the EXE to ensure that a) the patch is not yet installed, and b) that the code being modified is as expected (BOS.EXE version 1.27). If the UI shows "Installed", then the EXE has already been patched. The setup utility will still copy the latest versions of the DLL and config files.

If upgrading from 0.45a to a later release, then running FTSESetup.exe should show the status as "INSTALLED" already. As long as the newer FTSESetup.exe has been run, the new versions of FTSE.DLL and the configuration files will be copied over.

If the UI shows "Unknown", then the EXE doesn't match the expected version, and will not allow patching.

The new UI also allows selecting individual hex patches. Select/unselect desired patches, then click "Apply Changes".

After installation, double-check that the FTSE.DLL, FTSE_config-base.json, and ftse_base.lua files have been copied to the Fallout Tactics directory.

Upon starting the game, if everything is working, the FTSE version should be included in the version string near the bottom of the main menu screen.

More documentation will be forthcoming as new functionality is added.

Enjoy!

Changelog:
Code:
0.56a:

Bug fixes (FOT):

* Added hex patch for proper fix of Night Person, Die Hard, and Adrenaline Rush

Bug fixes (FTSE):

* FTSESetup now displays error message if an error occurs on reading the BOS executable
* Calling RemoveInventory on Container and Vehicle now triggers game engine inventory revalidate function
* Equip and unequip hooks no longer called if World hasn't fully loaded yet
* Fix Collectable:GetWeightTotal calling the wrong function
* Ensure calculations for radiation and poison resistance cap at 100% to avoid triggering heal logic

New Class Functions:
* Entity:SetTag
* Actor:GetXP
* Actor:AddXP
* Actor:GetReputation
* Actor:AddReputation
* Actor:GetHP
* Actor:ApplyDamage
* Actor:HealHP
* Actor:GetAP
* Actor:AdjustAP

* Added handling for Entity vtable function 510 (ActOnControllerCommand)

0.55a: June 27, 2024

Bug fixes (FOT):

* Added hex patch fixes for radiation and poison resistance to work properly
* Added hex patch fix for proper randomization of injury on non-aimed-shot critical hits

Bug fixes (FTSE):

* Corrected a typo that prevented the GetEffectMaximum function in Consumable class from working correctly

New class functions:

* World:AdvanceTime
* Entity:SetColor
* Entity:RefreshSprite

Major features:

* Added ability to call and/or hook most Entity class vtable functions. See vtable documentation for details.

0.52a: May 7, 2021

Bug fixes (FOT):

* Swapping items in hands no longer reloads weapons for free, and keeps both equipped.

New hooks:

* OnCheckEquip
* OnEquip
* OnCheckUnequip
* OnUnequip

New class functions:

* Actor:EquipItem
* Actor:UnequipItem
* Actor:GetEquippedItem
* Entity:GetInternalName


0.51a: April 8, 2021

Bug fixes (FTSE):

* Fixed random crashes due to missing LUA stack cleanup

0.50a: May 9, 2020

Bug fixes (FTSE):

* Modified the AP value in ActorStatus to properly handle it as a floating point value

Scripting additions/changez:

* Added all remaining entity types (too numerous to list here)
* Added functions to retrieve, add to, and remove from inventory
* Added function to create an entity (non-actor so far)
* Added function to destroy an entity
* Added hooks when items are added to or removed from inventories (Actor, Vehicle, Container)
* Added hook for LUA to control whether items can be equipped/used

0.45a: August 30, 2019

General changes:

* Added a new UI for installing the FTSE.dll loading patch, and selecting hex patches
* Added FTSE_config_base.json and FTSE_base.lua files which contain default changes, so that new installations don't overwrite user customizations
* Changed build properties to lower CPU requirements (should improve compatibility)

Bug fixes (FTSE):

* Fixed burst attack hook to properly remove crouching allies in front of shooter

New hex patches:

* Added hex patch to fix melee/unarmed critical hit bugs (left leg punch bug)
* Added hex patch to fix Bonus H2H Damage perk's 15% bonus
* Added hex patch to fix crash when game runs out of special encounters

Scripting additions/changes:

* Substantial refactoring: Objects passed to Lua scripts now have proper entity hierarchy
* Added the following hooks:
  * OnChanceToHitCalc
  * OnConeAttack
  * OnSprayAttack
  * OnStraightAttack
  * OnRadialAttack
  * OnAreaAttack
  * OnProjectileAttack
  * OnChanceToCritical1
  * OnChanceToCritical2
  * OnCriticalEffect1
  * OnCriticalEffect2
  * OnDamageCalc
* Added the following classes:
  * Actor (significantly updated)
  * Ammo
  * Breakable
  * Collectable
  * StateBreakable
  * Trap
  * Vehicle
  * VehicleWeapon
  * Weapon (significantly updated)
* Added calls to Entity class to use game built-in vtable functions where available/useful


0.32a: November 15, 2018
* Added OnBurstAttack for burst bug fix
* Added hex patch for high-res support (default on)
* Added hex patch for color fixes in encounters (default on)
* Added hex patch to blank starting inventory (default off)
* Disabled hex patch for burst bug (replaced by scripting fix)
0.30a: August 29, 2018
* Added hook + function to add locale strings from Lua script
* Added hook to time calculations, so that scripts can customize (e.g. to change start date)
* Added world:CombatLog to allow scripts to write to combat log
* Added actor::GetField for other actor values (non-attribute)
* Added world:GetPlayer and world:GetSquad
* Added support for getting and setting mission and campaign flags
 
Last edited:
Hi Melindil! I'm surprised no one replied to you already about this game changing addon! And sorry to not have replied earlier, I was busy in hollidays... Thanks again for all your work and all the promising features to come...

I'll test this as soon as I can along with a new interface. I really want to implement custom perks for main character too based on global variable changes after special quests. Please tell me if I need more info from you to add this feature to my mod.

Also, please tell me if a flag and UA code could be used to allow some items with a tag in the inventory to trigger some skill or stat changes to the character wearing them (example: if you have an item tagged Backpack in your inventory, you have +100 lbs of carry items. Other example: if you have boots in your inventory with Boots tag, you have +10 electric resistance). Thanks!!

Keep on good work and stay connected, I'll send you screenshots soon.
 
I don't have variable detection triggers working yet, but that's my next focus.

Right now, it's possible for custom perks to add or remove temporary or permanent attribute values (anything under the "attributes" section in the FT Tools editor), with the following triggerable cases:

* Date / Time values
* Values of other attributes (permanent, temporary, or effective)
* Taking radiation damage (found this one while making my example)

And soon can be based on (i.e. things I know how to do already):

* Teammate proximity
* Stance
* Attacks, hits, critical hits

And ones I don't know yet, but want to figure out soon:

* Campaign and mission variables
* Equipped weapons/armor
* In-inventory items
* Light level
* Detection level
* Trade/barter window interactions

And I'm definitely open to other suggestions for trigger conditions. It's mainly just a matter of finding a location in the game code where a certain thing happens, then adding an instruction there to jump to my script code.

I like the idea of in-inventory bonuses. I'd need to make sure I can read the tag field (is this set for all entities of a type, or only single instances?). It could be something like, if an item is tagged "Bonus-XXX" (with XXX being any string), then I apply any modifier bonus attributes for that item on the character. An example would be, say, "Bonus-boots" to apply electric resistance or a bonus action point or whatever. Could even set it up so that if there are multiple items tagged "Bonus-boots" then only the highest bonus is applied. (*Really* fancy would be an actual, customizable inventory screen, but that's a very long way from being possible.)

Edit to add (so I don't forget): Thought of an interesting idea .. with hooks on the barter/trade window, it'd be possible to 1) have scripting affect NPC shopkeeper / quartermaster, and (more interesting) 2) possibly create a "crafting" object, which when given certain combinations of items, will "trade" other items (possibly affected by character perks or skill ratings).
 
Last edited:
I'm finding myself coming back to FOT modding, and this sounds promising.

Things I would like to change most are restrictions in the number of recruits you can take, as well as on the number of passengers on vehicles. Also some way to manipulate time so you can rest x number of minutes, hours, days.
 
Also some way to manipulate time so you can rest x number of minutes, hours, days.

Fabulous idea! Fallout 1 was strong on time related triggers, actions and quests, and I think this is still an advantage compared to many (maybe all) other games in the franchise. I have the idea in my mod to create a quest where you have to keep a recruit alive in the wild for at least a year. The only way for me to include that would be time related codes that affect global variables.

It could be something like, if an item is tagged "Bonus-XXX" (with XXX being any string), then I apply any modifier bonus attributes for that item on the character. An example would be, say, "Bonus-boots" to apply electric resistance or a bonus action point or whatever. Could even set it up so that if there are multiple items tagged "Bonus-boots" then only the highest bonus is applied. (*Really* fancy would be an actual, customizable inventory screen, but that's a very long way from being possible.)

That is exactly what I have in mind yess! I thought about that because Fallout 1,2, Tactics have a great weakness, you just can't equip many items to receive bonuses as in many other games. This is not an issue anymore if you can just "have" that item for it to be effective. Other examples : Special survival tools, a compass, a survival straw, gaz mask, gloves, mechanic-support legs or arms, binoculars, motion sensor, etc. etc.

Edit to add (so I don't forget): Thought of an interesting idea .. with hooks on the barter/trade window, it'd be possible to 1) have scripting affect NPC shopkeeper / quartermaster, and (more interesting) 2) possibly create a "crafting" object, which when given certain combinations of items, will "trade" other items (possibly affected by character perks or skill ratings).

You are reading my mind here! I am looking forward for this kind of stuff to make the quartermaster in my mod to act like a container (all items free to buy from him). It is because in my mod the quartermaster is in fact the player's cooler with all items added to it as a 0$ item, so the player can take them when they appear (fresh meat from skinned animal, animal pelts, water gathered, etc.). At this point of my mod you can add any items from your inventory to the cooler but can't take them back... The items must be at 0$ to be taken by the player. I would like them to have a value, but still being optained without payment to the quartermaster...
 
I'm finding myself coming back to FOT modding, and this sounds promising.

Things I would like to change most are restrictions in the number of recruits you can take, as well as on the number of passengers on vehicles. Also some way to manipulate time so you can rest x number of minutes, hours, days.

Resting time is very likely doable. I can control the game timer already, to advance date/time on an event. But I need to find how to have that time passing have the intended effects on healing and consumable effects. Plus a routine to detect if any enemy actors are alerted, so that you can't rest in combat.

Changing limit on number of recruits between 1-6 would be easy. More than 6 is tricky - the engine appears to be able to handle it to at least a limited degree (the Newton mission lets you do it temporarily with the reaver leaders). But I don't know what side effects might pop up - things like whether the squad members greater than 6 can be persisted across missions, and a bug described on the wiki where, if the reaver leader is made permanent (by having him/her in a vehicle), they can sometimes replace the first character in the lead position. I'll try to find where the limit is enforced, and add a toggle to change or disable it, so we can test further.

Vehicle capacity shouldn't be too difficult, subject to the same concerns about whether having > 6 passengers causes any issues.
 
I have tested having more than six recruits in a campaign, and have had no problem. There are two ways you can do this; one is through triggers. That was a problem before when tags got stripped entering a new map, but now that the tag name stripping has been removed through hex editing, it can work on a campaign. The other way is adding a map where only the main character is spawned, and putting a recruit master there. However, it would be much better if the limit was removed, so you don't have to implement tags, or enter and leave the recruit area mentioned, to add squad members.

Vehicles have a limit of 7 passengers. Add a gunner and driver and you can take a maximum of 9 per vehicle.
 
I have tested having more than six recruits in a campaign, and have had no problem.

That's good to know. Means that the change is likely just modifying a test in the recruitmaster UI screen to allow adding if there are already 6+ members.

Have you tested to see what happens when visiting a recruitmaster with more than six members? Does the UI show only the first six, or the last six? (Wondering about the feasibility of adding a couple buttons to scroll through a larger squad.)
 
Yes I have. Only the first six are shown; and adding a button to scroll in both the recruit master UI as well as the main interface, would be awesome.


Other things that would be great to fix would be making vehicle weapons use the sound effect specified on their entity rather than the generic vehicle attack sound.
This would make it possible to have different mounted weapons on vehicle turrets. Also fixing the vehicle gunner bug which uses the weapon skill, and awards kills to the driver rather than the gunner.

Some way to add more races, and being able to specify their traits, default sprite, sounds, etc. would be worth looking into.
 
Last edited:
Updated to 0.30a. The engine now supports reading, changing, and triggering script behaviors based on mission and campaign variables, which should make it considerably more useful.

I'm working on a better set of documentation for the functionality exposed to the Lua script engine - when done, it will be available in the project wiki link above.
 
Great! Yess I'm the kind of person here that need some more Lua script engine documentations, I tend to be lost a bit in this new way of coding. For my part, I created a statue for you as promised in one of the cities (ha! :cookie:) and still working on my new Worldmap and quests writing. My next goal is to make color portraits and test them with your changes. I'll test also these new promising functionalities you describe then. Thanks again for your impressive work!
 
He! Just installed the engine about an hour or so ago. Easily installed and worked instantly. That's a charm to work with serilously, and it will save me a lot of time and attention as I will not have to worry about engine bugs anymore. You have my thanks. Still have to make a couple of colour portraits, then I'll send you a postcard! :D
 
My list of several strange engine issues to repair / improve (mostly from other threads here or on DAC):

1) Electronic Lockpicks:
"Unfortunately Electronic Lockpicks don't work correctly in the game. There is an option to tag doors as "Electronic" as well as the Lockpicks themselves, but it wasn't actually enabled. So it looks like we're stuck w/generic lockpicks."
It would be great to have working electronic lockpicks. The solution to have a tagged item and then to create triggers for every door is a bother.

2) Super Tololkits X Repair Item:
" there is a bug w/vehicles needing an item to Repair them. I seem to recall having simply used a Super Tool Kit on one once and the vehicles was repaired. That's why I only have standard Tool Kits available on the map. If you intend to use this in one of your maps, I recommend checking into this possible bug."

3) Give item from human to NPC:
"The give item from human to npc command doesn't like multiple tagnames.. From NPC to human will work with trading umpteen tagged items but from human to npc will only trade one item and won't move equipped items, even using multiple preserved triggers."

4) Turret and maybe Object races shouldn't be affected by drugs - it could be implemented the same way as for robots, they aren't affected by them.

5) # alive in a zone (not verified by me)
"it appears that the "Quantity Team" and "Quantity Player" triggers don't work for # alive in a zone other than anywhere."

6) First Aid, Doctor skill use during combat:
"Things that make you go 'hmmm': In turn based play, when using the First Aid or Doctor skill during combat your medic must have fewer AP than he needs to use the first aid kit or doctor's bag. For example, if Stitch has a use cost of 8 AP for a First Aid kit, if he has 8 or more AP he can't use the First Aid kit. He will appear to use it, but will do nothing-- he will repeatedly play a "use item" animation and no healing will occur. If he has 7 AP or less, everything will be fine. This is an engine bug that cannot be fixed. If you need to heal someone and have more AP than the healing item requires, take a few steps back and forth to lower your available AP first. I've known about this bug for a long time, but in thinking about the matter recently I now think this problem makes the "Stat" perk (which in the past I've had my medics take multiple times) useless-- if using a medical kit is going to take two turns no matter what, how many APs remain on the medic's second turn is usually of little importance."

7) Items not removed from inventory:
"Quest items don't disappear from inventory if the character holding them is inside a vehicle when leaving the map. The engine has problems calculating containment, and nothing can be done about this."

8) AP costs of consumable items are not displayed
"All consumable items (food, drinks, drugs) do not display an AP cost in when placed in a character's active item slot, yet they have a use cost of two. There is no known way to fix this problem."

9) Vehicles cannot be deactivated
" something that doesn't work is deactivating vehicles by deactivating their Player Index or moving them to a deactivated PI."
 
@TorontRayne will probably be interested in this thread. Since I think he wanted to do some Fallout Tactics projects or modding or something.

I liked all the posts but did not comment yet due to REDACTED. Speaking of which REDACTED should check this out at some point. This gives me ideas but ideas are a dime a dozen. Before I kick the bucket I will do something with this. Hope that is later rather than sooner.
 
Personnally I implemented electronic lockpick in my game by giving doors the tagname "Electronic" and adding Electronic Lockpick in my game as keys with the tag "Electronic". It works without any trigger but there are some downsides to that :

- No other key can be used to open these doors, the tagname is already used
- Each and every electronic lockpick must keep its tagname to work. If, for instance, an electronic lockpick exists somewhere on the ground, it must have a manually entered tagname to work.

That bring me to two other bugs I wish to add to the list :

- All items on the ground in maps (not in container or on an entity) automatically lose their tagname. They must be assigned manually to work.

- All items on entities (added in the entity inventory with entity editor) lose their tagname in game. This is infuriating because that means ALL random encounter entity items don't have any tagname. It is a serious problem in my mod and it brings me to tag guns, weapons and many items in random encounter as not lootable.
 
That bring me to two other bugs I wish to add to the list :

- All items on the ground in maps (not in container or on an entity) automatically lose their tagname. They must be assigned manually to work.

- All items on entities (added in the entity inventory with entity editor) lose their tagname in game. This is infuriating because that means ALL random encounter entity items don't have any tagname. It is a serious problem in my mod and it brings me to tag guns, weapons and many items in random encounter as not lootable.

Citing other modding gurus:

1) "When working with tagnames always add the tagname in the level editor and not the entity editor, unless your tagged item or recruit is going to be placed in an inventory, or be available via the Recruit or Quarter Master. Because when you place items or actors etc in the map the field 'tagname', above the entities window, overwrites the tagnames given in the entity editor."

2) "When adding tagged items to an actor's inventory (either an actor, vehicle or container) do so via the level editor as inventories added via the entity editor are not part of the map and tagnames will not be imported."

Re 1) So the bug is in the level editor, it should take over the tagname of the just inserted entity from its ent file. Then you would have a possibility to rename it or leave the imported default one. Might be an easy fix?
Re 2) It's probably too complicated to fix that.
 
Back
Top