XCOM 2
Grimy's Loot Mod
GrimyBunyip  [developer] Apr 20, 2016 @ 8:04am
For Mod Authors: Compatibility
If you are a mod author, did you know you can edit other mod's INI files from within your mod?
In this case, it's a great way to automate compatibility.

Step 1 - Find the Equipment Table in XComGrimyLootMod.ini
C:\Program Files (x86)\Steam\steamapps\workshop\content\268500\650277509\Config
this will let you know what arrays there are to edit.

Step 2 - Add XComGrimyLoodMod.ini to YOUR mod
An empty XComGrimyLootMod.ini, not a copy form my folder.

Step 3 - Add the template names to the appropriate arrays
I'll do a quick example with the katana pack:
Note that only the lowest tier item is required, the rest will be handled automatically.

[GrimyLootMod.GrimyLoot_Research]
.Sword_T1 = Sword_CV
.Sword_T1 = Katana_CV
.Sword_T1 = Wakizashi_CV

This can also be done with upgrades, sidearms, armor, etc, if you have a mod that adds any new versions of those.

Step 4 - Add Schematic Names
You only need to do step 4 if your mod adds new schematics that don't use X2Item_DefaultSchematic's upgradeitem function (Which you should do)

If this is the case, add the name of your schematic to the Schematic_Names array

Step 5 - You're done
Yeap, that's all there is to it. Your mod will now automatically be compatible with my loot mod without needing to hassle either of our mod users... or them hassling us ;)
Last edited by GrimyBunyip; Jul 20, 2016 @ 11:50am
< >
Showing 1-15 of 30 comments
BTernaryTau May 4, 2016 @ 7:06pm 
What if I want to add compatibility the other way around? Specifically, I want to have my mod be capable of adding your custom upgrades as well as vanilla ones. Should I just set it up to use arrays like your mod and then ask you to include a config file, or is there a better option?
GrimyBunyip  [developer] May 4, 2016 @ 7:13pm 
You can use the item template manager for something like that

local array<X2WeaponUpgradeTemplate> UpgradeTemplates
Upgrade Templates = X2ItemTemplateManager.static.GetItemTemplateManager().GetAllUpgradeTemplates;

This gives you an array of all upgrade templates in the game, including the ones from my mod.

You should first equip the weapon to a soldier, THEN check whether or not that upgrade you want to apply, can actually be applied to that weapon.

My canapplyupgradetoweapon function requires that the weapon be attached to a soldier to work properly, just FYI.
BTernaryTau May 4, 2016 @ 7:15pm 
Cool. Thanks for the quick response!
darkzero May 9, 2016 @ 1:53am 
So if I were adding say, this gun; http://steamcommunity.com/sharedfiles/filedetails/?id=624086638 to the loot list; My ini should contain.....
[GrimyLootMod.GrimyLoot_Research]
+Pistol_T1 = M1911_CV

If that's accurate I can start work on a spectrum ini file for their laser and plasma weapons.
GrimyBunyip  [developer] May 9, 2016 @ 11:42am 
@Darkzero
yeap, that's how you'd do it. Just make sure all the template names are correct.
darkzero May 10, 2016 @ 11:34am 
Thanks for the quick reply! I believe they are, but with so much loot from other mods I've yet to see the item popup.
BTernaryTau Jun 1, 2016 @ 1:36pm 
For thematic purposes, I'd like to give reward soldiers weapons identical to those found in lockboxes. I've been thinking about using the ResearchCompletedFn delegates of your X2TechTemplates to generate the weapons, then moving them out of HQ's inventory and into the soldier's. However, there are several potential problems with this method, among them the need to generate a new weapon if the previously generated one is for a different class, which would be rather inefficient. If you have any insight on the matter, I'd appreciate your help!
GrimyBunyip  [developer] Jun 1, 2016 @ 2:00pm 
@Celestus
Basically you'd need me to break my researchcompletedfn into parts where one creates an item and returns the itemstate, and another puts it into the inventory.

It's not a bad idea, I'll look into it when I have some time.
BTernaryTau Jun 1, 2016 @ 7:01pm 
I'm not sure if that actually helps. Correct me if I'm wrong, but unless you're creating an API, I can only access overridden functions or delegates of X2TechTemplate. Therefore, I'd only have access to ResearchCompletedFn and not the part that only returns the ItemState.
GrimyBunyip  [developer] Jun 1, 2016 @ 7:05pm 
@Celestus of Borg
correct
krj12 (Ken) Jun 20, 2016 @ 4:13am 
My mod adds a new button to the black market sell screen through a screen listerner, doesnt seem to work with your class override. Any way around this?
BTernaryTau Jun 20, 2016 @ 6:23am 
What you probably want to do is set ScreenClass to none in defaultProperties, then check to see if UIBlackMarket_Sell(Screen) != none in OnInit before doing anything. This will unfortunately cause your ScreenListener to trigger on all screens, but it will only run when it's called on a UIBlackMarket_Sell or any of its subclasses, including Grimy's screen.
GrimyBunyip  [developer] Jun 20, 2016 @ 6:33am 
yeah that'd work.
It'd odd that black market usage works without needing the none trick though. I wonder why that is.
GrimyBunyip  [developer] Jun 20, 2016 @ 6:40am 
@Celestus of Borg
That report isn't correct though.
The current version of black market usage doesn't use a none, and it still works with my loot mod in spite of that.
< >
Showing 1-15 of 30 comments
Per page: 1530 50