Scripting
-
how to create a function to multiply by 3 the max health of all units of a certain army?
-
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 -
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
-
Okie but I will still be waiting for response
-
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login