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.

Approach Monster Battle System - How to do it effectively?

I don't know if this has already been discussed if so please link me to a good post or tutorial.
I am making a system where you can walk into monsters and not just random encounters. Details are in my sig. I have it all figured out except a few things for which I am about to ask.

1) Is there a way to make the programming "get" the direction facing of the character and the monster --- then if for example the player is caught from behind he gets into a penalty battle?
Also if that's possible, in battle events what's a good triggering to use for penalties and player advantages?

2) I have them to disappear when you win a battle , i.e. set Self Switch A. on the next page, when switch A is on, it waits 999 frames then turns off switch A, effectively respawning it.
Is there a better method to do this? Because I think it will only wait 999 frames when the player is on the map of the event.

3) Is there a way to easily animate the PC swinging his weapon by pressing a button and if the monster is struck the player has advantage?

4) Is there a way to customize the monster's movement route better? For example I want to set it so that it sets a random direction as a variable, then moves in that direction 3 times, randomizes the variable again etc so the random movement is more smooth.

Much appreciated.
 
2) An easier way to do this is have the monster set to Player/Event Touch and give it a Battle Processing command. When the battle is over, Erase Event so that the event gets deleted if the battle is won, but respawns when you re-enter the map.

4) Set the event to Parallel process and put this all in a Loop: Control variables Direction Set Random 1-4. Have 4 Conditional Branches dealing with variables representing each direction. For example, If variable=1, set move route Move Right x3. I twill then loop to setting the variable again and the variable will decide which direction it moves. Although, I don't know how you'll be able to get in a battle with the monster if the trigger is set to Parallel Process.
 
Tyvm I'll try those when I get home. So that's what Erase Event is for. I always found it a bit strange how it semi-works.
Maybe I'll do this for the move routes :
Set variable x
This event ->
Move x
Move x
Move x
Set variable again
repeat.
Is there a local variable for the Events? Or variable arrays? Because it'll be better if they were separated from other events, otherwise all the monsters on the screen would go in that X direction :/
Sorry I am new to RM
 
This might be a little complicated without scripts, but you can try the following.

For #4: Try four different pages of self-switches instead of variables. The entire event would have 5 pages, set up as follows:

1st page: Parallel Processing. Set a variable to a random number between 1-4, then use Conditional Branches to check the number and turn on either self-switch A, B, C, or D.

2nd page: Event Touch, Conditions: Self-Switch A is On. Custom Move Route: Move Down (x3)

3rd page: Event Touch, Conditions: Self-Switch B is On. Custom Move Route: Move Left (x3)

4th page: Event Touch, Conditions: Self-Switch C is On. Custom Move Route: Move Right (x3)

5th page: Event Touch, Conditions: Self-Switch D is On. Custom Move Route: Move Up (x3)

In pages 2-5, set the commands so when the event touches the player, a battle initiates; then turn off the self-switch for that page and "Erase Event."

Also in pages 2-5, in the Custom Move Route, after the 3 "Move x", use a "Script" command with:
Code:
$game_self_switches[[$game_map.mad_id, self.id, "A/B/C/D"]] = nil; $game_map.need_refresh = true

This turns off the self-switch after the 3 moves are done, going back to the first page and randomizing again.



For your other questions:
1) You can try nested Conditional Branches checking if the player and enemy events are both facing the same direction. If so, turn on a "Penalty Switch." In battle, you could penalize the player by making them unable to move ("Force Action: Do Nothing" for the entire party) or give them some kind of status effect that lasts 1 turn.

3) The easiest method would be some kind of script. You could try a Parallel Process: Common Event. Use a Conditional Branch to check if a button is pressed; if so, change the player's graphic to the attacking graphic and turn on a switch, wait a number of frames, then change it back and turn the switch off. Then in your enemy event, use a Conditional Branch that checks if the switch is on when the enemy touches the player; then check if directions are the same; and if so, turn on a new switch that penalizes the enemy, not the player.
 
Update - the script for movement didn't work as the monster just gets stuck and keeps going the same direction. I think its because the Self Switch Off script in movement didnt work. I even tried making the mad_id map_id because mad_id crashed.
Anyway that's not too important because I found a way to make it look nice by moving random direction x3 then waiting for 30 frames it gives a better effect than continuous movement.
Going to try the other scripts now

