Delete NPCs under a specific condition

brandos

Veteran
Veteran
Joined
May 25, 2013
Messages
147
Reaction score
31
First Language
German
Primarily Uses
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?
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
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.
 
Last edited by a moderator:

brandos

Veteran
Veteran
Joined
May 25, 2013
Messages
147
Reaction score
31
First Language
German
Primarily Uses
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.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
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.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
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.
Wow... talking about optimization... great comment! 

Actually what @Shaz said is a really good way to do this.

It's better to keep it light instead of fixing an overload.
 
Last edited by a moderator:

brandos

Veteran
Veteran
Joined
May 25, 2013
Messages
147
Reaction score
31
First Language
German
Primarily Uses
Thank you both for your answers. :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,854
Messages
1,017,004
Members
137,562
Latest member
tamedeathman
Top