Broken Night person trait

Discussion in 'Fallout Tactics Modding' started by nadeauhugo, Jun 15, 2018.

  1. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    503
    Mar 9, 2014
    In all those years, or with today's imagination and hack skills ;), does anyone came/can come up with a solution for the broken Night person trait? I received a suggestion to change it in my mod, but besides not using it at all, I don't know what to do. I don't mind having it fixes, I kind of like the idea of it.

    But it could also be replaced by a totally new trait. In the case of my mod, I'm thinking about something like this : Resilient = "You can improvise meals anywere. You don't have to search for food, (100% radiation resistance) but you have -2 constitution."
     
  2. Melindil

    Melindil First time out of the vault

    79
    Apr 15, 2018
    I'd need to poke a bit into how exactly the Night Person bonus is applied. I seem to remember the behavior being something like:
    1) At character creation, character with the trait gets -1 to permanent PE and IN
    2) When character is in the dark, they gain +2 to permanent PE and IN (canceling out the -1, leaving a +1 bonus)
    3) I think #2 is tied to the "doNightPerson" internal trait flag, this is what I need to check
    4) When back to daytime, the doNightPerson flag isn't reset, leaving the bonus on the character permanently
    5) I've seen mention that NPCs don't properly receive the bonus, so this also needs to be checked

    Assuming the above is correct, there are a few possible ways to fix:
    1) See if there is already any code that turns off the doNightPerson flag, and figure out why it isn't called, and apply a hex edit to fix
    2) Add a hex edit to one of the timer routines to perform this check
    3) Use FOTExtender + Lua code to check the current time (day/night), and on any transition adjust the flags for all actors appropriately.
     
  3. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    503
    Mar 9, 2014
    He what is Lua code? I guess if this is feasible with FOTEXtender, we should simple wait until that is available then. Why not. From the moment the problem is solvable, I'm good with it! Thanks for your timely intervention like always. Yes! :D
     
  4. Imagination Engineer

    Imagination Engineer First time out of the vault

    11
    Jun 14, 2018
    Looks like a trait designed with Nightkin mutants in mind..
     
  5. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    503
    Mar 9, 2014
    Yeah.... oh, that gives me an idea... A thing that could be even more interesting I think for Fallout related mods would be a trait reflecting years and years of confinement. Something like : "Years of life underground has seriously altered your internal clock. You sleep less often and you're healing rate is reduced, but you can concentrate for hours on solving problems (+1 INT)". Something like that...
     
  6. Gizmojunk

    Gizmojunk Half-way Through My Half-life

    Nov 26, 2007
    ...To eat things, that would make a billy-goat puke!
     
  7. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    503
    Mar 9, 2014
    Hi!

    As Melindil created a Night person perk as an example and as his hex patch (if I'm correct) didn't solved the broken trait, I decided I'd get a run for it and try to solve it. And I did! For those of you who have Melindil Scripting Engine, here is my solution in LUA code :

    Code:
    --NIGHT PERSON (PATCH)
      if e:GetAttribute("nightPerson", ACTOR_TABLE_CURRENT) == 1 then
        -- use perk entry in temporary table to save info about
        curr = e:GetAttribute("fortuneFinder", ACTOR_TABLE_TEMPORARY)
        now = world:GetTime()
        if now["hour"] < 7 or now["hour"] > 18 then
          -- night time
          if curr == 0 then
            bonus = { perception=2, intelligence=2 }
            e:ApplyBonus(bonus,false)
            e:SetAttribute("fortuneFinder", ACTOR_TABLE_TEMPORARY, 1)
          end
        else
          -- day time
          if curr == 1 then
            bonus = { perception=2, intelligence=2 }
            e:RemoveBonus(bonus,false)
            e:SetAttribute("fortuneFinder", ACTOR_TABLE_TEMPORARY, 0)
          end
        end
      end
    What it does is to add a temporary +2 IN and PE after 6 PM and before 6 AM. In game, it shows as blue when it is night time (bonus), but not red when it is day time. This is because the engine first apply a permanent -1 IN and PE, so it does not appear red. I liked it that way to I decided to keep it like that.
     
    • [Rad] [Rad] x 1
  8. Melindil

    Melindil First time out of the vault

    79
    Apr 15, 2018
    The above looks like it will work. The one possible missing case is if the game actually does apply the Night Person trait (I've seen cases where it does, then leaves it on permanently). In that case, the bonus will end up being +1/+1 during the day, and +3/+3 at night.

    Once I can find and remove the existing broken +2/+2 from the trait, I'll add the above fix to the base LUA so that it's on by default.
     
    • [Rad] [Rad] x 1
  9. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    503
    Mar 9, 2014
    Awsome! :D