Woo, the facing thing worked~ :D
But there's one slight problem. I'm having to resort to minusing 1000 agi for turn 1 then adding it on in the 2nd turn in order to effectively skip a turn ( cause sometimes even after Do nothing the player has another turn due to high Agi) . I'm wondering if there's a better way , like adding +1000 Agi to the monster via script to make things streamline better? Cause there's no GUI options for it.
Also this means I needa put this in every Troop @_@ Is there a way to do it with common events? Because I tried and it failed to work.
11bm8hg.jpg


Going to try the animation later.
 
For the random movement, let's just replace the script. Paste this above main:

Code:
class Game_Character

  alias crm_init initialize

  def initialize

    crm_init

    @steps = 0

  end

  def move_type_random

    if @steps % 3 == 0

      move_random

    else

      move_forward

    end

    @steps += 1

  end

end
 
Thanks anyway but it didnt seem to work. Monsters are stil moving in one square bursts. Did you intend that script to be for the PC's movement?

Also now I have problems with escaping. No idea why but my PC cannot escape from battles while fighting an on-screen enemy but can escape fighting random map encounters on default.
 
Did you have the Autonomous Movement set to random? And no Custom Move Route or Move Route command?

I did not intend it for the PC. (very rarely would someone make the PC move randomly.) Although, if you did it should still work.
 
Number 4 is really, really simple. No scripts needed.

Set this in the event's custom movement;

>Move at Random
>Step Forward
>Step Forward

Check the ignore if not possible box, just in case it runs into an obstacle.

That should be good, unless I've misunderstood what you asked. Sheesh, Occam's razor, people!
 
Haha, how did we overlook that? Yeah, just use "Step Forward", not the complicated self-switch method.

For disadvantages, try making a new state that sets Agi to 200% and use the "Change Enemy State: Entire Troop" command (or set Agi to 0% and apply it to the player). (Have the state remove itself after 1 turn.) Unfortunately you'll have to copy-paste the code onto every single troop, there's no other way around. The only way to simplify is, if you have a lot of code, move it onto a Common Event and just use "Call Common Ev."
 
Thanks everyone.

Metatron":7hnk09gr said:
You can have the entire player party stunned for the first turn, that's what I do.

Stunning wouldnt work either if the player has a lot more agi than the monster, the player will get another turn.

Lol that's very enlightening Brunotr. I will try that.

Regi I will try what you said when i get home. I never saw an obvious GUI command for enemy AGI though. It sounds great if its possible to call a common event to replace the code , because if you need to change code you dont need to do it on every troop in future.

And brew yes I had it on custom move route, I guess it should just be on random.
 
I'm learning heaps, and I got everything solved - I put a lot of stuff into common events and now they are so easy to edit when I need to. Anyway I still have two problem then I got the whole system done :)

1) The attack animation, hmm.. I dont know if I can animate sprites i have never tried it. But anyway .. is there a way to make his spear appear graphically to the +1 direction facing of the PC? So that it looks like he is thrusting it. I tried with variables but there is no GUI option. I set the player X and Y and was hoping to do something like X+1 but no avail haha.. I think War3's GUI is much better in that regard , how you can control variables easily using GUI.

2) Cannot escape from battle, the option is there but when you press it there is a cancelling sound and nothing happens. I have no idea why it does that .. maybe it doesn't register it as a battle when it uses a trigger like call battle.
I am using Charlie Lee's CBS. Does anyone know where the problem lies in the script and how to fix?
 
1) The easiest method would be to actually sprite the guy thrusting a spear and put it in a charset, then use "Set Move Route: Change Graphic" to show it. Showing a spear in front of the player is possible, but it'll take more work. If you really want to do that method, you have to set the player's X and Y coordinates in two variables; then check which direction you're facing in Conditional Branches, and depending on the direction, modify the X or Y variable so it's one tile in front of the player; then use either "Set Event Location" or "Show Picture" (for the former, you'll have to make a spear event on every map, which is kinda tiring; for the latter, multiply the variables by 32 because it has to be in pixels).

2) It might be just that your escape failed (some battle systems don't show a message). If that's not the case, you'll have to contact the author or make a help topic in RGSS Support about it.
 
Thank you very much I did a frame by frame animation of the weapon so it looks like its actually being thrusted.
The animation of the PC isn't too MUI though, because it uses the Movement Route commands .. and sometimes the PC gets stuck with the Stop animation on -i.e. he keeps attacking blindly.
How do you make the PC be paused so that movement commands won't override the GUI triggers? would Wait work? I think I added wait but it still overrides

It's pretty much finished now so i'll post a demo.

Battle system demo/mapping : http://www.mediafire.com/download.php?umzyqz3mh2m
Press A to attack in the map. and Z to dash (keyboard).
 

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