OpenXcom Forum

Modding => Help => Topic started by: luke83 on August 25, 2019, 12:53:45 pm

Title: Learning to Mod
Post by: luke83 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
Title: Re: Learning to Mod
Post by: luke83 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.
Title: Re: Learning to Mod
Post by: DosAmiga94 on September 24, 2020, 10:38:09 am
Thank you for that!
Title: Re: Learning to Mod
Post by: JConstantine 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?
Title: Re: Learning to Mod
Post by: Chuckebaby 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.
Title: Re: Learning to Mod
Post by: zhorov 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?
Title: Re: Learning to Mod
Post by: TBeholder 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 (https://openxcom.org/forum/index.php/topic,7974.15.html) Yankes pointed at  “Script (OpenXcom)” Ufopaedia page (https://www.ufopaedia.org/index.php/Script_(OpenXcom)). 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).
Title: Re: Learning to Mod
Post by: Nirran 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
Title: Re: Learning to Mod
Post by: Solarius Scorch 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.
Title: Re: Learning to Mod
Post by: Yankes on November 08, 2023, 05:03:41 pm
And first probably should be deleted as is obsolete (only valid for 1.0)
Title: Re: Learning to Mod
Post by: Nirran on November 08, 2023, 08:17:08 pm
deleted it
Title: Re: Learning to Mod
Post by: Yankes 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.