Jump to content

OXCE mod examples

From UFOpaedia
Revision as of 11:51, 6 December 2025 by Kalamona (talk | contribs) (MAP CREATION)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In this page there are several common modding questions answered. It is mostly aimed for beginner modders.

MAP CREATION

The way map creation works, from the very start. Feel free to start from a later stage, for example most people don't want to bother with art, but just want to use UFO's original tilesets or some other mod's tilesets.

Creating from the very beginning

- You need to draw a tileset, a series of 32*40 pictures. Or you can use one already made (preferred if you don't want to tinker with art). End result: a PNG picture containing the tiles. This won't be used in the final game, as this will be transformed in the next step.

- You need to "set up" these tiles, what their ingame properties are (how much damage they take, how flammable they are, what sound they make when a soldier steps on them, are they traversable, etc). This can be done in an external editor like MCDEdit. The end result is a trio of files: a .pck file (contains the art, but now in an unreadable format), a .mcd file (contains the tileset's tiles' properties, like footstep sound, 3d shape, whether it is a wall or not, etc.), and a .tab file (helper file)

- Once you have this trio of files, the .pck, the .mcd and the .tab, you can actually create "map chunks", fragments that the final randomized map will be built with. For building "map fragments", called map blocks, you need an editor, most likely MapView2. With this, you can create .map files and .rmp files (route files, handling AI movement, AI and XCOM spawn and stuff like these).

Ruleset

- Once you have the "terrain" files (the raw tiles map blocks use, this trio of .pck, .mcd and .tab) and the "map" files (the actual map chunks in .map format and the matching route files in .rmp format), you can finally begin modding in maps in a text editor.

Note that a source of confusion is present: the mcd, tab and pck files are usually put to the TERRAINS folder, but the "terrains" in the game actually means a more ready map that defines the map blocks.

Anyways, in the rulesets, define a terrain like this:

terrains:

 - name: INFESTEDFOREST
   mapDataSets:
       - BLANKS                      #don't ask, jut put it there
       - INFESTEDFOREST              #the name of the .MCD file, so the "terrain"
   script: INFESTEDFOREST_MAPSCRIPT  #this script will be used to actually create the terrain
   mapBlocks:
     - name: INFESTEDFOREST_START_00   #the name of the .map file, so the "map chunk"
       width: 10
       length: 10
       groups: 1      # group 1 means this will be used for landing your craft
     - name: INFESTEDFOREST_INFESTED_00 #another "map chunk" using the same tileset but different composition
       width: 10
       length: 10
       groups: 13      # you can set the "map chunks" to groups to be used in scripts later for randomization
     - name: INFESTEDFOREST_INFESTED_01 #another "map chunk" using the same tileset but different composition
       width: 10
       length: 10
       groups: 13      # you can set the "map chunks" to groups to be used in scripts later for randomization
     - name: INFESTEDFOREST_INFESTED_02 #another "map chunk" using the same tileset but different composition
       width: 10
       length: 10
       groups: 13      # you can set the "map chunks" to groups to be used in scripts later for randomization


So the above defined terrain has 1 map block that is set to group 1, and 3 map blocks that are set to group 13.

- With the terrain and map blocks defined in the game, now you can actually create a map, using the mapScript!

mapScripts:

 - type: INFESTEDFOREST_MAPSCRIPT
   commands:
     - type: addCraft  #adds the craft you arrive with. This will always use a map block from group 1 beneath your craft, so make sure the map block(s) defined in group 1 are flat!
     - type: fillArea # fills out the rest of the map with stuff defined below
       groups: 13 # the area will be filled by random map blocks from group 13, so the 3 infested forest map chunks.

And with all of these done, you can finally use your new map in an alienDeployment:

alienDeployments:

 - type: STR_WAVE_OF_AGGRESSION_SITE  
   width: 50
   length: 50
   height: 8
   terrains:
     - INFESTEDFOREST
   data:...(rest of the file)

EVENTS

Events by themselves just "exist" but are not triggered. To trigger an event, you need an eventScript that runs it. The actual event decides what you get when the event happens, but the eventTrigger decides WHEN to run the event, depending on research, items, etc.


Q: How do I create an event that runs at the start of the game?

events:

 - name: STR_WELCOME_TO_OXCE   #the event is just defined here
   description: STR_WELCOME_TO_OXCE_DESCRIPTION
   timer: 500
   timerRandom: 0

eventScripts:

 - type: STR_WELCOME_TO_OXCE_EVENTSCRIPT  #can have the same name as the event, but I added the _EVENTSCRIPT part here to differentiate  
   eventWeights:
     0:
       STR_WELCOME_TO_OXCE: 100  #this is the actual event run by the eventScript, it can choose randomly but there is only 1 possibility here
   firstMonth: 0 
   lastMonth: 0 # if firstmonth and lastmonth are 0, the event will run once at the start of the game
   executionOdds: 100 #how much chance that this eventscript will run