Help - Search - Members - Calendar
Full Version: Need some opinions/help
RPG RPG Revolution Forums > Scripting > Event Emporium
Vexus
Hi, I'm making my town "lively" by adding routines to npcs with a day/night system and so far I think I finally managed to make it work. (Tough sometimes they screw up alone even tough the game doesn't lag or anything as I keep a static 38-39 fps.)

The events trigger at different times or require certain switches but 1 thing I need to figure out is how will I regulate their events if I'm inside some cave or house when the time has passed. (For now I was thinking on having events inside every house/cave that would make switches turn on/off at x time for each npc that has routines when your still inside.)

Now the biggest problem is I'm using move route for the npcs movement to lessen fps impact but I have certain npcs that walk in a place, stay there and when it's time to go home for the night they start walking from there. The problem is when you enter a house and exit again the npc will obviously be teleported back where they are placed initially instead of where they were. This means that currently when I enter a house and exit it and a certain event should start walking his route from a different position it will get stuck and never complete it's route unless I find a way to solve it. (I'm also afraid that with all the parallel process events some steps might gets skipped.)

So what would you guys do so that each npc that has routine could progress normally even if you enter a house and exit again?

I know it might sound confusing but if you guys require more information just post and I'll try to explain better.

Thanks
amerk
If I'm not mistaken, events will always begin again from their original spot unless they are coded not to, which can get very tedious. It's a lacking feature in RM for an event to memorize its location. I believe there is a script that fixes this for VX, but I don't know if there is one in XP. You could always ask around in the scripts request to see if somebody knows.
Rast
Well, I did something of the sort in an old RM project(albeit in Rm2k3) that never took off. What I did was code each NPC to store it's X/Y position into variables(Which obviously resulted in a ton of variables).

My old method
The first page of each NPC event required their Y variable to be 0. As it was impossible to be at 0,0 on any of my town maps, this would only happen if the player had entered that area for the first time(because the variable hadn't been initialized, and RM treats uninitialized variables as 0). On this page, it would record their X and Y position to it's respective variable.

On page two, the requirement would be that their Y variable is above 0. This page would record the event's X/Y position to it's respective variables.

The third page would require the switch "Not In Town" to be on. This switch would be turned on when going into any building or area outside the town. The page itself would set the event's location to it's last recorded X/Y position, and then turn the switch "Not In Town" off, returning the event to page two where it would continue recording it's location.

The downside to this is that with a ton of NPCs, there will be a lot of recording, and it might slow things down. You can ease this a bit by coding it to only record the position every few seconds, though you'll probably get a bit of lag anyways.


Though that's outdated and slow, and probably not quite what you're looking for. One method I thought of trying(but never did) was coding all the routines manually and updating it when the player entered the town. For example...


In a common event set as a parallel process, you change a variable that keeps track if where an NPC should be. It would updated a variable for each NPC, perhaps setting it to something like 1410 to represent an X value of 14 and a Y value of 10. Then, in the event itself you'd check the variable and move it where it should be by that time and set a correct move route for it. This would obviously work better for static NPCs.

At any rate, doing this with events will be complicated, and in RMXP you're probably better off searching or requesting a script.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.