OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Meridian on October 31, 2019, 12:27:56 pm

Title: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: Meridian on October 31, 2019, 12:27:56 pm
You can now use globe texture/terrain in maps for mission sites and alien bases.
(until now this was possible only for ufo crash/landing sites)

Code: [Select]
    - type: addBlock
      terrain: globeTerrain           # add a block from a (random) terrain defined on the globe texture at craft landing coordinates

Example for xcom1 terror mission map script:

Code: [Select]
mapScripts:
  - type: URBAN
    commands:
    - type: addCraft
    - type: addBlock
      terrain: POLAR                  # add a block from POLAR terrain
    - type: addBlock
      terrain: globeTerrain           # add a block from a (random) terrain defined on the globe texture at craft landing coordinates
    - type: addLine
      label: 1
      direction: vertical
      executionChances: 50
      rects:
        - [1, 1, 4, 1]
    - type: addLine
      label: 2
      conditionals: -1
      executionChances: 50
      direction: horizontal
      rects:
        - [1, 1, 1, 4]
    - type: addLine
      conditionals: [-1, -2]
      direction: both
      rects:
        - [1, 1, 4, 4]
    - type: addBlock
      size: 2
      executions: 4
    - type: fillArea
      # URBAN set is lacking blocks 10-13, so the numbers don't correlate properly here,
      # because these are references to the block numbers within the sets, not the file names.
      blocks: [3, 4, 10, 11, 12, 13, 14]
      freqs: [3, 3, 2, 2, 2, 2, 2]

Example for xcom1 alien base map script:

Code: [Select]
mapScripts:
  - type: ALIENBASE
    commands:
    - type: addBlock
      terrain: POLAR                  # add a block from POLAR terrain
    - type: addBlock
      terrain: globeTerrain           # add a block from a (random) terrain defined on the globe texture at craft landing coordinates
    - type: addBlock
      groups: 2
      executions: 2
    - type: addBlock
      size: 2
      groups: 3
    - type: addBlock
      size: 2
      executions: 3
    - type: fillArea
      groups: [0, 1]
      freqs: [3, 2]
    - type: digTunnel
      direction: both
      tunnelData:
        level: 0
        MCDReplacements:
          - type: westWall
            set: 2
            entry: 18
          - type: northWall
            set: 2
            entry: 17
          - type: corner
            set: 2
            entry: 19
          - type: floor
            set: 1
            entry: 63

It is possible to use globe texture/terrain also for xcom base defense missions, the syntax is a little bit different, explained here: https://openxcom.org/forum/index.php/topic,5108.0.html
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: wcho035 on November 01, 2019, 11:29:47 am
Hi Meridian, I want to thank you sincerely for this brilliant addition to the OXCE. I have tested the feature thoroughly tonight.  I confirmed the feature works like a dream. the default terrain from the map script switch to the terrain at where the Craft has landed.

However, it is not doing the terrain switch like from land to sea, like UFO crashsite is doing. Like the base is build on a sea texture, it is not switching to the _underwater alien deployment.

Is there a way for this new feature to handle this?  Here are a few screen shot.

Test1 is the underwater core base plug in for my aliendeployment with  _underwater extension.

Test2 is my mod with the location of the random spawn enemy humanbase.

Test3 is the battlescape mission, it uses the land core base plug into the sea terrain. Not switching to the aliendeployment with the _underwater extension.
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: ohartenstein23 on November 01, 2019, 01:30:55 pm
Of course it doesn't do that, this is just a feature for mapScrips, not for alienDeployments. Like I said in your suggestion thread earlier, even if you got this feature, you'd still have to make separate underwater and above water alienMissions for anything that spawned an alien base or mission site. It's just much less work to do this now that you don't also need a separate mission for every texture, like XCF's cult missions.
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: Solarius Scorch on November 01, 2019, 06:14:37 pm
Of course it doesn't do that, this is just a feature for mapScrips, not for alienDeployments. Like I said in your suggestion thread earlier, even if you got this feature, you'd still have to make separate underwater and above water alienMissions for anything that spawned an alien base or mission site. It's just much less work to do this now that you don't also need a separate mission for every texture, like XCF's cult missions.

How would this feature work with such missions in XCF? Add "terrain: globeTerrain" to all the blocks? What about landing blocks (under the X-Com craft and the structure like a cult house)?
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: ohartenstein23 on November 01, 2019, 07:10:34 pm
How would this feature work with such missions in XCF? Add "terrain: globeTerrain" to all the blocks? What about landing blocks (under the X-Com craft and the structure like a cult house)?

Yes, you'd need to add "terrain: globeTerrain" to every mapScript command, including addUFO and addCraft. Crafts/UFOs will be handled as if the globeTerrain were a normal terrain, just picking the LZ groups from that terrain.

If your structure isn't placed by an addUFO command, then you would need verticalLevels and special "LZ" blocks to match the size of the structure:

Code: [Select]
terrains:
  - name: SOME_NORMAL_TERRAIN_LIKE_CULTA
    mapBlocks:
    # *** not copying the entire terrain here, just adding the following blocks ***
      - name: CULTA_VERTICAL_LEVELS_LZ_20x20
        width: 20
        length: 20
        groups: 1 # adding to LZ, shouldn't be used by addCraft/UFO since it's not 10x10

      - name: CULTA_VERTICAL_LEVELS_LZ_30x30
        width: 30
        length: 30
        groups: 1 # adding to LZ, shouldn't be used by addCraft/UFO since it's not 10x10

mapScripts:
  - type: SOME_CULT_HOUSE_MISSION
    commands:
    - type: addCraft
      terrain: globeTerrain

    - type: addUFO # the UFO method
      terrain: globeTerrain
      UFOName: SOME_CULT_HOUSE_AS_UFO

    - type: addBlock
      size: [2, 2, 4] # assuming a 20x20 house
      verticalLevels:
        - type: ground # the "LZ" for your structure
          size: [2, 2, 0]
          groups: [1]
          terrain: globeTerrain
        - type: middle
          size: [2, 2, 4]
          terrain: SOME_TERRAIN_WITH_JUST_THE_CULT_HOUSE

    - type: fillArea
      terrain: globeTerrain
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: Solarius Scorch on November 01, 2019, 09:16:13 pm
Awesome, thanks.
Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: wcho035 on November 02, 2019, 05:32:10 am
Of course it doesn't do that, this is just a feature for mapScrips, not for alienDeployments. Like I said in your suggestion thread earlier, even if you got this feature, you'd still have to make separate underwater and above water alienMissions for anything that spawned an alien base or mission site. It's just much less work to do this now that you don't also need a separate mission for every texture, like XCF's cult missions.

Hi Ohartenstein23

I will update my suggestion accordingly. Thank you for the reply. And again, Meridian, thank you again for this feature. It is most welcome among us modders.

Regards


Title: Re: [DONE] Ability to use globe texture/terrain in mapScripts
Post by: ohartenstein23 on November 02, 2019, 01:58:21 pm
You don't need to update your suggestion, just put in the effort to make different missions for your bases and different missionZones to spawn them.