Author Topic: Mapscript Questions  (Read 19522 times)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Mapscript Questions
« on: November 20, 2014, 01:59:15 pm »
warboy commited his mapscripts
https://openxcom.org/forum/index.php?topic=2934.msg35920#msg35920
yeah!
now some questions will appear

i start with my questions hopefully we can keep these (+answers) in one thread to make a easier documentation possible

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Mapscript Questions
« Reply #1 on: November 20, 2014, 01:59:27 pm »

lets start
Code: [Select]
mapScripts:
  - type: DEFAULT # forest, mountain
    commands:
    - type: addUFO
    - type: addCraft
    - type: addBlock
      size: 2
      executions: 2
    - type: fillArea
i assume  "size: 2 " means blocks of size 20x20
but can oxc handle non quadratic blocks 10x20 or 30*20 ?
can i use "size: [2,3]" to have a fixed 20x30 block?


Code: [Select]
  - type: FARM
    commands:
    - type: addUFO
    - type: addCraft
    - type: fillArea
      blocks: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
      maxUses: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
i believe the blocks number corresponds with the position in the terrainlist
but do what is the number for the first entry in the list 0 or 1 ?

Code: [Select]
    - type: addLine
      label: 1
      direction: vertical
      executionChances: 50
      rects:
        - [1, 1, 4, 1]
label defines what block groups are used in this operation can i have multiple groups here ?
(if not i have to add a groups to the terrain for every operation with multiple blocktype sources)

i suppose "rects" defines where this operation takes place
since its a list you can select a bunch of possible regions
where is 1,1 ? most north, south,west or east blockposition?
is there a 0,0 position?

Code: [Select]
  - type: URBAN
    commands:
    - type: addCraft
    - 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, 3]
    - type: addLine
      conditionals: [-1, -2]
ok does [-1,-2] means this:
if the last (-1) operation failed and the operation before last (-1) failed execute this operation
(with negative=failed , positive = succes )

Code: [Select]
  - type: ALIENBASE
    commands:
    - 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
...
  - type: XBASE
    commands:
    - type: digTunnel
      direction: both
      tunnelData:
        level: 0
        MCDReplacements:
          - type: westWall
            set: 1
            entry: 13
          - type: northWall
            set: 1
            entry: 14
    - type: fillArea
      blocks: 20
in xcombase you do tunnel command before you fill the map
in alienbase you make the tunnel after you fill it
is there a reason for each operation position?
why does the alienbase need more mcd changes than the xcombase?
can i define the size of the tunnel and make small tunnels between blocks  (make mansized "service-tunnel" in the upper layer of the xbase terrain)

Code: [Select]
  - type: URBAN
    commands:
    - type: addCraft
    - 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, 3]
    - type: addLine
      conditionals: [-1, -2]
      direction: both
      rects:
        - [1, 1, 3, 3]
here you give group 1 and 2 as blockgroups for the vertical/horizontal streets
but there is no such definition for the "direction: both" entry
how can i define these there and how can i say crossroads comes from group 56 ?
are the default values addlines/addcraft/addufo uses?

Code: [Select]
removeBlock
checkBlock

there is no example for the removeBlock /checkBlock  command i found in the source :)



Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Mapscript Questions
« Reply #2 on: November 20, 2014, 02:06:35 pm »
next questions :)
Code: [Select]
      maxUses: [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]is there a minUses ?
Code: [Select]
    - type: addLine
      label: 1
      direction: vertical
      executionChances: 50
      rects:
        - [1, 1, 4, 1]
i suppose the rect definition here creates the starting point for the line?

related: does this
Code: [Select]
    - type: addLine
      conditionals: [-1, -2]
      direction: both
      rects:
        - [1, 1, 3, 3]
rect define the possible "crossroad" position?

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Mapscript Questions
« Reply #3 on: December 06, 2014, 05:10:35 pm »
I started using it a bit.

1)
can I drop the "addCraft" part if I add a enter point map block (like the green-floored one for aliens bases)(and drop "addUFO" part too)?

2)
is there a way to add coordinates to the "addBlock" / "addCraft" / "addUFO" part? Like forcing the craft on one corner (or one random corner), the ufo on the center and so on? Maybe "rects" is used for this but I don't understand how.

3)
does "groups" replace "type" and "subtype"?

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Mapscript Questions
« Reply #4 on: December 06, 2014, 06:21:37 pm »
FYI
i added the current mapblock ruleset stuff to the wiki
hobbes or warboy? reverted the cahnges and split the rulset documentation in two
the info specific for the nightly ruleset has now their own place
https://www.ufopaedia.org/index.php?title=Ruleset_Reference_Nightly_%28OpenXcom%29

1) what is "point map block" ?
if you do not have craft or ufo in a mission you dont need these commands
2) yes you can use rects
if you add this at the start of the farm script you set small ufo in one of the corner of the map (bigger UFO crash in this simple example)
Code: [Select]
  - type: FARM
    commands:
    - type: resize
      size: [6,6,6]
    - type: addUFO
      rects:
        - [0, 0, 1, 1]
        - [0, 5, 1, 6]
        - [5, 0, 6, 1]
        - [5, 5, 6, 6]
3)
yes

i currently work on a bit of documentation/examples

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Mapscript Questions
« Reply #5 on: December 06, 2014, 06:30:56 pm »
I started using it a bit.

1)
can I drop the "addCraft" part if I add a enter point map block (like the green-floored one for aliens bases)(and drop "addUFO" part too)?

