Jump to content
Phil-S

Questions on touching enemies on map resulting in a battle

Recommended Posts

Hello everyone. I'm looking for the best practice to use in having enemy sprites that are on a dungeon or field map that when the player touches them, a battle begins. Should I use switches, variables? When should the enemy sprites return to the map? If I did it when the player left the map, does that mean I'd have to flip a switch on every event that lets the player leave the map?

 

Thanks, all!

Share this post


Link to post
Share on other sites

Depends on if the enemies respawn or not. If they never respawn, all you need to do is turn on a self-switch in the event.

 

If you want them to respawn after a certain amount of time passes, you'll need to use variables to set up timers. The only way off the top of my head is to make a variable for each enemy event. I'm curious if there's a simpler way.

 

If you want them to respawn if the player leaves the area/map and comes back, you can still use self-switches. There's a scriptlet that allows an event to change another event's self-switch:

 

$game_self_switches[[map id, event id, "A"]] = false 

 

("A" is the self switch letter.) False turns the self switch off.

  • Like 1

Share this post


Link to post
Share on other sites

If you want to make an event disappear until the player leaves the map and returns, the simplest way is to use the Erase Event command.

  • Like 1

Share this post


Link to post
Share on other sites

If you want to make an event disappear until the player leaves the map and returns, the simplest way is to use the Erase Event command.

 

If it's as simple as that, and the event/enemy encounter will come back once the player returns to the map, that works great! Thanks, devonm0!

 

Also, I will look into your advice, lonequeso! That might be something I try out for a more advanced practice. Thanks to you both!

Share this post


Link to post
Share on other sites

 

If you want them to respawn after a certain amount of time passes, you'll need to use variables to set up timers. The only way off the top of my head is to make a variable for each enemy event. I'm curious if there's a simpler way.

Setting move route is the simpler way. (because you'll be able to simply copy&paste that to enemies)

After battle in a winning condition turn some self switch ON.

Now in another page with that self switch as a condition (page, where he's transparent), put only the move route command and turning the self switch OFF at the end.

In the move route put Wait commands and leave the wait for completion box ticked, so only the event will wait and at the end it will turn the self switch OFF turning back to the first page, where he is active.

 

Haven't tested that though, but that's what came to my mind and should work.

Share this post


Link to post
Share on other sites

What riki says makes sense since the enemy will still have its own self-switch activated even if you leave the map. We use this self zwitch shen we want one event to make differdnt things happen on the same map od if we want an event to be a one time deal and then turn on a self switch which activates an empty page to prevent events from repeating.

In theory this would would but I don't think the Wait command ticks down frames if you leave the map the event is at, so you would have to stay on that certain map to make enemies respawn. What lonequeso suggests is possible if you use a single variable and make it count down on every map in your game as a parallel pro ess. Sure, this makes monsters spawn all together but it beats having to assign a variable to every individual event.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted