FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login

    Scripting

    Scheduled Pinned Locked Moved I need help
    5 Posts 3 Posters 449 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      GeneralJenson
      last edited by

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

      1 Reply Last reply Reply Quote 0
      • G
        GeneralJenson
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • RoweyR
          Rowey
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • G
            GeneralJenson
            last edited by

            Okie but I will still be waiting for response

            1 Reply Last reply Reply Quote 0
            • S
              Sprouto
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post