Hi!
Apologies if the title is vague or something similar to this has been asked before; I looked around a bit and couldn't find a good answer.
I'm currently in the process of adding some custom code to my game (not very far through so far) and trying to learn RPG Maker MV in the process.
My day job is a web developer so I know enough about coding, variables, functions, all that sort of stuff already; I don't need to learn how to code. The problem I'm running into is that as I'm writing my custom code, I'm not sure what the best practices are, or how to integrate things in a clean way.
To elaborate...the current problem I've got is that I want dialogue to be dynamic throughout most of the game. For example, the first time you interact with a rock, the main character says "Wow, a rock!". The second time, they say, "Yep, still a rock!" Any time beyond that the option for what to say is chosen randomly of the two available options. There are some more dynamic ideas I have - if you talk to a town guard after crossing the desert and have <50% health, they comment on how it looks like you barely made it. Things like that.
I could do this all in the program interface with if statements, but it'll get tedious quickly, and I want to be able to reuse dialogue where possible, so I've written a function to output text and a character portrait which I should be able to call once for each text box. I've got that working pretty well and I'm happy with it.
This is where the crux of my problem comes in - I'd like to store the different dialogues in a JSON file, so I can look them up for reusability, store the number of times you've seen dialogue, things like that. I can see in rpg_manager.js that the existing JSON files are loaded in, but I feel like adding in my JSON file(s) to the array is probably a bit of a hack method. I haven't found any tutorials which mention, "By the way, just call this function in your plugin and it'll load in a new file on startup".
Some future problems which I can also foresee which fall under the general scope of this question are:
Apologies if the title is vague or something similar to this has been asked before; I looked around a bit and couldn't find a good answer.
I'm currently in the process of adding some custom code to my game (not very far through so far) and trying to learn RPG Maker MV in the process.
My day job is a web developer so I know enough about coding, variables, functions, all that sort of stuff already; I don't need to learn how to code. The problem I'm running into is that as I'm writing my custom code, I'm not sure what the best practices are, or how to integrate things in a clean way.
To elaborate...the current problem I've got is that I want dialogue to be dynamic throughout most of the game. For example, the first time you interact with a rock, the main character says "Wow, a rock!". The second time, they say, "Yep, still a rock!" Any time beyond that the option for what to say is chosen randomly of the two available options. There are some more dynamic ideas I have - if you talk to a town guard after crossing the desert and have <50% health, they comment on how it looks like you barely made it. Things like that.
I could do this all in the program interface with if statements, but it'll get tedious quickly, and I want to be able to reuse dialogue where possible, so I've written a function to output text and a character portrait which I should be able to call once for each text box. I've got that working pretty well and I'm happy with it.
This is where the crux of my problem comes in - I'd like to store the different dialogues in a JSON file, so I can look them up for reusability, store the number of times you've seen dialogue, things like that. I can see in rpg_manager.js that the existing JSON files are loaded in, but I feel like adding in my JSON file(s) to the array is probably a bit of a hack method. I haven't found any tutorials which mention, "By the way, just call this function in your plugin and it'll load in a new file on startup".
Some future problems which I can also foresee which fall under the general scope of this question are:
- My battle system is going to be less regular attacks + spells and more similar to Pokemon, where you have set moves which have maximum uses. I assume that for this I'll need to modify the data structures of actors and what's going on during combat and such (possibly write my own things and replace references to the existing stuff with these?) but again, I feel like just going into the existing files and making my modifications is asking for a headache down the track.
- I've got some values which I'd like to initialise when the game launches - where should data be initialised?