Author Topic: How do MCDPatches work?  (Read 9471 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
How do MCDPatches work?
« on: October 02, 2016, 02:03:57 pm »
I would like to know more about MCDPatches: what is possible to do with them, what is not, and how to use it.

For now, my problem is that I would like to add Zrbite to UFO: EU, complete with its recovery, engines etc. therefore I need to define a new special property of a specific tile that would yield Zrbite (and not, say, Elerium of Alien Alloys).

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #1 on: October 02, 2016, 02:27:52 pm »
Ohhhhh yes that would be cool adding new recoverable items :)

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: How do MCDPatches work?
« Reply #2 on: October 02, 2016, 02:38:15 pm »
hum not sure i understand what you want to do...
Anyway, AFAIK MCDPatches are used to overwrite values of MCDs, so you can modify the stats of a MCD directly in the rueleset; for example: if a MCD has a armor 10, you can just add an MCDPatches entry that sets it to 50 and you're done.

To implement zrbite in UFOEU i guess you have to regularly make the zrbite-related MCDs (the TFTD engine), then link it to a zrbite item in the ruleset, using this method:
you can also link an MCD to an item, adding a specialType entry to the item; the MCD then should be given the same value to its Target_Type.
example:
specialType: 30 (in ruleset)
Target_Type 30 (in MCDEdit)
(Use a value of 20+ because some values -up to 14 iirc- are already used; max is 99 i think).

The linked item is automatically recovered if that MCD is still undamaged by the end of a mission (1 item for each MCD present on the battlescape).
Then i guess you can use the item to manufacture a craft..? i'm not sure about this.
If you want to check it in practice, i use this method in my mod for human craft missiles.

Or another method is to directly place, using ruleset, items in map: make a zrbite item (i guess you could make it invisible, AKA transparent floorob) and place it on the tile which holds the engine MCD.
Again i use this method in my mod, to spawn stuff like firearms on the empty shelves, or psiclones on altars.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do MCDPatches work?
« Reply #3 on: October 02, 2016, 03:34:10 pm »
To implement zrbite in UFOEU i guess you have to regularly make the zrbite-related MCDs (the TFTD engine), then link it to a zrbite item in the ruleset, using this method.

Yes, this is exactly what I needed, thanks!
So it doesn't involve MCDPatches at all if you modify MCDs directly, yes?

EDIT:
It appears to be working. But how do I change the tile to produce 25 Zrbite instead of 1?
« Last Edit: October 02, 2016, 03:40:14 pm by Solarius Scorch »

Offline robin

  • Commander
  • *****
  • Posts: 1225
  • ULTIMATE ROOKIE
    • View Profile
Re: How do MCDPatches work?
« Reply #4 on: October 02, 2016, 03:46:12 pm »
Yes, this is exactly what I needed, thanks!
So it doesn't involve MCDPatches at all if you modify MCDs directly, yes?

EDIT:
It appears to be working. But how do I change the tile to produce 25 Zrbite instead of 1?
that's the limit of that technique, you can only link to 1 item (unless Warboy changed it). you have to use the other technique for multiple items.

if you make/tweak your MCDs with MCDEdit, then you don't need MCDPatches at all.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do MCDPatches work?
« Reply #5 on: October 02, 2016, 03:49:19 pm »
that's the limit of that technique, you can only link to 1 item (unless Warboy changed it). you have to use the other technique for multiple items.

if you make/tweak your MCDs with MCDEdit, then you don't need MCDPatches at all.

All right, thanks!

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #6 on: October 03, 2016, 01:25:27 am »
Ahh so if I wanted to add say a recoloured item in each UFO map (i.e. called Alien Propulsion) and a separate type of terrain item (i.e. Control Crystal) then I could do this by modifying the map values and not having to add anything in the ruleset except a declaration of a new item?

Is there anywhere I can read on MCDPatches? Is this a software programme or an extension of the ruleset?

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: How do MCDPatches work?
« Reply #7 on: October 03, 2016, 01:32:01 am »
MCDPatches is a part of a (mod) ruleset that overrides certain values of certain MCD entries. This is mostly used to fix bugs in the vanilla MCD files, so as to not modify them.

