Fallout Tactics utility Fallout Tactics Scripting Engine (0.50a)

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

  1. Corpse

    Corpse Mildly Dipped

    547
    Apr 7, 2003
    That would be a great idea. It would be great to have items you can use to trigger scripts as in the old Fallout, and Fallout 2.

    Another great addition would be a function to advance time by minutes, hours, days, etc.
     
  2. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    Another problem I experienced using FTSE Melindil: When I add accents "éàù..." using world:CombatLog, it does not display the message at all. Took me a while to figure that out, but yeah, I'm happy I found the problem. Is there an alternative here I could use? Maybe a locale string could do the trick?
     
  3. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    Okay, a last thing, after that I'll let you some time to catch up he.

    I created a script that allow me to detect some specific types of food being eaten, basically by checking the char different resistances. For example, meat give a temporary 1 min. 500 fire resist for me to detect in the LUA code. I don't mind if this is game breaking as long at it is a hidden bonus.

    Using LUA code after, I give or remove specific perks based on what is consumed. Eating human flesh for example will give the "cannibal" perk, a true classic.

    My problem is with displaying this in the form of a log entry. It works allright, but the message is duplicated dozen, maybe hundreds of time and I don't know why. Could there be a way to make sure this script is only applied ONCE?

    Thanks in advance! Here is my code :

    Code:
    --Manger de la viande humaine, CANNIBALE!
      if p:GetAttribute("explodeResist", ACTOR_TABLE_CURRENT) >= 300 and p:GetAttribute("masterThief", ACTOR_TABLE_CURRENT) == 0 then
          p:SetAttribute("masterThief", ACTOR_TABLE_PERM, 1)
          if world:GetCampaignVar("Francais") == "non" then
            p:DisplayMessage("<Cr>And what other choice did I have, eh?<C->")
            world:CombatLog(COMBATLOG_FEW, "<Cr>You ate human flesh, you really did it. And do not feel particularily good about it either<C->")
          else
            p:DisplayMessage("<Cr>Et quel autre choix j'avais, hein?<C->")
            world:CombatLog(COMBATLOG_FEW, "<Cr>Vous mangez de la chair humaine, vous le faites vraiment. Et vous ne vous sentez pas tant bien avec ce geste non plus<C->")
          end
      end
     
  4. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
    All,

    Apologies for the long delay - I've had a very hard time finding any free time to work on FTSE. The good news is, the past few days, I've had time to finish what I wanted to add to 0.50a. So it's now available from the links on the first post. As always, treat the initial release as somewhat experimental (e.g. keep multiple save files in case something breaks) until it's had a chance to run for a while.

    Full changelog is in the first post of this thread. Major changes are the inclusion of all (known) entity types and functions to access type-specific values from LUA scripts, inventory manipulation and change detection, and (still experimental) support for creating entities from the LUA script. The create entity functionality should currently only be used to generate objects to place in an inventory - there's no facility to place an item within a level yet.

    My next task will be to post documentation for the LUA APIs, since I expect them to be more stable now that all entities are covered. There will be one more breaking change coming fairly soon - a replacement for the current practice of using the temporary attribute values of perks to store information from the scripts. I have an idea for a more robust and flexible way to handle this, which will also allow me to patch the ApplyBonus and RemoveBonus to add and remove perks on a temporary basis (this will also allow equipped items to have perk bonuses assigned).

    I'll also be answering some of the messages I've missed along the way.
     
  5. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
    This is a great idea. I'll need to check to see if manipulating the weapon settings will work correctly - from the way the code uses them, I think they will. Unfortunately, I don't yet know if I can change enough in the Ammo entity type to make the new parameters visible in the editor - so it may be a Lua-only feature. But otherwise, I think it is very possible to get this to work.

    There's a way to do it, but it's a little bit of a manual process. The FTSEInstaller.exe in the Github repo can still apply the patch to the BOS.EXE file - you'd then need to copy over the .DLL and config files manually. If that fails, I can also provide hex changes to modify BOS.EXE directly.

    This one is already on my to-do list, actually. I want to add a trigger/hook for when any item is used (double-clicked or used from inventory). This could allow custom behavior for anything, not just the remote trigger.

    Question: When you save the FTSE.lua file, do you know what character encoding it is using? FTSE currently expects all strings coming from LUA to be in UTF-8 encoding; it will convert to UTF-16/UCS-2 as necessary.

    From your description, it sounds like you've added this in the OnLongTick hook. This hook is called for all entities on a periodic basis, so it's possible that, if you use world:GetPlayer to get the player entity, and do the check without validating that the entity object passed to OnLongTick is actually the player, the script may end up being applied to the player once for every entity in the level. (Note that there is a delay between setting an attribute in PERM and when it is finally reflected in CURRENT, so multiple entities triggering close together may still fire off the log message multiple times even if the PERM value for the perk is set.) If this is the case, you'll want to add something similar to the below to the start of that script:

    Code:
    function OnLongTick(ent)
        if ent["id"]==world:GetPlayer()["id"] then
            -- your code here
        end
    end
    If that still doesn't work, I can take a look at the full script, to see if I see any issue. I also have checking the calculations for PERM to CURRENT on my list.
     
  6. JohnnyCasey

    JohnnyCasey First time out of the vault

    55
    Dec 13, 2018
    Checked the latest FTSE, still don't have any description regarding this. Is there any reason why?
     
  7. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
    I'll include details on the existing patches, plus any discoveries inside the BOS code, with the documentation. No ETA on when it'll be done, but it's the next item to work on.
     
  8. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    Hiho,

    I really can't try these new features now hehe because I'll spend days and days modifying items and playing around the possibilities! Amazing new update, you have my thanks!

    2/2 for the problems I had too...

    Accents : I checked the file encoding and it was in ANSI. I reverted it to UTF-8 and it worked thanks! Because of .txt file specifications I guess, I normally put every .txt file in ANSI because other encoding are turning the accents to goo.

    Duplicated log message : Again, that worked. Thanks!

    As soon as I can experiment with the new engine, I'll give you a full report.
     
  9. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
  10. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    Good job here! I was awaiting that. :D

    Please tell me, with the new engine codes and stuff, can we actually use them to heal the main character? Let's say after a chat with a doctor? I pretty sure we can use it to remove temporary poison points, but as for healing I am not sure.

    Hugo
     
  11. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
    Healing and damage I don't have working yet. I did an experiment with manipulating the current HP of actors, and it caused odd issues when the actor was killed. Once I find the in-game code to do damage and healing, I can add functions to call them. Hopefully, if it's a C++ vtable function, I can add the functions to the Entity class, and they'll apply to everything (vehicles, breakable objects, etc.).
     
  12. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    Wonderful. I'll wait for some updates about that, but for me this is really not an urgent feature to work on. I am way more interested at this point in a way to invent some kind of quest log. What can you tell me about the possibility to update :

    1. An item description in items.txt for it to show active quests
    2. A locale holotape log in generic_mission.txt for it to show actives quests on double click
    3. Any other locale entry in generic_mission.txt, allowing for a world text to be shown

    Could any of these be done eventually?
     
  13. Melindil

    Melindil First time out of the vault

    75
    Apr 15, 2018
    The quickest way to do something like this would be to use a Holotape object with a defined locale string, that is then updated as quests update.

    The hookexecutor:AddLocaleString can be used from Lua to edit the text for a locale-defined string. (See the Hulk Smash example for how I used this to get the perk name and description in the game without editing the .text files.) One thing I haven't tried is to call this from outside of OnLocaleLoad - if that works, then the current FTSE can be used to update the holotape text. If not, I can probably add a function to the Holotape entity to update its text, and hold the contents in FTSE memory so that the game just needs a pointer into that.
     
  14. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    492
    Mar 9, 2014
    I... think I tried that function as I know it from your example, but I need to make a new test to really make sure it did not work for me. I remember trying this in OnLongTick with no success, but he, let me try it again and I'll come back to you with more solid proof.