Bleurgh

Warper
Member
Joined
Aug 29, 2020
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hi everyone,

So I've been searching everywhere for a tutorial on how to make falling boulders on the map screen (or any falling object for that matter) that interact and damage the player, but found nothing. So I decided to tinker about for a bit, and I'm happy to say, it works perfectly!

Now, it works perfectly.. But I feel it's not the most optimised method, so I'm open to any suggestions or ideas to improve the formula!

In short, I have created an event that randomly generates on the map as a shadow, waits a second, then a boulder crashes into it. If the player is standing on that shadow as the boulder strikes, they jump back and lose HP.

Requirements:
  • I managed to use the RTP shadow from img/system and convert it into a charactersheet using GIMP. I also copied over the boulder to a new character sheet, but removed the shadow underneath it. (You don't need to do this, but it looks better when falling).
  • A little bit of scripting for switches, but I can provide the details.
  • 2 events (Boulder and shadow).
  • No plugins are necessary, but you might want to find one that hides event shadows. (I use Visustella's EventsMoveCore which is free from their sample project on their site).
Let's get stuck in!

  1. Create your 'boulder' event
  2. Create your 'shadow' event
  3. Set shadow to random location
  4. Set boulder location
  5. Drop boulder​
  6. Get boulder info​
  7. Get hero info​
  8. Collision info​
  9. Reset trap​
Create Your Boulder Event
Create an event with two pages and place it anywhere on the map.

Your first page should be left blank, with no image.
The second page, should be activated when self-switch A is on. Have maximum speed and highest frequency. Set it to through. It should look something like this. Trigger is irrelevant, as all the work is done in the shadow event.

<Hide Shadow> is a plugin function from Visustella's EventsMoveCore, it's not necessary but does add to the overall look.
1648252742885.png



Create Your Shadow Event

Create your shadow event with two pages, and place it anywhere on the floor tiles. The first page image should be empty. Both pages should be parallel processes, below the character with the second page being activated once self-switch A is switched on.

Set Shadow to Random Location
For this scenario, I wanted the boulder to fall randomly on the map. I managed to assigning the shadow's X and Y coordinates a random number that correlates with the floor space on the map.
1648253300506.png
1648253312994.png




















I wanted to make sure that the boulder would fall between the 6th and 10th cells horizontally, and 5th and 7th cells vertically.

Now with these variables, we can set the event location as so..

1648253512350.png

Now each time this event iterates, it will move to a random location specified by the variables. I added a wait, so the player will see the shadow, and have a second to move out of the way accordingly before the boulder drops!

The first few lines should look something like this.

1648253582061.png

Set Boulder Location

Now, we need to set the boulder's location relative to where the shadow is.

This was simple enough, at this stage, I changed ShadowY's value and deducted 5 from it. You can deduct however many you'd like from ShadowY, but remember that your boulder will be that many spaces ABOVE the shadow.

1648253718550.png

We can now set the event location of the boulder, using the same parameters as the shadow, with the new ShadowY value.

1648253834388.png

Now the boulder is in place!

1648253890848.png

Drop Boulder

This is where I've used some scripting to remotely activate self-switches. Allow me to share the line of code I've used.

$gameSelfSwitches.setValue([14, 4, "A"], true);
For those of you who are unaware, the values in the brackets equate to:
$gameSelfSwitches.setValue([MapID, EventID, "Self-Switch letter"], On/Off(True or False);
So on Map 14, with Event 4 (Boulder), Self-switch A, is set to true (on).

It was a personal preference to use self-switches, otherwise you'll find yourself using a lot of switches if creating multiples of this event.

Now let's drop that boulder!

Firstly
I changed the image of the shadow event, to the image of the shadow. So now there's a visual representation of the shadow onscreen. Followed by a wait of 60 frames.
1648254272360.png

Secondly
I activated the self-switch of the boulder using the script call mentioned above. So now the boulder is visible.

1648254307329.png

Thirdly
Now I move the boulder down, ensuring that Through is On as to not just bump into the player or other objects/walls etc. I also added a few sound FX for immersion.

1648254399994.png

Now, depending on how much you deducted from the ShadowY variable value, should dictate how many times down the boulder should move. I deducted five (see image above in Set boulder Location) so my boulder must move five down to meet the shadow.

Now our boulder is set, time to get some location info!

Get Boulder Info
Now, we're going to need to store the boulder's location info into a few variables, and cross-reference this with the hero's location on the map.

Create BoulderX and BoulderY variables, and assign them the values of Map X, and Map Y of boulder.

1648254595780.png

Next, get the location info of BoulderX and BoulderY, and store them in another variable called BoulderLocation. With the info type set to Event ID.
1648254659866.png

Your page should look something like this.

1648254860083.png

Now we do the same with the player!

Get Hero Info
Again, we need two variables, HeroX and HeroY, which we store the hero's X and Y coordinates in.

1648254790649.png

Followed by a Get Location Info function that stores these two coordinates in a new variable called HeroLocation. Info type as EventID again.

1648254840455.png

Which should look like this..
1648254919346.png

Collision Info
Finally for this page, we need to determine what happens when the boulder collides with the hero.

Begin with a conditional branch, if BoulderLocation = HeroLocation. There's no need for an else branch.
1648254994599.png

Now within this branch, set your parameters on what you want to happen to the player. I would advise that it ends with you moving the player away from the coordinates, otherwise the branched action will repeat until the event is over!

For my event, I had the player take 100 damage and jump away from the boulder, but the possibilites are up to you!

At the end of this, activate self-switch A of this event.

1648255164221.png

And finally....

Reset Trap
Take a breath.. The hard part is over! Now, for the easy bit of resetting this trap!

On the second event page. Wait a certain number of frames, and switch of Self-Switch A of this event, and of the boulder (using the script from before, but setting the end value to 'false' instead of true.

1648255388017.png

And that's it! :D

Your trap should now reset itself and move to a new random location!


If this doesn't work for you I'm happy to answer any questions and troubleshoot! I'm not the most knowledgable and still consider myself a beginner, but I'll help out anyway I can!

If you have any suggestions on how to improve this, please let me know!

Have fun!

Bleurgh
 

Attachments

  • 1648254699230.png
    1648254699230.png
    35.6 KB · Views: 0
  • 1648255129221.png
    1648255129221.png
    30.8 KB · Views: 0
  • 1648255151617.png
    1648255151617.png
    37.3 KB · Views: 0

Latest Threads

Latest Profile Posts

So I kinda came back and learned how to mod other RPG Maker games so... Hello everyone!
Captura-de-pantalla-475.png
Version 1.0.1 done! Now finally free time... oh
Capture.PNG
I'm Really proud of how my game over screen looks!
UldJFr1.png
I felt inspired by a piece of art I saw. So I made this.

Wanderer Doge.png

Thought i'd be cool to have like a company introduction. Check it out!

Forum statistics

Threads
123,278
Messages
1,155,432
Members
161,674
Latest member
Luxheo
Top