Forged Alliance Forever Forged Alliance Forever Forums 2019-01-31T19:47:39+02:00 /feed.php?f=2&t=17153 2019-01-31T19:47:39+02:00 2019-01-31T19:47:39+02:00 /viewtopic.php?t=17153&p=171512#p171512 <![CDATA[Re: Regen in game different from blueprint]]>
You need a hook for the unitclass.

Create a file in your mod/hook folder:
Code:
\Mods\YOURMODNAME\hook\lua\sim\Unit.lua


Then copy & paste this into the Unit.lua file:

Code:
-- Save/store the original Unit class
local OldUnit = Unit
-- create a new unitclass with the same name (overwrite the original) and use as base the OldUnit class
Unit = Class(OldUnit) {

    -- This overwrites the original CreateVeterancyBuffs function
    CreateVeterancyBuffs = function(self, level)
        local healthBuffName = 'VeterancyMaxHealth' .. level -- Currently there is no difference between units, therefore no need for unique buffs
        local regenBuffName = self:GetUnitId() .. 'VeterancyRegen' .. level -- Generate a buff based on the unitId - eg. uel0001VeterancyRegen3

        if not Buffs[regenBuffName] then
            -- Maps self.techCategory to a number so we can do math on it for naval units
            local techLevels = {
                TECH1 = 1,
                TECH2 = 2,
                TECH3 = 3,
                COMMAND = 3,
                SUBCOMMANDER = 4,
                EXPERIMENTAL = 5,
            }
           
            local techLevel = techLevels[self.techCategory] or 1
           
            -- Treat naval units as one level higher
            if techLevel < 4 and EntityCategoryContains(categories.NAVAL, self) then
                techLevel = techLevel + 1
            end
           
            -- Regen values by tech level and veterancy level
            local regenBuffs = {
                {1,  2,  3,  4,  5}, -- T1
                {3,  6,  9,  12, 15}, -- T2
                {6,  12, 18, 24, 30}, -- T3 / ACU
                {9,  18, 27, 36, 45}, -- SACU
                {25, 50, 75, 100,125}, -- Experimental
            }
       
            BuffBlueprint {
                Name = regenBuffName,
                DisplayName = regenBuffName,
                BuffType = 'VeterancyRegen',
                Stacks = 'REPLACE',
                Duration = -1,
                Affects = {
                    Regen = {
                        Add = regenBuffs[techLevel][level],
                    },
                },
            }
        end
       
        return {regenBuffName, healthBuffName}
    end,

}


Now you can play around with it.

Statistics: Posted by Uveso — 31 Jan 2019, 19:47


]]>
2019-01-31T19:28:00+02:00 2019-01-31T19:28:00+02:00 /viewtopic.php?t=17153&p=171509#p171509 <![CDATA[Re: Regen in game different from blueprint]]> local regenBuffs = {
}

I remember long ago someone was saying on a youtube video that Cybran ACU was balanced ok because it had more regen... I guess not.

Statistics: Posted by Evildrew — 31 Jan 2019, 19:28


]]>
2019-01-31T19:00:38+02:00 2019-01-31T19:00:38+02:00 /viewtopic.php?t=17153&p=171508#p171508 <![CDATA[Re: Regen in game different from blueprint]]>
i am not sure in this case!

But the veteran system was changed and those tables are a left over from the old system.

Actual the veteran level and regen is calculated hardcoded inside unit.lua script:
https://github.com/FAForever/fa/blob/develop/lua/sim/Unit.lua#L1445

Statistics: Posted by Uveso — 31 Jan 2019, 19:00


]]>
2019-01-31T17:36:35+02:00 2019-01-31T17:36:35+02:00 /viewtopic.php?t=17153&p=171504#p171504 <![CDATA[Regen in game different from blueprint]]>
Buffs = {
Regen = {

Anyone know why that is or if it can be fixed?

Statistics: Posted by Evildrew — 31 Jan 2019, 17:36


]]>