XCOM 2
Primary Secondaries
looplick 10 Jul, 2019 @ 1:59pm
Limited Reloads Compatibility
Hey Musashi,

I'm working on a mod that makes the reload ability use charges. I'm using a tweaked version of your method (thank-you btw) where on initialization, certain weapon templates have 'reload' removed and 'limited reload' added. But this doesn't affect the primary pistol templates your mod creates (i.e. TemplateName $ "_Primary").

I haven't been able to find a solution. I know you're busy, but if you could offer any help, it would be greatly appreciated.
< >
Showing 1-15 of 24 comments
Musashi  [developer] 10 Jul, 2019 @ 2:53pm 
Your mods OPTC function would probably need to run after primary secondaries. There is a new feature in the beta highlander to control run order.

Try using the beta highlander and add a XComGame.ini with the following content to your mod:

[FiniteReloads CHDLCRunOrder]
RunPriorityGroup=RUN_LAST
+RunAfter=PrimarySecondaries

Then patch the templates normally by finding Pistol_CV_Primary e.g.
looplick 10 Jul, 2019 @ 2:55pm 
I'll give it a shot. I really appreciate it!
Musashi  [developer] 10 Jul, 2019 @ 2:56pm 
let me know if that works
looplick 10 Jul, 2019 @ 3:34pm 
It's not working unfortunately. I copy/pasted what you wrote into my XComGame.ini and built against the Beta and the pistols still do not have limited reloads.

I use this code to grab the templates. I don't suspect it's the issue. Your pistol templates meet the criteria of IsAcceptableWeaponTemplateLL.

static function AddReloadPrimaryWeaponsLL()
{
local X2ItemTemplateManager ItemTemplateManager;
local array<X2DataTemplate> DifficultyVariants;
local array<name> TemplateNames;
local name TemplateName;
local X2DataTemplate ItemTemplate;
local X2WeaponTemplate WeaponTemplate;

ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager();
ItemTemplateManager.GetTemplateNames(TemplateNames);

foreach TemplateNames(TemplateName)
{
ItemTemplateManager.FindDataTemplateAllDifficulties(TemplateName, DifficultyVariants);
// Iterate over all variants

foreach DifficultyVariants(ItemTemplate)
{
WeaponTemplate = X2WeaponTemplate(ItemTemplate);

if (WeaponTemplate == none)
continue;

if (IsAcceptableWeaponTemplateLL(WeaponTemplate) && !WeaponExcludedLL(TemplateName))
{
AddLimitedReloadLL(WeaponTemplate);
}
}
}

ItemTemplateManager.LoadAllContent();
}

static function bool IsAcceptableWeaponTemplateLL(X2WeaponTemplate WeaponTemplate)
{
return WeaponTemplate != none &&
WeaponTemplate.InventorySlot == eInvSlot_PrimaryWeapon &&
WeaponTemplate.InfiniteAmmo != true && WeaponTemplate.iClipSize > 0 &&
WeaponTemplate.Abilities.Find('Reload') != INDEX_NONE;
}
Musashi  [developer] 10 Jul, 2019 @ 4:10pm 
Looks ok to me at a quick glance. You could add some logging to it to see where it breaks or use the debugger.
looplick 10 Jul, 2019 @ 4:14pm 
Good ideas. I'll keep at it. Thanks again.
looplick 10 Jul, 2019 @ 5:41pm 
Well I'm definitely not running last. I subscribed to the beta and copied/pasted the contents into the SrcOrig - XComGame, Engine, and X2WOTCCommunityHighlander folders. Maybe I'm missing something?
Musashi  [developer] 10 Jul, 2019 @ 5:43pm 
You dont need to compile against the highlander actually.
Did you added the XComGame.ini to your mod?
And have it active and unsubed from the stable highlander?
Last edited by Musashi; 10 Jul, 2019 @ 5:44pm
looplick 10 Jul, 2019 @ 5:50pm 
Yes, I added the lines to the XComGame.ini and have unsubbed from the stable highlander.

Below are the only things currently in my XComGame.ini

[FiniteReloads.X2DownloadableContentInfo_FiniteReloads]
DLCIdentifier="FiniteReloads"

[FiniteReloads CHDLCRunOrder]
RunPriorityGroup=RUN_LAST
+RunAfter=PrimarySecondaries
Musashi  [developer] 10 Jul, 2019 @ 5:54pm 
does your workshop version of PS has this in the XComGame.ini ?

[PrimarySecondaries CHDLCRunOrder]
RunPriorityGroup=RUN_LAST
Last edited by Musashi; 10 Jul, 2019 @ 5:56pm
looplick 10 Jul, 2019 @ 5:54pm 
It does, yes.
Musashi  [developer] 10 Jul, 2019 @ 5:56pm 
How do you verified you are not running last?
looplick 10 Jul, 2019 @ 6:04pm 
I placed a 'LOG in the function right after AddLimitedReloadLL(WeaponTemplate); is called. I can see other mods like "EVAC All" and "Psi Overhall" after my log entries. Forgive me, maybe this isn't related to load order. Is there a better way to track this?
Musashi  [developer] 10 Jul, 2019 @ 6:05pm 
If you see any logs from primary secondaries before your log entries.
looplick 10 Jul, 2019 @ 6:07pm 
Good point. Just one:

[0007.64] PrimarySecondaries: Register Event ItemConstructionCompleted
< >
Showing 1-15 of 24 comments
Per page: 1530 50