Author Topic: Learning to Mod  (Read 21086 times)

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Learning to Mod
« on: August 25, 2019, 12:53:45 pm »
Hello All,
 Not sure if its PIN worthy, but i have been updating some of my old How TO guides for OXC to reflect the changes made over the past 5 years.

http://openxcommods.weebly.com/how-to.html

I will continue to update these over the coming months in the hopes of  encouraging more players to try there hands at modding. Also to any other experienced modders, if you feel like you want to contribute something to these notes, please feel free to let me know, also if you see anything that is wrong, please PM me and we can fix it :)

Thanks
Luke83

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Learning to Mod
« Reply #1 on: October 24, 2019, 08:51:10 am »
Hey look at that, they Pinned my Post :)

Here are some links to help any new Mapbuilders:
http://openxcommods.weebly.com/general-map-creation.html
http://openxcommods.weebly.com/mapview-2.html
Also Check out Solarius Guide here for Mapview1 : http://thexcomfiles.xyz/Mapping_manual_0.1.pdf

This link explains how to use MCDEDIT to do minor sprite work on terrain & adjust all the rules for the tiles:
http://openxcommods.weebly.com/mcdedit.html


This link covers Export and Re-importing sprites ( both terrain and Units) through PCKVIEW & how to correct any colour pallet issues with Irfanview:
http://openxcommods.weebly.com/pckview.html
http://openxcommods.weebly.com/irfanview---fixing-colour-pallets.html


This link goes to our Mod templates, i did these as it is becoming very hard to see how something works by looking at other peoples work as most Mods are now massive and confusing :) this is my attempt to counteract that :
http://openxcommods.weebly.com/oxce-code-templates.html


There are a few other topics listed on the website and some rescource from the very first OXC modders still hidden away in the OldModfIles section...Happy Hunting.
« Last Edit: December 13, 2019, 08:04:44 am by luke83 »

Offline DosAmiga94

  • Sergeant
  • **
  • Posts: 10
    • View Profile
Re: Learning to Mod
« Reply #2 on: September 24, 2020, 10:38:09 am »
Thank you for that!

Offline JConstantine

  • Sergeant
  • **
  • Posts: 22
    • View Profile
Re: Learning to Mod
« Reply #3 on: August 16, 2021, 11:48:35 pm »
The links are dead now. Is there still a guide or guides on modding for OXC, OXCE?

Offline Chuckebaby

  • Colonel
  • ****
  • Posts: 408
  • Chrysalis are people too
    • View Profile
Re: Learning to Mod
« Reply #4 on: February 22, 2022, 02:51:44 am »
This is amazing. thank you so much. just what I'm looking for. I'm just a player looking to dabble into he world of modding.

Offline zhorov

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Learning to Mod
« Reply #5 on: June 11, 2022, 06:53:55 pm »
Hello All,
 Not sure if its PIN worthy, but i have been updating some of my old How TO guides for OXC to reflect the changes made over the past 5 years.

http://openxcommods.weebly.com/how-to.html

I will continue to update these over the coming months in the hopes of  encouraging more players to try there hands at modding. Also to any other experienced modders, if you feel like you want to contribute something to these notes, please feel free to let me know, also if you see anything that is wrong, please PM me and we can fix it :)

Thanks
Luke83

Hello, I want to add new properties to the XPiratez mod for existing items (you can add new ones). Items (drugs) should give time (tu) when used. This has already been done in the x-files mod (STR_ZEPHYR_SERUM). I want the same properties for other items and maybe add the same to ZEPHYR_SERUM . But where do I start? I read the wiki and it didn't help. I was told that I need to write a sub mod.
"Put this in a separate rul file (best practice would be to call it scripts.rul or something similar). You can use this along with the other defintions you need in a dedicated submod. For (sub-)mod definitions look at the metadata.yml in the base directory of the x-piratez sub-mods (for example the czech name mod)."
 Prescribe.
Here is the script from x-files scripts_XCOMFILES.rul

#*** Stat boosting ***
        code: |
          var int temp;

          item.getTag temp Tag.WM_IS_WACKY;

          if neq temp 0;
            # debug_log "healUnit: applying wacky medikit, skip normal effects completely";
            set medikit_action_type 0;

            target.getTimeUnits temp;
            add temp 55; ((The amount of time (tu) can be changed to whatever you like.)
            target.setTimeUnits temp;

            target.getEnergy temp;
            add temp 60; ((The amount of energy (stamina) can be changed to whatever you like.)
            target.setEnergy temp;

            return;
          end;

          # debug_log "healUnit: not wacky...";
          return;

But I don't understand where should I start? Can you give me step by step instructions on what to do?

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Learning to Mod
« Reply #6 on: December 31, 2022, 07:09:43 am »
I was told that I need to write a sub mod.
Mods have master ruleset (assigned in the metadata file), so yes. You could just test it on something in xcom1 vanilla, then change base item to whatever you want and edit master to x-piratez


  #*** Stat boosting ***
        code: |
There should be something like
Code: [Select]
extended:
  scripts:
    healUnit:
at the start.

  But I don't understand where should I start? Can you give me step by step instructions on what to do?
1. Create dummy ruleset: directory structure + metadata. …/MyMod/metadata.yml, …/MyMod/Ruleset, etc.
2. Edit your metadata.yml.
3. Create …/MyMod/Ruleset/scripts_item.rul or something, and write your script in there.
4. Enable your mod in mods menu.
5. It’s debug time! Since YAML based script is sensitive to things like number of spaces or where and how you commented out a line, the most likely result at this point is: OXCE terminated with a complain about some error in your ruleset. So look at the log, edit your mod, re-enable it (or just keep options.cfg open in another tab and keep saving it to overwrite)… repeat until it works. Then repeat until it works the way you want.

As to scripting as such… I did not find anything non-opaque on scripts, but over there Yankes pointed at “Script (OpenXcom)” Ufopaedia page. There’s a reference for things like data formats. Even better, it has links to the threads with actual script examples on this forum (at the bottom).

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Learning to Mod
« Reply #7 on: November 06, 2023, 09:36:05 am »
came across this earlier tonight,huge wealth of info

https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)

edit Deleted Obsolete Web Address
« Last Edit: November 08, 2023, 07:55:46 pm by Nirran »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Learning to Mod
« Reply #8 on: November 08, 2023, 03:55:35 pm »
came across this earlier tonight,huge wealth of info

https://www.ufopaedia.org/index.php/Ruleset_Reference_(OpenXcom) - for openXcom

https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom) - for openXcomExtended

No, the latter is for both OXC and OXCE.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Learning to Mod
« Reply #9 on: November 08, 2023, 05:03:41 pm »
And first probably should be deleted as is obsolete (only valid for 1.0)

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Learning to Mod
« Reply #10 on: November 08, 2023, 08:17:08 pm »
deleted it

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: Learning to Mod
« Reply #11 on: November 08, 2023, 10:34:27 pm »
deleted it
Ok, my post was bit misunderstand, I was referring to wiki page itself not your post,
but updating your post was right decision as it reduce chance of confusing someone else.