OpenXcom Forum

Modding => OpenXcom Extended => OXCE Support => Topic started by: wcho035 on March 02, 2020, 09:45:12 am

Title: [Solved] How to change the map size from Aliendeployment using MapScript
Post by: wcho035 on March 02, 2020, 09:45:12 am
Proposition- The generation of Battlescape map size, can be allow to be done in a global variable sort of way for Mapscript instead of Aliendeployment alone. When I mean global Variable sort of way, I mean Mapscript have priority, in deciding the size of the Battlescape map, before Aliendeployment.

Justification-When a UFO crash in a texture, it is their Alien deployment that decide the size of the battlescape map. A small scout can forever crash in a small or certain size map decide upon by its aliendeployment.

If Mapscript can decide upon the Length and width of a battlescape mission map, we can allow random map size for a ufo missionsite or crashsite.

For example, if we have 3 mapscript

One for a Desert Town with
    width: 50
    length: 50 

One for a Desert City with
    width: 120
    length: 120 

One for a Desert volcano with 
    width: 40
    length: 50 

Say in the same texture id say 5.

If the ufo crashes in texture id 5, it could use either the town, city or volcano mapscript with varying and unpredictable mapsizes.

The true purpose of my request, is to allow random cities or towns assigned to the texture ID, this allow for town and cities crash sites with varying battlescape map size, instead of solely depending on the Aliendeployment from the ufo.

I am hoping some Terrain Modders who love making terrains and maps to pick up on this idea. Perhaps someone can code it.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: ohartenstein23 on March 02, 2020, 02:34:59 pm
Use the mapScript command "resize".

Code: [Select]
mapScripts:
  - type: DESERTCITY
    commands:
      - type: resize
        size: [12, 12, 4] # sets size to 120×120×4
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: Solarius Scorch on March 02, 2020, 04:00:50 pm
Wow. The things a mapScript can do... Colour me impressed.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 02, 2020, 06:40:10 pm
Wow nice. So if I am to assume.  size: [12, 12, 4]  translate as [L, W, H] ?  This will override the Length and width in Aliendeployment? Confirm?
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: ohartenstein23 on March 02, 2020, 07:34:15 pm
Yes, but it's [x, y, z] or [width, length, height].

And yes it overrides the deployment to setting it to the specified size, but it has to be done before any blocks are added by the script.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 02, 2020, 07:37:49 pm
Thanks again, Ohartenstien23, if you can also help with my other question about blank terrain. I am most grateful. Thank you.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 04, 2020, 09:55:17 am
Regreatfully Ohartenstien23, your solution didn't meet the objective of this request. The size only works for per block, not the whole battlescape map. Anyway, I would keep this request open.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: Meridian on March 04, 2020, 10:07:26 am
Regreatfully Ohartenstien23, your solution didn't meet the objective of this request. The size only works for per block, not the whole battlescape map. Anyway, I would keep this request open.

That is false.

The resize mapscript command can only resize the entire map, it cannot resize blocks.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 04, 2020, 03:57:04 pm
Okay, again, I am not good with certain words.

Map = Physical map + Routes.   <--- This is what I mean by block, like

    - type: addBlock
      size: [2,2,5]
      execution: 2
      terrain: globeTerrain

so the definition of Block in this case here is = whole battlescape mission maps?

So block and addblock, perhaps two different terminology? So I am confused here.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: Meridian on March 04, 2020, 04:06:19 pm
"addBlock" command works with blocks (=the small building blocks that together make a map)

"resize" command works with the whole map, not with blocks
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: Solarius Scorch on March 04, 2020, 04:15:03 pm
It is unfortunate that mapblock files have the extension .map. It adds to confusion, because a map is generally understood to be the entire battlescape area, not just one block.

I would personally prefer to avoid using the word "map" in non-casual conversations (like documentation), but the nomenclature is not really there yet. The smaller parts can be called blocks or mapblocks without any problem, but what about the whole thing? A battlescape? I don't know.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 04, 2020, 04:29:38 pm
So not the whole battlescape map, when I mean map like the WHOLE mission map, including UFO, Craft buildings and other maps.. geezz got to work on my definitions here.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: Meridian on March 04, 2020, 04:33:41 pm
So not the whole battlescape map, when I mean map like the WHOLE mission map, including UFO, Craft buildings and other maps.. geezz got to work on my definitions here.

yes, the "resize" command affects the whole battlescape map = the whole mission map including UFO, Craft and everything else.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 04, 2020, 05:25:06 pm
I finally understood now. Thank you. Got confused with size and resize.
Title: Re: Mapscript decides the size of Battlescape map, instead solel of Aliendeployment.
Post by: wcho035 on March 04, 2020, 05:28:17 pm
So for example the code should look like

  - type: DESERTTOWNSCRIPT
    commands:
    - type: resize
      size: [20, 20, 9]
    - type: addUFO
      groups: 1   
    - type: addCraft
      groups: 1
    - type: addBlock
      size: [1,1,4]
      verticalLevels:
      - type: ground
        size: [1,1,0]
        groups: 1   
      - type: middle
        size: [1,1,4]
        executionChances: 5
        terrain: PORT6
    - type: addBlock
      size: 2
      execution: 2
    - type: fillArea
Title: [Cancel] Mapscript decides the size of Battlescape map, instead Aliendeployment.
Post by: wcho035 on March 04, 2020, 05:31:16 pm
I can confirm it worked beautifully.  This request is now void. Thank you guys.