Need help solving issue with own shop plugin

Status
Not open for further replies.

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
214
Reaction score
187
First Language
German
Primarily Uses
RMMV
Hello,

the plugin in question is this one:

Currently I am in a conversation with a user of this plugin. He send me a demo for an issue I could not reproduce in my own projects, but is reproducible with this demo. The demo is using my plugin only. The issue is at saving the type information for my classes gets lost in the save data and after loading they are just plain Objects without any of my functions instead of e.g. being of class Game_Shops. So as soon as my plugin tries to call one of these functions the game crashes with an error.

Also one thing to notice is that:
I use MV 1.6.2
The demo is on MV 1.5.1 "Yanfly Desktop Optimized Version Update".
Maybe this version difference is already the reason why it is happening. Also it seems because of this version difference I cannot press F8 to upon the Developer Tools while playing the demo.

So what I tried is calling alert on the JSON in loadGameWithoutRescue and this was the output for my part of the save data:
"gameShops":{"Westwind":{"Name":"Westwind","ShopType":"SellAndBuy","SellOnlyGoodsThatCanBeBought":false,"StockRefillOption":"Never","StockRefillSeconds":7200,"RefillStockCond":false,"_discounts":{"@c":108,"@a":[]},"_totalItemsBought":0,"_itemsBought":{"@c":109},"_weaponsBought":{"@c":110},"_armorBought":{"@c":111},"_switchBought":{"@c":112},"_nrOfVisits":1,"_allGoods":{"@c":113,"@a":[{"kind":"Item","id":1,"name":"Potion","UseCustomPrice":false,"price":0,"UseCustomSellingPrice":false,"SellingPrice":0,"StockQuantity":2,"AvailabilityCond":true,"@c":114,"@":""}]},"_goods":{"@c":115,"@a":[{"@c":116,"@a":[0,1,0,0,2,25,{"@r":114}]}]},"lastStockRefillTime":1,"@c":107,"@":""},"@c":106,"@":""},"@c":1}
Type information is really lost here.

Next up I did the same in saveGameWithoutRescue, started a new game and saved it and here everything seems okay:
"gameShops":{"Westwind":{"Name":"Westwind","ShopType":"SellAndBuy","SellOnlyGoodsThatCanBeBought":false,"StockRefillOption":"Never","StockRefillSeconds":7200,"RefillStockCond":false,"_discounts":{"@c":112,"@a":[]},"_totalItemsBought":0,"_itemsBought":{"@c":113},"_weaponsBought":{"@c":114},"_armorBought":{"@c":115},"_switchBought":{"@c":116},"_nrOfVisits":1,"_allGoods":{"@c":117,"@a":[{"kind":"Item","id":1,"name":"Potion","UseCustomPrice":false,"price":0,"UseCustomSellingPrice":false,"SellingPrice":0,"StockQuantity":2,"AvailabilityCond":true,"@c":118,"@":"Game_ShopGood"}]},"_goods":{"@c":119,"@a":[{"@c":120,"@a":[0,1,0,0,2,25,{"@r":118}]}]},"lastStockRefillTime":3,"@c":111,"@":"Game_Shop"},"@c":110,"@":"Game_Shops"},"@c":1}
The type information was preserved and after the loading my safefile everything worked as expected.
This ultimately means I cannot reproduce the issue with this demo either, except by loading the save file the user already gave me.
So only the save file created already by the user himself does not contain the type information.

Does anyone have an idea how loosing the type information in the safe data could happen?

This actually has been solved by another coder and reported back to me in the same conversation.
My error was declaring the constructor like that:
Game_Shops = function() {}
instead of
function Game_Shops() {}
which is not supported by ES5 or MV1.5.1
 
Last edited:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,584
Latest member
Faustus2501
Top