Hello there folks! Me again, this time with a help request regarding this: putting Set Movement Route into scripts.
I have looked at the scripts and made a simple routing: move left, move up. Each time I'd do something like this, the character instantly skips the first step and performs the last step normally. I'd be interested in making a script for a movement route that looks like this: UP: 3, RIGHT: 4, UP: 2, LEFT: 1.
Can anyone please post me your way of putting this into a script?
Thank you in advance!
Hugs, stay awesome and live (b)right! >😀<
Yours truly,
Annwfn
It would help if you post what you did so that we can see where you made your mistakes.
However it would help even more if you post what and why you want to do this.
javascript isn't a miracle worker, and there are good reasons why most people use events to create move routes - it is rather difficult to get anything involving the main game loop right in javascript, especially for people who never did anything in javascript in the game loop.
and we need that background information to see if javascript is even the correct way to do whatever you want to do.
I will rephrase my question then 🙂
I would like to introduce that Set Movement Route part into a Script text box (not necessarily make use of JavaScript. It's too quirky and confuses me), if possible, where the AI will move based on a big Switch case, which will be based on the student's movement phase. (I know there can be only 1 wait function in a script box, since they trigger simultaneously).
Why I'd need this is because my AI events can end up as very lengthy, with students performing 200+ steps each, If I could put some of them in a big script instead it would use less space. Already data folder is 60Mb for 6 maps 😀
I believe someone made a scriptcall to follow a region ID path.
so if you use 20 and line out the path, it will follow that path straight,
or back and forth 🙂
that doesn't answer my question, but it shows that you're missing a few things.
1)
In 99% of all cases, the set moveroute command is actually shorter than the equivalent script commands. So if you want to make your events shorter, then trying to replace set move routes with javascript is not going to do so, it will make those script boxes longer and more difficult to read.
and in the few exeptions you're better off using a pathfinding script/plugin anyway.
2)
using a common event to control map events is usually a bad idea - for example if anything goes wrong and you activate those events on the wrong map, they will cause everything to go wrong because on different maps, the event IDs are usually for different event cases.
and the common event will command the events based on the local ID.
3)
which brings us back to my original question.
I asked for the purpose of what you're doing, not for the mechanics of it, exactly because I assumed that you have some convoluted and needlessly complex construct going on.
and you answer above convinced me that this assumption is correct.
Please tell us what the purpose of all that is, so that we might be able to point you to a better solution.
OK, in this case there is one thing you should consider very hard before making the final decision on how to approach:
"Players" (which means NOT you as the developer) rarely like to micromanage a game. There are exceptions to this (I'm more of a micromanager myself as a player), but most people play to pass time without effort, and micromanaging requires effort to most.
So if you as the developer put in that precision and detail level, then it will either be ignored by most players (if the game can be played without the same level of detail on the player side) or the player will leave the game as "not fun" if it requires that attention to detail.
If this doesn't matter to you and you still want to get that precision into your game - go ahead.
It will be easier using map events for controlling what happens on the map, and the common events for time tracking and estimates of between-map-synchronisations). And scripted move routes is definately the wrong way to go with this.
But it can be done this way, most developers just aren't willing to put in the effort to get to that precision considering that most player will either ignore (if it has few effects on their play) or run away from it (if you force it on them).
The whole point of RPG Maker is you can make your game however you like, and no one will try to take that away from you. That being said, you are choosing to make things more convoluted and difficult than they need to be, which most often leads to would-be developers giving up without a completed project.
The reason you're having a hard time finding examples of how to do this is...people don't do this in their games 😛 The amount of effort and complexity to code this kind of autonomous world is just not worth it for how much it gets noticed or how much it matters to any player.
Even huge, world-based games from full production studios like Skyrim have only very basic versions of this - this lady goes from her house to her market stall in the morning, then back to her house to sleep at night. This guard patrols between these two points all day.
There just isn't a reason to make things so complex unless you're doing a dissertation on AI, in which case you'd probably know enough about it to not be asking for help 😉
But if it's truly what you want to do for your own enjoyment, whether or not it ever results in anything, you're going to get pretty deep into some very complex events or JavaScript code. RPG Maker just isn't designed to do this kind of background management, so you're going to have to write it yourself.
I think the best approach would be to have one event (if possible, it may take up too many lines and have to get split up) that tracks the intended location of every event in your game at every moment of the day. Then each event on the map has pages with different move routes. Each map has an autorun event that checks against the common event for where all of its map events should be, teleports them, and sets them to the appropriate page to move from there.
But, then, I wouldn't try to do this at all 🤣 It just seems like there are many more worthwhile things you can be doing with your game.