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

    How to make Extra Armies do more stuff? (Patrol, Attack, etc.)

    Scheduled Pinned Locked Moved Mapping
    13 Posts 6 Posters 993 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.
    • UvesoU
      Uveso
      last edited by

      @VirusX

      you could look into the performance test map where many units are moved without aiBrain,
      see perftest_script.lua

      MrShadyM 1 Reply Last reply Reply Quote 0
      • Anachronism_A
        Anachronism_ @VirusX
        last edited by Anachronism_

        @virusx

        Here are some things you can use. You'll probably want to use IssuePatrol to multiple different locations btw. Note that you'll need to actually specify values or properly defined variables (ie: make a table of units rather than just writing TableOfUnits without setting that equal to something beforehand).

        IssuePatrol(TableOfUnits, {X, Y, Z})

        IssueMove(TableOfUnits, {X, Y, Z})

        Platoon = ArmyBrain:MakePlatoon('','')

        ArmyBrain:AssignUnitsToPlatoon(Platoon, TableOfUnits, 'Attack', 'None')

        Platoon:AggressiveMoveToLocation({X, Y, Z})

        You can look at my Tower Defense Survival map on the vault to see actual examples of some of these in use.

        pfp credit to gieb

        MrShadyM 1 Reply Last reply Reply Quote 1
        • DDDXD
          DDDX
          last edited by DDDX

          there's one other option.
          Place units on the map under a special group, then use:

          local HeavyAir = ScenarioUtils.CreateArmyGroupAsPlatoon('ARMY_SURVIVAL_ENEMY', 'GROUP_01', 'AttackFormation') HeavyAir:AggressiveMoveToLocation(ScenarioUtils.MarkerToPosition("SURVIVAL_CENTER_1"))

          This puts them in a platoon by default. You can time when they spawn via script, you decide where they spawn via placement on the map, and you can even add a wait+repeat so that they do this again and again (or only a certain number of times, or only while a certain building exists...)

          MrShadyM 2 Replies Last reply Reply Quote 0
          • MrShadyM
            MrShady @DDDX
            last edited by

            @dddx hey man this is virus from another acc. thx for advice,
            great survival maps btw!

            It was 10/10 soon as I saw text above the map written with terrain brush 😁

            gonna have to study your scripts 🙂

            do you have discord?

            1 Reply Last reply Reply Quote 0
            • MrShadyM
              MrShady @Anachronism_
              last edited by

              @penguin_ thx)

              1 Reply Last reply Reply Quote 0
              • MrShadyM
                MrShady @DDDX
                last edited by MrShady

                @dddx not sure what's wrong, maybe something to do with map type, cuz it's skirmish.

                when starting the game units dont spawn, however music plays.
                all unit names are named correctly

                blank marker in the center "SURVIVAL_CENTER_1"
                "ARMY_17" and "GROUP_101"

                local Air1 = ScenarioUtils.CreateArmyGroupAsPlatoon('ARMY_17','GROUP_101','AttackFormation')
                Air1:AggressiveMoveToLocation(ScenarioUtils.MarkerToPosition("SURVIVAL_CENTER_1"))

                edit yeah I dont think it's something to do with map type
                probably units spawn info missing
                +music and in-game time works, I can move cursor, no units are spawning though

                Do I maybe need to implement [if] [end] stuff?

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

                  @MrShady and @VirusX

                  2 accounts? - interesting.

                  Mostly if you script something and you got a gamestart that is "empty" then you should check the game.log for errors.

                  If you see a lot of errors, only worry about the first one. If you fix the first one, all subsequent errors may go away.

                  You can also post the "full" game.log here (use pastebin.com) and we can take a look at it.

                  MrShadyM 2 Replies Last reply Reply Quote 0
                  • MrShadyM
                    MrShady @Uveso
                    last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • MrShadyM
                      MrShady @Uveso
                      last edited by MrShady

                      @uveso
                      @Penguin_
                      @DDDX

                      Okay so com is spawning now, but I noticed that as soon as I rename selected group of units in the Map Editor anything other than 'INITIAL' (even without touching scripts) - they simply never spawn.

                      When I rename that group back to 'INITIAL' they can spawn.

                      I decided to address them as 'INITIAL' to patrol, but then they don't spawn again

                      I believe this group or even army 'ARMY_17' should be pre-defined earlier.
                      No idea how to do this though.

                      Sorry guys I'm not experienced with code at all.programming genius.JPG

                      Deleted function OnStart because it bugged me and now game starts and my units appear but they never move to the center...

                      1 Reply Last reply Reply Quote 0
                      • MrShadyM
                        MrShady @Uveso
                        last edited by

                        @uveso could you tell me where perftest_script.lua located?

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

                          @MrShady

                          i only know the location on the repository (Git-Hub):

                          https://github.com/FAForever/fa/tree/deploy/fafdevelop/testmaps/PerfTestOriginal

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