XCOM 2
Primary Secondaries
looplick 2019 年 7 月 10 日 下午 1:59
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.
< >
目前顯示第 1-15 則留言,共 24
Musashi  [開發人員] 2019 年 7 月 10 日 下午 2:53 
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 2019 年 7 月 10 日 下午 2:55 
I'll give it a shot. I really appreciate it!
Musashi  [開發人員] 2019 年 7 月 10 日 下午 2:56 
let me know if that works
looplick 2019 年 7 月 10 日 下午 3:34 
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  [開發人員] 2019 年 7 月 10 日 下午 4:10 
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 2019 年 7 月 10 日 下午 4:14 
Good ideas. I'll keep at it. Thanks again.
looplick 2019 年 7 月 10 日 下午 5:41 
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  [開發人員] 2019 年 7 月 10 日 下午 5:43 
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?
最後修改者:Musashi; 2019 年 7 月 10 日 下午 5:44
looplick 2019 年 7 月 10 日 下午 5:50 
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  [開發人員] 2019 年 7 月 10 日 下午 5:54 
does your workshop version of PS has this in the XComGame.ini ?

[PrimarySecondaries CHDLCRunOrder]
RunPriorityGroup=RUN_LAST
最後修改者:Musashi; 2019 年 7 月 10 日 下午 5:56
looplick 2019 年 7 月 10 日 下午 5:54 
It does, yes.
Musashi  [開發人員] 2019 年 7 月 10 日 下午 5:56 
How do you verified you are not running last?
looplick 2019 年 7 月 10 日 下午 6:04 
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  [開發人員] 2019 年 7 月 10 日 下午 6:05 
If you see any logs from primary secondaries before your log entries.
looplick 2019 年 7 月 10 日 下午 6:07 
Good point. Just one:

[0007.64] PrimarySecondaries: Register Event ItemConstructionCompleted
< >
目前顯示第 1-15 則留言,共 24
每頁顯示: 1530 50