2)
is there a way to add coordinates to the "addBlock" / "addCraft" / "addUFO" part? Like forcing the craft on one corner (or one random corner), the ufo on the center and so on? Maybe "rects" is used for this but I don't understand how.

The best way to check this and other questions is simply to try it for yourself and post here the results or update the relevant wiki page to share the info with everyone. I'd like to know the answers to these and other questions myself for later use in the future.

Rects are used to define areas for placement. From what Warboy explained to me, the first two coordinates indicate a location and the next ones the length/width of the rectangle. For instance [0,0,4,5], defines a triangle starting in the top left corner and and occupying a 40x50 area. So, it would be possible to limit Skyranger/UFO deployment to predefined areas on the map.

Quote
3)
does "groups" replace "type" and "subtype"?

Yes.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Mapscript Questions
« Reply #6 on: December 06, 2014, 06:48:36 pm »
I'm trying to figure out about the rects on the Urban MapScript that perhaps someone could explain:

Code: [Select]
  - type: URBAN
    commands:
    - type: addCraft
    - 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, 3]
    - type: addLine
      conditionals: [-1, -2]
      direction: both
      rects:
        - [1, 1, 3, 3]

Now, if I'm understanding this correctly, those rects exclude roads from ever being placed on the 0,0 corner and impose other limitations that didn't exist before. Shouldn't the rects be instead: [0,0,5,1], [0,0,1,5] and [0,0,5,5]?

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Mapscript Questions
« Reply #7 on: December 06, 2014, 06:57:26 pm »
to my understanding
[0,0,5,1]/[0,0,1,5] would allow roads to be at the edge of the map
i do not remember if that was possible in original if yes these number need a change
similar [1, 1, 3, 3] defines the place where the roads can cross so changing them into [0,0,5,5] would also allow roads at the edges

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Mapscript Questions
« Reply #8 on: December 06, 2014, 07:04:05 pm »
to my understanding
[0,0,5,1]/[0,0,1,5] would allow roads to be at the edge of the map
i do not remember if that was possible in original if yes these number need a change
similar [1, 1, 3, 3] defines the place where the roads can cross so changing them into [0,0,5,5] would also allow roads at the edges

It's quite possible to have roads at all edges on the original game:
 https://www.youtube.com/watch?v=qqn2qLQ5nq0
https://www.youtube.com/watch?v=A4-YnBYgNaI
https://www.youtube.com/watch?v=qc1VOfhPdls
« Last Edit: December 06, 2014, 07:16:27 pm by Hobbes »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Mapscript Questions
« Reply #9 on: December 06, 2014, 09:14:16 pm »
FYI
i added the current mapblock ruleset stuff to the wiki
hobbes or warboy? reverted the cahnges and split the rulset documentation in two
the info specific for the nightly ruleset has now their own place
https://www.ufopaedia.org/index.php?title=Ruleset_Reference_Nightly_%28OpenXcom%29
yay for nightly reference!

1) what is "point map block" ?
By "enter point map block" (sorry for poor terminology) I mean a map block with MCDs on which you soldier can spawn, like the alien base map block I attached below.

AFAIK now the only way to do custom missions is by modifying ufos, so the ufo and the craft are going to be present in the battlescape by default. I'd like to know if it is possible, using map scripting, to remove both ufo and craft (replacing the craft with a map block with "spawning ability" like the one below, and the ufo with a map block like the alien base's Control Center, or even no specific map block at all).


The best way to check this and other questions is simply to try it for yourself.
This is what I wanted to do today; but my ruleset was making the game crash so I spent my day fixing it :'(

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Mapscript Questions
« Reply #10 on: December 06, 2014, 09:55:43 pm »
i removed the - type: addUFO from the farmscript and there was no ufo anymore
but also less aliens then there should be i think they are in the ufo and therefore not placed
just removing addcraft failed because i had no farm-terrain-"enter point map block" available

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Mapscript Questions
« Reply #11 on: December 07, 2014, 12:54:22 am »
It is possible to remove the Skyranger. I created a map called CULTA99 with only XCOM spawn points, assigned it to group 5 and then removed the addCraft line and instead added:
Code: [Select]
    - type: addBlock
      groups: 5
      executions: 2

You can see the end result in attachment
« Last Edit: December 07, 2014, 05:26:50 am by Hobbes »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: Mapscript Questions
« Reply #12 on: December 07, 2014, 03:16:29 am »
This is amazing!

Offline bladum

  • Colonel
  • ****
  • Posts: 213
  • Bladum
    • View Profile
Re: Mapscript Questions
« Reply #13 on: December 07, 2014, 12:10:46 pm »
aliens attacks village ? x-com village defense ?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Mapscript Questions
« Reply #14 on: December 07, 2014, 04:57:50 pm »
to my understanding
[0,0,5,1]/[0,0,1,5] would allow roads to be at the edge of the map
i do not remember if that was possible in original if yes these number need a change
similar [1, 1, 3, 3] defines the place where the roads can cross so changing them into [0,0,5,5] would also allow roads at the edges

It is possible at the original. I've just tested it with the UFO Defense Gold Edition with the debug mode enabled (allows for visualization of the entire map at the beginning of the mission) and single roads can be placed on all map edges (check attached pics).

I haven't been able yet to see all possible combinations of crossroads being placed at edges though.

EDIT: I've run about 100 tests with the original game. The only setup I haven't seen yet is a crossroad with one of the roads placed on the top left edge. I'll test a bit more to increase the sample size but I'm starting to think that's the only limitation set into the roads at map edges.
« Last Edit: December 07, 2014, 05:51:52 pm by Hobbes »