Legacy GM [QUESTION] Dynamic Objects via JSON

Hey all! I'm making a survival/crafting game, and I want to be able to define objects/items (as well as crafting recipes) and their parameters via json files rather than tediously creating one after the other, adding a create event, and setting the variables directly in GameMaker. Of course, this would also allow for custom user content. How would I accomplish this without being able to directly create new objects via the defunct object_add function? Thanks for your time!
 

Arconious

Member
Hi there, noticed you have the thread marked as "Legacy GM", but didn't indicate what version exactly you're using -- this will impact how you approach the situation.

If you're using GMS 1.4+, you'll want to look into the json_decode and json_encode functions. If you're using the latest version (2.3+), there are the new json_parse and json_stringify functions. If you're still using 8.1, I'm not aware of any built in functions oriented toward json that exist, but my knowledge of 8.1 is very limited.
 
Top