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 Hidden Map Area

    Scheduled Pinned Locked Moved Modding & Tools
    2 Posts 2 Posters 242 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 way to get the hidden area information on maps that have areas blacked out? I'd like to prevent certain units from spawning where players cannot reach on maps with hidden areas.

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

        @Rama
        Hey Rama,
        It is possible to get the Information of the Hidden Area outside the Map
        Uveso has Show me an Way how to do that.
        I primary use it for several Spawn Mechanics of callable Reinforcements and the Airstrikes which are included in my Commander Survival Kit.
        So maybe it could help you for what you want.
        But you will probably need to modify the Code for your purposes.

        GetPlayableArea:
        This Function checks for the existence of an playable rectangle (area) on the map.
        If one exists it returns the playable rectangle (area)
        If not it simple returns the size of the map

        GetNearestPlayablePoint
        This Function checks whether the given unit position is outside the playable rechtangle (area)..
        If the Unit is located outside the Map it returns a new generated Vector inside the Playable Area
        If Not it doesn't return anything.
        The included Check for ScenarioInfo.type == 'skirmish' is optional
        So If you want to use the Code for specific Game Modes only you can use the Check.
        For example: Campaign, Skirmish or anything else.

        If you have any additional Questions related to this.
        I still have Contact with Uveso on Discord to pass them on to him.

        GetPlayableArea = function()
            if ScenarioInfo.MapData.PlayableRect then
                return ScenarioInfo.MapData.PlayableRect
            end
            return {0, 0, ScenarioInfo.size[1], ScenarioInfo.size[2]}
        end,
        
        GetNearestPlayablePoint = function(self,position)
        
            local px, _, pz = unpack(position)
        	
        if ScenarioInfo.type == 'skirmish' then
        local playableArea = self.GetPlayableArea()
        
            -- keep track whether the point is actually outside the map
            local isOutside = false
        
            if px < playableArea[1] then
                isOutside = true
                px = playableArea[1] + 1
            elseif px > playableArea[3] then
                isOutside = true
                px = playableArea[3] - 1
            end
        
            if pz < playableArea[2] then
                isOutside = true
                pz = playableArea[2] + 1
            elseif pz > playableArea[4] then
                isOutside = true
                pz = playableArea[4] - 1
            end
        
            -- if it really is outside the map then we allocate a new vector
            if isOutside then
                return {
                    px, 
                    GetTerrainHeight(px, pz),
                    pz
                }
        
            end
        end
        end,
        
        

        Best regards
        CDRMV

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