I've created some events based on variables which creates always a different npc on the end of the road walking to the other side of the map on a way.
But there's one problem in my way to create a "busy streets" look. I want the NPCs to disappear when they hit the other end of the map, not if they hit into the player.
Is there an easy way to do this?
Yes.
You can do this using events.
You can have an NPC move a step, then get the position X and Y and put them into variables.
Then you make a conditional branch. If the NPC is near the borders of the map, (you check this using X and Y coordinates and you got them updated into variables on each step) well you make them disappear,
else you do nothing.
P.S. Check out my singature. It might save you a lot of search time.
Thank you for the fast answer. Could this cause lags when you have let's say about 10 of NPCs working like that in a smaller map.
It is possible yes...
but tell you what, I have good news for you!
Google "Moghunter's anti lag scripts"
at the atelier RGSS download "Master Demo"
In it there are the scripts.
Even having lag... by copy paste these scripts in your project in the appropriate position, well... you will have no problem.
Yes, because you're using parallel processes on several events. It could also cause problems if you're using the same variables for all of them - one might set the variables, then another might reset them before the first one acts on their values.
If you know where they're coming from and where they're going to, you can just use an autonomous move route to make them walk the necessary number of steps then set graphic to none. If you want them to reappear in another place and keep walking, it might get a little harder (though you could just do a Script command within the autonomous move route and put moveto(x, y) where x and y denote the next point you want them to go to.
Usually you just put them on random movement and they wander around wherever they want.
Thank you both for your answers. 🙂