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.

rm2k help collision detection

Injury

Awesome Bro

Hey HBG I really need your help

I need to find a way to:

-find the hero
-find out if the hero can go down left right up and assign it variable
-deny movement if hero can't move
-allow movement if attempted move is legit

I really need some help on this, I've tried a lot of different things!


Let me know if you have any ideas!
 
I don't know what you mean with "find the hero" (other than their coordinates, which you can set to a avriable easily), but as for movement possibilities, the easiest way I think you can go about it is working with a non-visible event that you plop onto the heroes location, then move it whereever (up, down, left, right, ...) and compare it's position with the heroes. From there, it's a matter of conditional branches.

Since that's quite a resourcey way... what exactly keeps you from moving to one of the newer makers and script it? ^^
 

Injury

Awesome Bro

I can't upgrade because this is a netbook. It doesn't support the resolution required to run the newer makers unfortunately.

I've actually have been trying that, but I don't know if I'm performing the moves in a way that registers correctly to corresponding variables that set the variables that determine which way the event, hero or event, can go. I'm using a system that would place a 1, where the possibility of movement is positive, in different places, ie if down is possible 1000 left 100 right 10 up 1
for example down, right and up are possible: 1011.

A ghost npc is placed on the event that you want. It then has a cycle that moves it down, left, right and up and puts it to a variable. Each time it moves, it puts itself back on the starting position and then makes its next move. As the moves are made, a variable is passed that accounts for the number of moves made. When it reaches 5, because there are 4 possible movements, it breaks the cycle.

Then I have a call to a common event that will pull the positions of the number and break it into whatever variable I want it to. It would break it down for each possible move with forks and move the event after its been allowed. After that, it would subtract a move from the available moves left, as the player/computer players rolls for their moves (1-6).

I've tried a few different things, but it never seems to register the moves in the moveProbability variable used in the system.


I reallly need some help on this one :P

if anyone would care to look directly at the game file, let me know.

thanks
 
I'm really wandering what you need this for at this point... because the whole variable thing only makes sense if you need quick access to the data, and we both know that 2k isn't your best match for speed. So, the simplified way I suggested would really make more sense: Have a common event triggered on right, left, up and down movements, and check it there directly.
 

Injury

Awesome Bro

I do have that system in place. It cycles through the directions and returns a value to the variable letting me know if I can move there.

The common events I have set up can call and place data quickly and throw them back to a variable of my choosing. When I do the movements, I have that event throw the data if the character can move to moveProbablility and then it would have to get the data to see if the move was possible.

I'm making a board game and I have to be able to control the players and the computers movements. Part of this system will control how the player moves, the other will control the computer AI based on possible moves.
 
I'm probably way to late with this, but since this is my first post and I'm pretty much a rm2k3 expert I couldn't help to solve this.

One of the easier ways to do this is to do this is using the terrain ID's. Since this is a boardgame, I don't think changing some stuff around here matters. I'll give you an example that uses that number system you used (1011 etc). You can also just use 4 variables to store the terrain ID and conditinal branch that (this will be more clear when you've read this message).

First go to the terraintab in the database to change two terrain entries. One is to be changed to possible and one to impossible (just names).
Second you go to your tilesets and in the editing mode menu you select the terrain. Everything that should be impossible to move to would be let's say, terrain type 2. Everything you can walk at should be terrain type 1 for possible.

After that you can put this code to whereever you want to check for move passibility. I'm not going to write it out fully, but you will know which commands to use:

Set var possibility to 0
Set var x to hero x
Set var y to hero y
Set var y to +1 (to see if down movement is possible).
Store terrain ID (found at page 2, use the location referenced from variables hero x and hero y. Store Terrain ID to var terrain ID)
Conditional branch
if var Terrain ID is 1 (it can only be 1 or 2, since we changed the terrain types in the database).
Set var possibility add 1000
Set var y to - 2 (to see if up movement is possible).
Store terrain ID to var terrain ID
Conditional branch
if var Terrain ID is 1
Set var possibility add 1
Set var y to - 1 (return y coordinate to hero).
Set var x to - 1 (see if left movement is possible.
Store terrain ID to var terrain ID
Conditional branch
if var Terrain ID is 1
Set var possibility add 100
Set var x to + 2 (see if right movement is possible.
Store terrain ID to var terrain ID
Conditional branch
if var Terrain ID is 1
Set var possibility add 10

(call whatever common event you have to translate the variable possibility code)

I hope this helped?
 

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