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.

Assistance with an event driven battle system [RMVX]

I'm currently working on a 100% event driven custom battle system in RMVX. I have the system and concept planned out, and I know exactly how to go about doing it. Save for one aspect which really has me stumped.

Esentially, it is a turn based system where the user selects a command and their character carries out a short action on the map, much like a cutscene. It could be something simple like running at the enemy and slashing them with their sword before jumping back two spaces, or it could be slightly more complex and have the player leap over their opponent and kick a chair at them, causing them to either be struck or dodge the object that has been sent at them. Therefore depending on the environment and a lot of other factors the character or enemy could end up in a completely different tile to the one on which they were first standing.

I have that part planned out perfectly, and it's no problem for me. The only issue I have is making the character and enemy move to eachother. I know there must be a method of detecting the players current location and having the enemy move to it, but I'm really drawing a blank on this one. I assume it has to do with storing the current x and y axis in a variable, but beyond that I have no idea. :dead:

So I figured that rather than spending hours lost in the event menu with my mood getting steadily worse, I would throw this question to the experts on this board. I would really appreciate any help you can offer. :)
 
For the event, there is literally a move command that is Move toward Player.

For the player, get the X and Y coords of the player and the event.

>Control Variables: [0001:Player X] = Player's Map X
>Control Variables: [0002:Player Y] = Player's Map Y
>Control Variables: [0003:Enemy X] = [Enemy]'s Map X
>Control Variables: [0004:Enemy Y] = [Enemy]'s Map Y

Player X - Enemy X = The difference in location of the player and the enemy on the X axis (X)
Player Y - Enemy Y = The difference in location of the player and the enemy on the Y axis (Y)

I Y is a negative number, you know that the player is above the enemy.
If Y is positive the player is below the enemy.
If X is positive the player is to the right of the enemy.
If X is negative the player is to the left of the enemy.
If Y is 0 then the player is either exactly left or right of the enemy.
If X is 0 then the player is exactly above or below the enemy.
 
Regimos":2ypvroma said:
Correction to Demodronik's post-- if X or Y is 0, then the player is on the same tile as the enemy :tongue:

You mean if both Y and X are 0 you're on the same tile as the enemy.
Not Y or X... You can be on the same Y or X axis as the enemy without necessarily being on the same tile.
 
Sorry for the late reply. I've been really busy for the last couple of days, making it extremely difficult for me to find spare time. xD

Thank you both for your help. I think I may have solved the issue with your assistance. I really appreciate it. :)
 

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