Hi, I'm trying to have an event move, and then run a script based on its new position, which can tell it to move again... and so on...
I'm having problems though because I don't know how to tell an event to run a script after it has moved. Instead it tends queues up the movement, and then runs the script over and over again, locking up the game.
I've been digging through the rpg_objects code for hours, but I think I'm just missing something simple.
Any help would be desperately appreciated!
Are you doing this through event commands or trying to modify scripts to do it? Please show a screenshot of what you've got so far as your description doesn't really give us much to go on.
Could be as simple as setting the movement route to 'wait for completion' before running the script.
Hi Shaz,
Thanks for replying so fast. I've been trying both.
Right now, I have a command, telling my event to move, and then an script deciding where it should move from there.
Set Movement Route : This Event (Wait)
:<>Move Right.
Which works.
Then I wrote a script that tells it where to move next, based on its surroundings.
That also works.
My problem is I want to run the script again, after the event gets there. And it locks up.
I've set "wait for completion" in both my event command and my script. But the code still locks up. I guess because my code doesn't know how to wait, even though the event knows to wait... Or something? I don't know...
Can you please show a screenshot? And if you wrote a script, include that too (in spoilers and code tags)
It sounds as if you made the script call at the wrong position in the event code - that is why we need a screenshot to see exactly what you placed where.
I suggest you check the area called "autonomous movement" between the image and the content. Those movement controls are independent of the event content - usually that allows a villager to move around while still starting a conversation on action button.
Interaction between events should always be controlled and checked from the outside, not from the events themselves. There are a lot of reasons for that (including to prevent mistiming), some of them you can read about in the bughunting tutorial I wrote (link in my signature).
There are different ways to control an events movement, and you need to use them all depending on what exactly the specific case is - for example there are scripts that place barriers only for events on the map, and you can let the event move randomly within those areas while the player can still go everywhere.
Or you can preprogram the move routes, or use a parallel process to check for positions, or several other options.
Which one is best depends on the exact situation - a tracked train would use a different method than a randomly wandering animal for optimal effects