Fallout Tactics utility Fallout Tactics Scripting Engine (0.51a)

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

  1. Melindil

    Melindil First time out of the vault

    85
    Apr 15, 2018
    Did you install the game from GOG? That's the only reference I can find for 2.0.0.8 as a version.

    If the game is crashing that early, it's possible GOG (or another mod?) made some edits to the EXE that are incompatible with the edits FTSE makes. (Since the edits go down to machine code level, FTSE is sensitive to any EXE changes beyond those explicitly used in testing.)

    Has anyone else tried FTSE with the GOG version of FT? I unfortunately only have the original 1.27 and Steam versions to test with.

    In the meantime, I can look to see if I can add further safety checks in the internal patches applied at program start, and report a cleaner error if the EXE is not compatible. Or, if I can somehow get a copy of the GOG version of BOS.EXE, I can maybe figure out a way to get the FTSE functionality to work with both.
     
  2. Calimany

    Calimany First time out of the vault

    8
    Jul 21, 2020

    Yes is the GoG and it was brand new when crashed(had just instaled). I did tampered with the bos.exe since my brother made a very neat perk editor that is a dream. (unfortunately the perks that require tampering with the functions have to be made manual like you are doing, until i can figure out what is what in that hex nightmare)

    i will upload the file in any case. (that file has some modified perks).

    good to know that the steam version works.
     

    Attached Files:

    • BOS.zip
      File size:
      2 MB
      Views:
      55
  3. Melindil

    Melindil First time out of the vault

    85
    Apr 15, 2018
    Thanks. I checked the GOG version against mine, and except for the perk changes (which look OK), the files are identical. And running that EXE in my installation works as well. So that rules out a GOG version incompatibility.

    I'll think up a way to do further checking. Until then, there's a couple of other things to check:

    1. Is there a FTSE.log file in the game directory? If so, can you attach that as well?

    2. Does the FTSE version (0.50a) appear alongside the Fallout Tactics version at the main menu screen? The versions are displayed in white text at the bottom left.
     
  4. Calimany

    Calimany First time out of the vault

    8
    Jul 21, 2020
    Yes the version apear in the inferface as normal. I think it has something to do with Farsight...
    i gave her 2 itens a lot of xp and a few perks for testing reasons because is easier to skip the first mission to see the recruits and stuff. i will try puting her into her vanila form. Strange is the fact that it works as normal without the patch tough
     

    Attached Files:

    • FTSE.zip
      File size:
      633 bytes
      Views:
      67
  5. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    Was wondering how to implement combo weapons like an assault rifle with an underslung grenade launcher.
    Is there any way to make a script switch an equipped weapon, when an attack mode was selected?
    Say I have a specific weapon entity in one of the weapon slots, I select a specific attack mode; and the weapon is removed from that slot, and replaced with another weapon entity. Then being able to switch back to the first weapon entity the same way, and have it restored with the ammo variant, and number of rounds it was loaded with when removed.
     
  6. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    With FTSE 0.50, there is a way to apply bonuses to ITEMS HELD IN INVENTORY (not equipped)! Thanks A LOT Melindil.

    This is how you do it in "ftse.lua". In this example, the spanner is instantly giving the actor +5 to repair skill. The repair skill bonus is applied only once, regardless of the number of spanners the character has. Spanner in other characters inventories does not count. It uses a temporary variable stored in the entity's "Stat" perk to work.

    Code:
    function OnInventoryAdd (receiver, item, quantity)
      nom = item:GetName()
    --Spanner (stat)
    comp = receiver:GetAttribute("stat",ACTOR_TABLE_TEMPORARY)
      total = comp + quantity
      if nom == "Spanner" then
        if comp == 0 then
          bonus = { repair=5 }
          receiver:ApplyBonus(bonus,false)
        end
          receiver:SetAttribute("stat", ACTOR_TABLE_TEMPORARY, total)
      end
    end
    
    function OnInventoryRemove (source, item, quantity)
      nom = item:GetName()
      --Spanner
      comp = source:GetAttribute("stat",ACTOR_TABLE_TEMPORARY)
      total = comp - quantity
      if nom == "Spanner" then
        if total == 0 then
          bonus = { repair=5 }
          source:RemoveBonus(bonus,false)
        end
          source:SetAttribute("stat", ACTOR_TABLE_TEMPORARY, total)
      end
    end
    There might be easier ways to do this, but this is the way I found.
     
  7. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    Oh, sorry guys, I just saw with this the big problem showing at the horizon with this feature...

    Equipped items (2 primary slots and armors too) does not flag as being part of the inventory using this method. Soo, the bonus is lost when the item is equiped... Imagine you have a bonus with your spanner, but you want to use it to repair something if this is also usable as a toolkit. Then the bonus will be removed as soon as you place the item in one of your two primary slots. It can be partially solved by adding also a bonus in the item effect of being equipped (using entity editor), but then if you have another spanner in your inventory you will get two times the bonus.

    Melindil, is there a way in opinion to optain a similar function to detect items being equipped, or to consider them part of the inventory with an additional variable that serves as a boolean (equipped or not)? Thanks!
     
  8. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    Me again! Another topic in the meanwhile... Sorry if this is a lot to ask, version 0.50a really made me play with the game mechanics and getting closer to my goals! :D

    Regarding the QUEST LOG :
    I tried and tried the hookexecutor formula in OnStart(), OnLocaleLoad() and OnLongTick(e) to update an existing locale entry (holodisk and character sheets entries), even attempted to remove these entries in advance from the .txt to see if the game would use the one I created, but I was not able to get any result yet... Just nothing so far.

    Here is a preview of the feature I would like to implement to the game :

    upload_2020-9-30_15-41-52.jpeg

    You see this "TRAIT.S" entry there (that is only used as a general descrption), I would like to dynamically change that description to store all my quest datas, removing the smiley to give me more space. It will then serve as a Quest log that is directly imbeded into the character sheet (yeah!), and every character will be able to see that list as it is a general description entry. What do you think of this? The code would (if of course there is a way to make it work) look like that into the OnLongTick(e) hook.

    Code:
    SUPER_LIST_OF_QUESTS = whatever_I_have_in_mind
    hookexecutor:AddLocaleString("desc_otraits",SUPER_LIST_OF_QUESTS)
     
  9. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    I have tried adding bonuses to weapons on the entity editor, but this only seems to work with toolkits, or repair items.
    A function that adds bonuses to weapons or items (other than toolkits) that are equipped would be useful too.
     
  10. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    You are damn right about this. Only skill consumables (including lockpicks and medkits) and armors grant bonuses. Also, this would permit giving perks for equiped items and/or posessed items. This would look like this :

    Code:
      --Helmet (using hideOfScars as a temporary variable)
    
    -- Place in function OnInventoryAdd (receiver, item, quantity)
    
    comp = receiver:GetAttribute("hideOfScars",ACTOR_TABLE_TEMPORARY)
      total = comp + quantity
      if nom == "Casque" or nom == "Helmet" then
        if comp == 0 then
          bonus = { normalResist=5 }
          receiver:ApplyBonus(bonus,false)
         if receiver:GetAttribute("boneHead", ACTOR_TABLE_CURRENT) == 0 then
            receiver:SetAttribute("boneHead", ACTOR_TABLE_PERM, 1)
         end
        end
         receiver:SetAttribute("hideOfScars", ACTOR_TABLE_TEMPORARY, total)
      end
    
    -- Place in function OnInventoryRemove (source, item, quantity)
    
      comp = source:GetAttribute("hideOfScars",ACTOR_TABLE_TEMPORARY)
      total = comp - quantity
      if nom == "Casque" or nom == "Helmet" then
        if total == 0 then
          bonus = { normalResist=5 }
          source:RemoveBonus(bonus,false)
          source:SetAttribute("boneHead", ACTOR_TABLE_PERM, 0)
        end
          source:SetAttribute("hideOfScars", ACTOR_TABLE_TEMPORARY, total)
      end 
     
  11. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    That would be great. Make Night Vision Goggles give you the Night Vision perk.
     
  12. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    Got a couple of questions.
    Is it possible to add items directly into the weapon slots, rather than the inventory?
    Here is what I want to do: I want a specific weapon to be integral of an armour; so every time the armour is equipped, the weapon is added, and placed into a weapon slot. When the armour is unequipped, the weapon must be deleted. The condition should check the armour is equipped, and the weapon entity is not, to add the weapon.
    In the instance the weapon is moved to inventory (while armour is equipped), the weapon entity should be deleted. This would prevent the weapon from being placed on the ground, a container, given to another squad member, and being duplicated.
     
  13. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    This might be even more interesting using a vehicle with only 1 person slot, that would use a caracter sprite in place of a vehicle sprite. This way, it would simulate a kind of Power armor with a gun in which a caracter could climb in and out as will. As vehicles like tanks are already programmed to add a weapon, it could be easier to do this solution than programming a set of armor to add and remove an item. Still, the .exe would have to be slightly modified, as for now a weapon can only be added to a second passenger inside the vehicle, not a single driver.
     
  14. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    There's a few problems doing it that way. As you mentioned, the weapon is only added to the gunner; not the driver.
    Vehicle weapons are locked to use the same sound effect, and I don't know if you can add burst mode to the attacks.
    The armour I wan't to assign this function to, has the head exposed; the sprite I made is multilayered to adapt to the skin and hair colour of the user.
    Also the movement would just loop the walk animation on turn based mode.
     
  15. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    He you certainly know your shit. I relate to that, yep Tactics has a way to let you do something, but at the same time bring you to a bunch of dead ends at the same time :P And with this solution I didn't even thought about ladders and no-cars locations...
     
  16. Corpse

    Corpse Mildly Dipped

    554
    Apr 7, 2003
    lol... I had not even considered ladders and maps that don't allow vehicles.
    Anyway, these are some of the new units I have been working on. Imported the graphics from Crusader No Regret.
    The armour is the Draygan Mech suit.
    fbos0157.jpg
     
  17. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    Oh yeah amazing range of choice! I can clearly see why you need this improvement.
     
  18. Reinar

    Reinar First time out of the vault

    70
    Oct 23, 2011
    In case you return to FTSE, Melindil, here's a bug report :-? I am currently encountering probably the same bug as Calimany. The game crashes after loading a map (if I include a briefing, it crashes after clicking the start mission button). It does so only on a map I am currently working on for my mod. Other maps are ok. Also it's pretty inconsistent. Sometimes I can start the mission several times with no problem, then it crashes and crashes and crashes. First time it appeared yesterday. I spent like 30 minutes checking triggers and speech file, but then I run the New Occlusion Data function in editor and it worked. I thought it had something to do with all the tiles and stairs I added that evening.
    Today, I was working on the map again and testing some stuff. Running the mission frequently. Then I changed something in a speech file, run the game and crashes started again.

    Oh crap, an update. While writing this, I tried to start the original campaign and the game crashed 5 seconds after starting the mission, then again before the intro movie plays. After that, I could play my mission, then it crashes again. Tried loading my old saves from OC. Sometimes it's okay, sometimes it crashes. So yeah, no rule to that. Bugs like that are discovered only by going through the whole code in my experience.:aiee:I'd say it has something to do with memory though (the error in attached screenshot supports my guess). First load is okay, but when you run the same thing again, it pulls <something> from memory - or where it thought it's in the memory, but it's not there anymore (NullReferenceException, yay!).


    I did another test and I managed to find a pattern: Start the game, run custom mission -> crashes everytime. Start the game, start new campagin -> exit and run custom mission -> works everytime, until I close the game. This works in my mod though, as the original campaign crashes on first mission as well. I originally thought the culprit might be single player spawn when used in a standalone mission, where you have no main char to spawn. But then I would encounter the problem sooner.

    Once a windows error message appeared. I attached a screenshot of it.
    Every FTSE log looks like this (I tried disabling all the patches, but I was using some of them before):
    2020/11/05 19:16:09.532 FTSE version 0.50a started.
    2020/11/05 19:16:09.532 Detected parameter: exeName
    2020/11/05 19:16:09.532 Skipping patch Color character portraits
    2020/11/05 19:16:09.532 Skipping patch Encounter color fix
    2020/11/05 19:16:09.532 Skipping patch Fix Bonus H2H Damage perk
    2020/11/05 19:16:09.532 Skipping patch Fix melee and unarmed crit tables
    2020/11/05 19:16:09.532 Skipping patch High res patch
    2020/11/05 19:16:09.532 Skipping patch Music blocked fix
    2020/11/05 19:16:09.532 Skipping patch No starting inventory mod
    2020/11/05 19:16:09.532 Skipping patch Old burst bug fix
    2020/11/05 19:16:09.532 Skipping patch Sniper fix
    2020/11/05 19:16:09.532 Skipping patch Special encounter crash fix
    2020/11/05 19:16:09.532 Skipping patch Tag name fix
    2020/11/05 19:16:09.532 Skipping patch Team Player/Loner fix
    2020/11/05 19:16:09.532 Skipping patch doNightPerson fix
    2020/11/05 19:16:09.532 Successfully started LUA engine.
    2020/11/05 19:16:09.532 Installing a hook at address 0x57b4ed
    2020/11/05 19:16:09.532 Installing a hook at address 0x57cbb0
    2020/11/05 19:16:09.532 Installing a hook at address 0x731ba2
    2020/11/05 19:16:09.532 Installing a hook at address 0x67ee30
    2020/11/05 19:16:09.532 Installing a hook at address 0x6ad6a0
    2020/11/05 19:16:09.532 Installing a hook at address 0x6ada90
    2020/11/05 19:16:09.532 Installing a hook at address 0x64eec1
    2020/11/05 19:16:09.532 Installing a hook at address 0x614c3c
    2020/11/05 19:16:09.532 Installing a hook at address 0x61522f
    2020/11/05 19:16:09.532 Installing a hook at address 0x6146bb
    2020/11/05 19:16:09.532 Installing a hook at address 0x6158e2
    2020/11/05 19:16:09.532 Installing a hook at address 0x6133a7
    2020/11/05 19:16:09.532 Installing a hook at address 0x613a66
    2020/11/05 19:16:09.532 Installing a hook at address 0x613c5c
    2020/11/05 19:16:09.532 Installing a hook at address 0x617b2f
    2020/11/05 19:16:09.532 Installing a hook at address 0x615f0f
    2020/11/05 19:16:09.532 Installing a hook at address 0x61a620
    2020/11/05 19:16:09.532 Installing a hook at address 0x61b4bd
    2020/11/05 19:16:09.532 Installing a hook at address 0x61a986
    2020/11/05 19:16:09.532 Installing a hook at address 0x61b5c7
    2020/11/05 19:16:09.532 Installing a hook at address 0x612ead
    2020/11/05 19:16:09.532 Installing a hook at address 0x6131ca
    2020/11/05 19:16:09.532 Installing a hook at address 0x5552b0
    2020/11/05 19:16:09.532 Installing a hook at address 0x5ac21d
    2020/11/05 19:16:09.532 Installing a hook at address 0x58c2cd
    2020/11/05 19:16:09.532 Installing a hook at address 0x555553
    2020/11/05 19:16:09.532 Installing a hook at address 0x5ac45b
    2020/11/05 19:16:09.532 Installing a hook at address 0x58c507
    2020/11/05 19:16:09.532 Installing a hook at address 0x559013


    Howgh, one hour spent looking into it, although my mod doesn't require it. Now I am glad it doesn't depend on the new stuff FTSE adds. But I hope you return to it and fix it. And make FTSE great again. So a new era of some dead game Fallout Tactics modding may begin.
     

    Attached Files:

  19. Melindil

    Melindil First time out of the vault

    85
    Apr 15, 2018
    Hi everyone,

    Yes, I'm still alive. :) I've just had literally zero free time recently. Not sure how long this will persist, but I hope to get back to things soon.

    First thing I want to address when I get time is the crash issues reported above.

    Is there any way I could get a copy of the mod to use for testing? If I can find a way to reliably recreate the issue locally, I should be able to fix it quickly.

    I'll also try to address some of the questions from earlier in the thread below (if I missed someone's question, let me know):

    This is not yet possible, and will be a little bit tricky to implement. The Weapon entity type only has a single entity link for the loaded ammo (the linked entity also keeps track of the count). It would require having a way to save additional links to entities for the weapon loaded for the other weapon mode. It might be possible to reuse one of the other entity list types (best candidate would be the Effects entity list, but I can't remember off the top of my head if the Weapon type has that or not). Once that is possible, then it would be a matter of A) adding a trigger/hook for changing weapon mode, B) allowing the trigger function to change attributes of the weapon that aren't set by the mode, and C) provide a LUA function for Weapon class to swap the current ammo with one from the entity list.

    I've had ideas on how to make this easier to implement long-term. One thing that's missing is a way for scripts to add custom content to an entity, beyond those fields that the game already has. So far, we've been using the unused "temporary" attributes for perks, etc., because the game never does anything with these. If I can add a better way to store this custom info (and I have an idea I need to try), then I can actually change the equipment code to include all attributes (perks, traits, etc.) when item bonuses are added. If I did that, I'd probably also change perks that have stat bonuses to apply in that function, instead of the way it works today where only adding the perk from the "Add a perk" screen applies those bonuses. Would make scripting this stuff a lot easier.

    I'll play around with this - maybe the strings are getting cached somewhere and so not updating.

    Great idea! I see I missed adding calls to the equip and unequip vtable functions, so that gets you halfway there. And I can also add a hook to the unequip step, allowing the script to disallow unequipping - this would prevent exchanging the item with other characters or putting it in inventory or on the ground.
     
  20. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    539
    Mar 9, 2014
    Yeah all good news! That would help yess in regard to the variable storage, as at this point I might have used half the perks as variables already :P