Need help solving issue with own shop plugin

Status
Not open for further replies.

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
218
Reaction score
195
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,798
Reaction score
5,354
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.

Latest Threads

Latest Posts

Latest Profile Posts

2021? I still wonder if people still doing MV than MZ more
Seeing a lot more active Ace topics recently, is it making a comeback? :o
0-7, left-to-right, top-to-bottom
As soon as I'm able to get out of bed I'm probably gonna go so hyper from being too cooped up, and burn myself out into another awful flare. lol
It makes me feel proud whenever an RM game does well. Even though I had nothing to do with it.

Forum statistics

Threads
107,627
Messages
1,031,013
Members
139,746
Latest member
Krunga
Top