You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug self.Magazine can seemingly randomly be nil in Create()
Pawnis' recent Browncoat script even points it out with a comment, in Data/Browncoats.rte/Devices/Weapons/Extinction/Extinction.lua:
self.maxAmmoCount=self.Magazineandself.Magazine.Capacityor5; -- loading a game might mess this up, so... fall-back
In the mod I found the issue, the error originates from here:
functionCreate(self)
self.ammoCounter=100self.recoil=0self.ff=falseprint(self.Magazine)
self.f0=ToMagazine(self.Magazine).RoundCountself.f1=ToMagazine(self.Magazine).RoundCountself.firetimer=Timer()
end
I added the print(self.Magazine), and it shows that self.Magazine is nil a portion of the time it gets printed here.
Where the single ini file where it's used looks roughly like this:
Worth noting that Pawnis' case is due to save-loading, where having the Magazine be nil is indeed a valid case if the game is saved mid-reload... (and having mods be compatible with save-loading ought to account for this!). But I'll look at why this is happening without a save-load cycle
So I can confirm that this also happened in Pre 5.0.
If this is happening without save/load, is it not possible that the script is being added to a gun perhaps mid-reload?
It might, but it's hard to know for sure. I know for a fact that looking for chainchoppa.lua in the project with Ctrl+Shift+F only results in it being mentioned in its ChainChoppa.ini
Activity
Causeless commentedon Feb 18, 2024
Worth noting that Pawnis' case is due to save-loading, where having the Magazine be nil is indeed a valid case if the game is saved mid-reload... (and having mods be compatible with save-loading ought to account for this!). But I'll look at why this is happening without a save-load cycle
Causeless commentedon Feb 18, 2024
If this is happening without save/load, is it not possible that the script is being added to a gun perhaps mid-reload?
MyNameIsTrez commentedon Feb 18, 2024
So I can confirm that this also happened in Pre 5.0.
It might, but it's hard to know for sure. I know for a fact that looking for
chainchoppa.luain the project with Ctrl+Shift+F only results in it being mentioned in its ChainChoppa.ini