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

    Seeking Help to Develop a Mod: Adjusting Commander Collision Properties

    Scheduled Pinned Locked Moved I need help
    6 Posts 4 Posters 257 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.
    • R
      Raysor
      last edited by

      Hello everyone,

      I’m reaching out to ask for help with a mod I’m currently developing for Supreme Commander: Forged Alliance. The goal of this mod is to adjust the collision properties of the commanders for each faction.

      The main idea behind this change is to address a specific frustration I’ve encountered during gameplay: the commander often gets overwhelmed by units in the base, making it difficult to move effectively. By tweaking the collision properties, I hope to create a smoother experience where the commander can navigate better without feeling bullied by every single unit around.

      This is my first time tackling a mod of this kind, so I’m looking for guidance on how to approach these changes and ensure they integrate naturally into the game. Any advice, pointers, or resources you can share would be greatly appreciated, thank you!

      1 Reply Last reply Reply Quote 1
      • UvesoU
        Uveso
        last edited by

        First of all, press [CTRL] + [SHIFT] + [ALT] + C to display the hitboxes in-game.

        You have two options to change the hitboxes of a unit.

        First of all, you can copy the entire blueprint into your mod and modify the relevant lines, such as SizeX, SizeY, and SizeZ.
        However, this approach has the disadvantage that you will need to update the blueprints with every ACU patch.

        A better option is to use a ModBlueprints function in Blueprints.lua.
        Here’s an example of a ModBlueprints function:
        https://github.com/Uveso/AI-Uveso/blob/master/hook/lua/system/Blueprints.lua

        a function to change the hitbox could look like this:

            -- save the actual ModBlueprints into OldModBlueprints
            local OldModBlueprints = ModBlueprints
            -- by creating a funktion with the same name we overwrite the original ModBlueprints
            function ModBlueprints(all_blueprints)
                -- execute the original function to not break other mods
                OldModBlueprints(all_blueprints)
                -- loop over all blueprints
                for id,bp in all_blueprints.Unit do
                    check if we have an commander
                    if table.find(bp.Categories, 'COMMANDER') then
                        change the hitbox
                        bp.SizeX = 1
                        bp.SizeY = 1
                        bp.SizeZ = 1
                    end
                end
            end
        

        i hope this helps a bit.

        R 1 Reply Last reply Reply Quote 4
        • CaliberC
          Caliber
          last edited by Caliber

          @Uveso

          I have been playing around with my own mods for a few years now and I never knew about being able to display the hitbox like this thats sooooo useful, are there any more interesing functions like this?

          1 Reply Last reply Reply Quote 0
          • R
            Raysor @Uveso
            last edited by

            @Uveso
            Thank you so much for your help, I really appreciate it! I just have one question: if we change the hitbox, will it also affect the interaction with projectiles? I’m concerned it might cause issues and make the commander untouchable, which I definitely want to avoid.

            1 Reply Last reply Reply Quote 1
            • UvesoU
              Uveso
              last edited by

              The hitbox also applies to projectiles.
              I encountered an issue in Black Ops where the hitbox was too small:
              https://github.com/Uveso/BlackOpsFAF-ACUs/pull/7
              Make the hitbox the same size for every ACU to avoid complaints. Also, ensure it's not too small; otherwise, the commander can only be hit with area damage.

              Oh, and when you're in the game, press [F1] to open the key bindings. Under the 'Debug' section, you can see all functions and their assigned keys.

              1 Reply Last reply Reply Quote 1
              • N
                Nomander
                last edited by

                You can hack around the issue with projectiles by setting the ACU's hitbox to very small so that it paths around units a bit better, and then creating an entity attached to the commander with a hitbox. Then you can override the new entity's OnCollisionCheck, OnCollisionCheckWeapon, and OnDamage functions with the ACU's versions.

                There is an example of creating an entity attached to a unit in the Aeon T2 Torpedo Launcher script. I don't have an example of an entity with a hitbox passing damage to the base unit, although I know it's possible since giving props projectile collision was an experiment we did.

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