Fallout Tactics Scripting Engine (0.32a)

Discussion in 'Fallout Tactics Modding' started by Melindil, Jul 3, 2018.

  1. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    Project page (GitHub): https://github.com/melindil/FTSE
    Download link (current): https://github.com/melindil/FTSE/blob/master/Release/FTSE_0.32a.zip

    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
    Download the latest .ZIP release from the Release directory, and uncompress. Included is an installer EXE file - running this will prompt for the location of the Fallout Tactics EXE file. After selecting the EXE, the installer will patch it to load the included DLL at startup. 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). Should this check fail, the EXE will not be modified. After installation, double-check that the FTSE.DLL, FTSE-Config.json, and FTSE.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.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: Nov 16, 2018
    • [Like] [Like] x 2
    • [Rad] [Rad] x 1
  2. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    Mar 9, 2014
    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.
     
    • [Rad] [Rad] x 1
  3. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    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: Jul 11, 2018
    • [Rad] [Rad] x 1
  4. Corpse

    Corpse Mildly Dipped

    Apr 7, 2003
    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.
     
    • [Like] [Like] x 1
  5. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    Mar 9, 2014
    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.

    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.

    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...
     
  6. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    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.
     
    • [Like] [Like] x 1
  7. Corpse

    Corpse Mildly Dipped

    Apr 7, 2003
    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.
     
  8. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    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.)
     
  9. Corpse

    Corpse Mildly Dipped

    Apr 7, 2003
    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: Jul 28, 2018
    • [Like] [Like] x 1
  10. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    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.
     
    • [Rad] [Rad] x 1
  11. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    Mar 9, 2014
    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!
     
  12. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    Mar 9, 2014
    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
     
  13. Ox-Skull

    Ox-Skull First time out of the vault
    Modder

    Mar 3, 2012
    Awesome work melindil, definitely checking this out.
     
  14. DDTerr

    DDTerr First time out of the vault

    Feb 2, 2014
    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."
     
    • [Rad] [Rad] x 1
  15. Melindil

    Melindil First time out of the vault

    Apr 15, 2018
    Thanks. I've added these to my engine bug thread, so that I don't lose track of them. I'll be addressing these as I work at researching each area.
     
  16. Risewild

    Risewild Half-way Through My Half-life
    Modder Orderite

    Jun 14, 2014
    @TorontRayne will probably be interested in this thread. Since I think he wanted to do some Fallout Tactics projects or modding or something.
     
    • [Rad] [Rad] x 1
  17. DDTerr

    DDTerr First time out of the vault

    Feb 2, 2014
    OK, I will add more of them there.
     
  18. TorontRayne

    TorontRayne This ghoul has seen it all
    Staff Member Moderator Orderite

    Apr 1, 2005
    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.
     
    • [Rad] [Rad] x 1
  19. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    Mar 9, 2014
    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.
     
    • [Rad] [Rad] x 1
  20. DDTerr

    DDTerr First time out of the vault

    Feb 2, 2014
    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.
     
    • [Rad] [Rad] x 1