Scripting

0

how to create a function to multiply by 3 the max health of all units of a certain army?

0

Is this appropriate:

function Armybuffed(army)
local Brain = GetArmyBrain(army)
while (not Brain or Brain:IsDefeated() or not units or table.getn(units) < 1) do
for id, bp in Brain.Unit do
if type(bp.Defense.Health) == 'number' then
bp.Defense.Health = bp.Defense.Health * 3
end
if type(bp.Defense.MaxHealth) == 'number' then
bp.Defense.MaxHealth = bp.Defense.MaxHealth * 3
end
if type(bp.Defense.Shield.ShieldMaxHealth) == 'number' then
bp.Defense.Shield.ShieldMaxHealth = bp.Defense.Shield.ShieldMaxHealth * 3
end
end
end
end

0

The Best Place to get a Fast response would be in the FAF Discord and assigning yourself the modding role. it a lot more active and more people will see what your asking

"The needs of the many outweigh the needs of the few" - Spock

0

Okie but I will still be waiting for response

0

The only way to modify units, of one army, is thru a buff applied to every unit - of that army - as they are created.

While blueprint modifications are easy work - they cannot be applied only to a single army - since, at the time blueprints are loaded, the armies don't exist - AND - blueprints are universal to all players - and unchangeable once the game session actually begins.

For example, the AI uses buffs to give it's units bonuses, much in the way you are suggesting. This work is done at the point of unit creation, and it identifies if that army is an AI army or not. Obviously, you would need to modify this particular logic to provide a path for your buffs to be run on a specific army, human or AI.