Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Non-random battle Monster system?

I couldn't find any scripts on how to do this so I figure an event based one could work.

Here is an example of what I am talking about (minus the battle system):

I want it so that if you near a monster that it tries to go near you and if it does then it would Call Battle Processing.
But I also want it so if you hit the monster before it touches you then it could stun it for a little while (just like in the video).

Please help!

*If there is already a way to do it please link me because I can't find it anywhere.*
 
You might want a View Range script for this, so you can make an event and check whether you're near it. If you are, it would trigger a self-switch, and on a second page have the enemy do "Battle Processing" on Event Touch.

For stunning the enemy beforehand, you can try a parallel processing event that checks if you're pressing a key, and then if you're one tile next to the monster (using variables). You can show an animation or something of the player hitting the enemy, and turn on a switch. In the enemy event, create a new "stunned" page with a Fixed move route. Then you can use "Wait x frames" and then turn off the switch.

Good luck with it!
 
Regi":ah176q9e said:
You might want a View Range script for this, so you can make an event and check whether you're near it. If you are, it would trigger a self-switch, and on a second page have the enemy do "Battle Processing" on Event Touch.

For stunning the enemy beforehand, you can try a parallel processing event that checks if you're pressing a key, and then if you're one tile next to the monster (using variables). You can show an animation or something of the player hitting the enemy, and turn on a switch. In the enemy event, create a new "stunned" page with a Fixed move route. Then you can use "Wait x frames" and then turn off the switch.

Good luck with it!

That script is great!
But how would I make it so that if the enemy event sees the player, that the enemy would go towards the player?

I am confused on how to do this. Please help!
 
Have you tried the demo? There might be further instructions in there. I'm not exactly sure what it does after the enemy sees you (comments are in German), but first you would use the code
Code:
in_radius?(event_id,'Player',d,0)

Where you'd replace event_id with the enemy's ID and d with the number of tiles you want it to see.

Good luck with it!
 
Regi":3av5rzmn said:
Have you tried the demo? There might be further instructions in there. I'm not exactly sure what it does after the enemy sees you (comments are in German), but first you would use the code
Code:
in_radius?(event_id,'Player',d,0)

Where you'd replace event_id with the enemy's ID and d with the number of tiles you want it to see.

Good luck with it!

I put in this code so that when the enemy sees me that it goes towards me:
http://img145.imageshack.us/img145/908/99168653oc6.jpg[/img]

How can I make it so that when the event touches the player a battle starts?

*I can't make it a "Player Touch" event since all the events are already "Parallel Processes" with the View Range script!*

Help me!  :cry:
 
Okay, I'm editing to post some screenshots of the way I'm doing the (roughly) exact same thing in a current project.

This is the default setting of the event.  It's running the Detector common event to try and spot the player.  When the common event detects the player, it activates a self switch.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

Next, we have page 2 of the event.  With the player now detected, it only needs to charge the player, and so it does.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

Page 3 of the event is just the "dead monster" condition, and isn't important.

Here, however, is the Detector common event.  This is a very simple one-- the monster doesn't have a facing.  It's not too hard to work up a version that will take the monster's facing into account.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

...this is for XP, but it should work fine for VX, too.  Does that help?
 
This
Unka Josh":zxu0ljc2 said:
Okay, I'm editing to post some screenshots of the way I'm doing the (roughly) exact same thing in a current project.

This is the default setting of the event.  It's running the Detector common event to try and spot the player.  When the common event detects the player, it activates a self switch.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

Next, we have page 2 of the event.  With the player now detected, it only needs to charge the player, and so it does.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

Page 3 of the event is just the "dead monster" condition, and isn't important.

Here, however, is the Detector common event.  This is a very simple one-- the monster doesn't have a facing.  It's not too hard to work up a version that will take the monster's facing into account.

http://i234.photobucket.com/albums/ee10 ... tector.png[/img]

...this is for XP, but it should work fine for VX, too.  Does that help?

This seems simple enough, but I can't seem to find the "Detector" common event anywhere </3. Please post link.

Also how would I (after I put in the Detector event and everything) make it so that the monster does NOT disappear if your player runs away from the battle (during the battle)?

(>.<)
 
The "Detector" common event is in the last screenshot Unka posted.

Unka, the only problem is you can't change the distance enemies see, unless you create a new common event.