Currently, the following values can be mcdpatched:

Code: [Select]
    'bigWall': 'Big_Wall',
    'TUWalk': 'TU_Walk',
    'TUSlide': 'TU_Slide',
    'TUFly': 'TU_Fly',
    'deathTile': 'Die_MCD',
    'terrainHeight': 'T_Level',
    'specialType': 'Target_Type',
    'explosive': 'HE_Strength',
    'armor': 'Armor',
    'flammability': 'Flammable',
    'fuel': 'Fuel',
    'footstepSound': 'Footstep',
    'HEBlock': 'HE_Block',
    'noFloor': 'No_Floor',
    'LOFTS': 'LOFT',
    'stopLOS': 'Stop_LOS',
    'objectType': 'Tile_Type',


Ahh so if I wanted to add say a recoloured item in each UFO map (i.e. called Alien Propulsion) and a separate type of terrain item (i.e. Control Crystal) then I could do this by modifying the map values and not having to add anything in the ruleset except a declaration of a new item?

There are items and there are tiles. Adding items is just modifying a deployment (i think) record in the ruleset. Adding a tile,  well, that's modifying the map and the MCD set for that map. MCDPatches can't help with this. Clone the map and the MCD set and edit them.

« Last Edit: October 03, 2016, 01:43:03 am by Stoddard »

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #8 on: October 03, 2016, 03:38:58 am »
Thank you for the explanation Stoddard!

In your earlier post you mentioned something about human craft weapons mod? Would you be kind enough to advise which one this is please as I'd like to have a peak :)

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: How do MCDPatches work?
« Reply #9 on: October 03, 2016, 04:50:13 am »
Thank you for the explanation Stoddard!
You're welcome.

In your earlier post you mentioned something about human craft weapons mod?

Which post that would be?

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #10 on: October 03, 2016, 08:38:13 am »
Sorry Stoddard it was robin who mentioned something about human craft missiles not you lol

Trouble of looking at posts on a small screen.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do MCDPatches work?
« Reply #11 on: October 03, 2016, 09:37:41 am »
There are items and there are tiles. Adding items is just modifying a deployment (i think) record in the ruleset.

To be precise, you modify terrain, not deployment.

As for Robin's post, he meant his From the Apocalypse mod, so you can check it out. (It's also a very good, complex mod.)

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #12 on: October 04, 2016, 02:27:30 am »
Thank you all :)

Your patience is appreciated with a humble noob like me who has only recently founded the wonders of OpenXcom modding.

As soon as I get paid I think I may have to pay an artist to undertake some work for my own mod!

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: How do MCDPatches work?
« Reply #13 on: October 12, 2016, 07:38:27 pm »
So I think I get this after trying to reverse engineer a few things ... (please bare with me lol)

I can create a new tile and put it into mcedit and configure it with a target type of say 31, then I need to declare what that special tile is in the ruleset in 'from the apocalypse' for example it has:

## new:
# specialType list:
#   33 STR_ALIEN_PLASMA_BARREL

I can also see another component called:

  - type: STR_DIMENSIUM_161
    size: 0.1
    costSell: 5000
    weight: 3
    bigSprite: 56
    floorSprite: 37
    invWidth: 1
    invHeight: 1

This looks like another recoverable item like Elerium 115.

What I can't figure out now is to say have something in my mod (e.g. a recolored ufo power source called anti-gravity generator) which is then fuelled by (you guessed it) anti-graviton crystals of which like elerium would hold 50 per unit.  Do I need to place this fuel type item on the map underneath the generator so that it is recovered? If so how do you edit the amount from 1 to to a larger number?

I am totally confused!  :o

Appreciate any help here peeps!

--- posts merged - Solarius Scorch ---

Solarius did you get 50 Zrbite in in the end?
« Last Edit: October 13, 2016, 04:01:28 pm by Solarius Scorch »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11732
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: How do MCDPatches work?
« Reply #14 on: October 13, 2016, 04:02:35 pm »
Nope, AFAIK it's not possible now.

But spawning the item on the ground, under the object is the next best thing.