FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    Get Playable Area of Map

    Scheduled Pinned Locked Moved Modding & Tools
    5 Posts 3 Posters 119 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 Offline
      Rama
      last edited by

      Is there a function to get the playable area of a map? I've looked before, but never found one.

      Would like to keep Support Bases from spawning in non-playable sections of maps, where players can't reach them.

      1 Reply Last reply Reply Quote 0
      • C Offline
        CDRMV
        last edited by CDRMV

        @rama
        I use this Function below in my Mods several times.
        Mostly for my callable Reinforcements and Air Strikes.

        
        function GetPlayableArea()
            if ScenarioInfo.MapData.PlayableRect then
                return ScenarioInfo.MapData.PlayableRect
            end
            return {0, 0, ScenarioInfo.size[1], ScenarioInfo.size[2]}
        end
        
        1 Reply Last reply Reply Quote 2
        • R Offline
          Rama
          last edited by

          Awesome! Much appreciated.

          1 Reply Last reply Reply Quote 0
          • N Offline
            Nomander Balance Team
            last edited by

            For anyone working on the UI side you can get the playable area with SessionGetScenarioInfo().PlayableRect. There is also a user sync event with the key NewPlayableArea when the sim updates the playable area.
            Though this was added in March 2024 so you have to fall back to size[1] and size[2] for old replays.

            1 Reply Last reply Reply Quote 0
            • R Offline
              Rama
              last edited by

              Oh my god...

              I didn't realize I needed to copy the entire function CDRMV provided. I thought it was a built-in function like GetMapSize().

              When it didn't work, I headed over to Github to look at more examples. Of course, they all used getPlayableArea(), which I copied.

              Then, it finally occurred to me CDRMV meant for me to copy the entire function. Except, I forgot I'd switch my syntax to getPlayableArea(). Only took an hour of troubleshooting to see it.

              1 Reply Last reply Reply Quote 1

              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
              • First post
                Last post