If you don't want the monster to disappear after running away, you can turn on another self-switch on Parallel that waits a few seconds, then goes back to the first page (turning off the self-switches in the process).
 
Regi":2nahz826 said:
The "Detector" common event is in the last screenshot Unka posted.

Unka, the only problem is you can't change the distance enemies see, unless you create a new common event.

If you don't want the monster to disappear after running away, you can turn on another self-switch on Parallel that waits a few seconds, then goes back to the first page (turning off the self-switches in the process).

Your right Regi, I'd rather stick with the view range script so that I can control the view range of the enemies.

I made it so that the enemy does go towards the player for a few steps when spotted, but can't figure out a way to make it so that when it touches the player a battle starts.

Here is the pic:
http://img242.imageshack.us/img242/5908/35406160oh3.jpg[/img]

I tried making a switch with battle processing with "Player touch" and Event touch" but both failed.
Help me!  :cry:
 
What I would do is create a new event page instead.

Page 1, Parallel Processing:
Code:
@>Conditional Branch: Script: in_radius?(9, 'Player',3,0)
   @>Control Self-Switch A == On
 : Branch End

Page 2, Condition Self-Switch A is On, Custom Move Route, Event Touch:
Code:
@>Battle Processing: Enemy
 : If Win:
     @>Control Self-Switch A == Off
     @>Erase Event
 : If Escape: 
     @>Control Self-Switch B == On

Page 3, Condition Self-Switch B is On, Parallel Process:
Code:
@>Wait: x frames (however long you want the player to be able to run away)
@>Control Self-Switch A = Off
@>Control Self-Switch B = Off

Something like that. Good luck with it :thumb:
 
Regi":37uentes said:
What I would do is create a new event page instead.

Page 1, Parallel Processing:
Code:
@>Conditional Branch: Script: in_radius?(9, 'Player',3,0)
   @>Control Self-Switch A == On
 : Branch End

Page 2, Condition Self-Switch A is On, Custom Move Route, Event Touch:
Code:
@>Battle Processing: Enemy
 : If Win:
     @>Control Self-Switch A == Off
     @>Erase Event
 : If Escape: 
     @>Control Self-Switch B == On

Page 3, Condition Self-Switch B is On, Parallel Process:
Code:
@>Wait: x frames (however long you want the player to be able to run away)
@>Control Self-Switch A = Off
@>Control Self-Switch B = Off

Something like that. Good luck with it :thumb:

This is great, I did all that and it works well, minus one problem.

After the enemy finishes its custom route towards the player and it DOES NOT touch it to start a battle (player successfully ran away on the field), it  just stands there and no switches are triggered unless the actor goes back and touches the enemy to start a battle.

How do I make it so that if the player runs away (on the field) and the enemy's custom move route finishes (i.e. 5 steps towards the player), that the enemy goes back to its original Page 1.

Help me! T.T
 
Okay, on page 2, in the "Custom Move Route" command, after the 5 steps, use the script function and type:
Code:
$game_self_switches[[mapID, eventID, "A"]]=nil

If that doesn't work, follow it with a
Code:
$game_map.need_refresh = true

(All that does is turns off the self-switch. Replace mapID and eventID with the enemy's corresponding numbers.)
 
Regi":ko6qlg86 said:
Okay, on page 2, in the "Custom Move Route" command, after the 5 steps, use the script function and type:
Code:
$game_self_switches[[mapID, eventID, "A"]]=nil

If that doesn't work, follow it with a
Code:
$game_map.need_refresh = true

(All that does is turns off the self-switch. Replace mapID and eventID with the enemy's corresponding numbers.)

Regi, you are the best! It totally works now!

Just one more thing, how would I do it so that after the player beats all the enemies on the map and they all disappeared, that if the player leaves and comes back into the map, it refills with NEW enemies?

Sorry for being a nuisance (>.<)
 
Make sure once you defeat the enemy (after the Battle Processing) you turn all self-switches off and then use Erase Event, that way it will automatically reset back to normal once you leave and return.
 
Regi":6argksjq said:
Make sure once you defeat the enemy (after the Battle Processing) you turn all self-switches off and then use Erase Event, that way it will automatically reset back to normal once you leave and return.

Phew, great help again Regi!
This helps me so much! Thanks so much!  :lol:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top