I know how to do this with player character, and it's really easy...
But how do I do that with some other character. If he walks onto a region ...
If anyone can help me I would be very grateful.
Thanks in forward! :)
Add the room's repeatedly_execute event. In there, use something like this:
// above function
int npc_prev_region;
// inside function
if (cNpc.Room == player.Room) {
Region*re = Region.GetAtRoomXY(cNpc.x, cNpc.y);
if (re.ID != npc_prev_region) { // Npc changed current region
if (npc_prev_region > 0) {
// Npc walked off region npc_prev_region
}
if (re.ID > 0) {
// Npc walked onto region re.ID
}
npc_prev_region = re.ID;
}
It's kinda complicated, and It'll take time for me to understand that code but...
It will probably work so...
thanks !!! ;D
guess my problem is solved.
thank you khris
It's not that complicated really, all that does is check if the NPC is in the current room and if they are, constantly keep track of the region they're on.
For that, the current region is checked against the previous one 40 times per second, and if they aren't the same any longer, the NPC must have just changed regions.
Both events are handled, then the previous region variable is updated.
Yes... I think I understand it now.
It works. :)