People Playground

People Playground

Guns 'N Ammo 1.2 (should work now?)
BeE 28 Jul, 2024 @ 1:29pm
I found a fix for broken saving
The longer, full fix with working extended magazines and attachments:



in private void Start()
change

UpdateSpriteforLoaded("standard");
to
UpdateSpriteforLoaded(gameObject.GetComponent<AmmoUsageBehaviour>().ammoLoaded);



You have to add this fix to every AfterSpawn in weapon (this example is for AK47):



ModAPI.KeepExtraObjects();

Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/AKEmpty.png");

var MANFBBIR = Instance.GetComponent<AmmoUsageBehaviour>();
// fixing duplicate error
if (MANFBBIR == null) {
Instance.AddComponent<AmmoUsageBehaviour>();
MANFBBIR = Instance.GetComponent<AmmoUsageBehaviour>();
}
// end of fix 1
MANFBBIR.Mag = ModAPI.LoadSprite("Sprites/AKMag.png");
MANFBBIR.MagExtended = ModAPI.LoadSprite("Sprites/AKMagExtended.png");
MANFBBIR.Empty = ModAPI.LoadSprite("Sprites/AKEmpty.png");
MANFBBIR.Loaded = ModAPI.LoadSprite("Sprites/AKLoaded.png");
MANFBBIR.LoadedExtended = ModAPI.LoadSprite("Sprites/AKLoadedExtended.png");
MANFBBIR.AmmoID = 2; //Used for munutions
// fixing ammo count on load
if (MANFBBIR.ammoLoaded == "standard") {
MANFBBIR.MaxAmmo = 30;
}
else {
MANFBBIR.MaxAmmo = 45;
}
// end of fix 2





After 5 hours of studying C# (its just javascript on drugs), reading PPG mod documentation and fighting with the terrible code, I've found the potential fix for all of your problems:

Line 717 in TheEntireGodDamnScript.cs:
Write [SkipSerialisation]

Without it whole Behaviour gets saved causing it to duplicate all scripts on next spawn.

I haven't tested it for bugs but everything seems to be working.

(btw I'm gonna use this mod to add reloading to Catt's Cannons, I hope I got permission for that)
Last edited by BeE; 28 Jul, 2024 @ 2:26pm
< >
Showing 1-5 of 5 comments
BeE 28 Jul, 2024 @ 1:45pm 
without more code it won't save attachments and will always default the normal magazine

it probably needs skipserialisation in every property just like documentation says

https://www.studiominus.nl/ppg-modding/tutorials/tutorialSerialisation.html
BeE 28 Jul, 2024 @ 1:58pm 
edit: i managed to get attachments to save

it's a different fix, now let me fix magazine types!
BeE 28 Jul, 2024 @ 2:25pm 
fixed everything lol
baffomanners 4 Dec, 2024 @ 9:36am 
Originally posted by I am jo momma:
fixed everything lol
I found out how to mess with steam
BeE 12 Dec, 2024 @ 8:02am 
Originally posted by deez nuts:
I found out how to mess with steam
< >
Showing 1-5 of 5 comments
Per page: 1530 50