toto8080

Villager
Member
Joined
Feb 26, 2018
Messages
15
Reaction score
0
First Language
German
Primarily Uses
RMVXA
I'm currently working on a project where a monster is chasing the main character through a labirinth.

I would like to make script (or an event mechanism), if the player pushes a button then automatically drops an object - or an item from his inventory - just front of himself to block the monster's path.

I searched all over the internet, but I didn't found anything, which would be useful to my case.
Can somebody help me, please?
 

GiddyPeak

Villager
Member
Joined
Jun 10, 2016
Messages
16
Reaction score
7
First Language
English
Primarily Uses
Would this be in specific spots or just whenever the player presses a key? Because if it's the former, it'd be a simple case of having blank events where the item is to be dropped, then activating a switch on button input processing which makes the graphic appear on a new event page of the blank event.
 

Harrumi

Veteran
Veteran
Joined
Dec 13, 2017
Messages
194
Reaction score
620
First Language
English
Primarily Uses
RMMV
I don't know about a script that does this, but you can create an invisible event the player steps on that creates that kind of thing. ... maybe like a landslide or something from the vibrations of the monster creates?
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
207
Reaction score
315
First Language
French, German
Primarily Uses
RMMZ
If you're ok with only 1 item blocking the monster's path, it would be a simple matter of creating an invisible event, then moving the event (set event location) behind the player (use "get location info" to save the X and Y coordinates in a variable, and modify X or Y depending on the direction the player is facing) and changing its appearance.

You could also have multiple events, so the player can drop multiple blocks. You'd use a variable to cycle through the blocks, so whenever you've dropped all the blocks available, the next block would be the first one dropped. You'd need a "drop block index" variable, which you'd increment by 1 every time the player drops a block, then use the "Mod n" operator where "n" is the number of blocks available to drop. The index would go from 0 to n-1, and you'd need to handle the correct block for each index. It's a lot of work, but it gets the job done.


Otherwise, you'd need a script that can generate events on the fly.
Unfortunately, I'm not very familiar with RGSS, so I can't provide you with one.
 

toto8080

Villager
Member
Joined
Feb 26, 2018
Messages
15
Reaction score
0
First Language
German
Primarily Uses
RMVXA
If you're ok with only 1 item blocking the monster's path, it would be a simple matter of creating an invisible event, then moving the event (set event location) behind the player (use "get location info" to save the X and Y coordinates in a variable, and modify X or Y depending on the direction the player is facing) and changing its appearance.

You could also have multiple events, so the player can drop multiple blocks. You'd use a variable to cycle through the blocks, so whenever you've dropped all the blocks available, the next block would be the first one dropped. You'd need a "drop block index" variable, which you'd increment by 1 every time the player drops a block, then use the "Mod n" operator where "n" is the number of blocks available to drop. The index would go from 0 to n-1, and you'd need to handle the correct block for each index. It's a lot of work, but it gets the job done.


Otherwise, you'd need a script that can generate events on the fly.
Unfortunately, I'm not very familiar with RGSS, so I can't provide you with one.

I managed to get player's X and Y coordinates, but where can I modify them?
The block spawns on the player and not front or behind of him.
Is there a way to make the drop with just 'one button press' and not via selecting it in through the inventory?
For better understanding: I followed this tutorial, but I want a different kind of mechanism, like I described earlier.
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
207
Reaction score
315
First Language
French, German
Primarily Uses
RMMZ
I was writing my reply, but the site refreshed and now my reply is gone...
I managed to get player's X and Y coordinates, but where can I modify them?
The block spawns on the player and not front or behind of him.
To edit the X and Y coordinates, you need "Control Variables...". You can then "Add" or "Sub" (subtract) a "Constant" (1) from the variable.
You can find out which way your character is facing using "Conditional Branch..." inside which there's "Character (Player) is facing (Up/Down/Right/Left)".

Is there a way to make the drop with just 'one button press' and not via selecting it in through the inventory?
Yes, but you'll need RGSS for that.
The people in the RGSS3 Scripts (RMVX Ace) forum are likely better suited to help you than I am.

Essentially you want to know:
  1. How to implement specific behavior on button press (like how pressing Shift makes the player dash).
  2. How to customize the Item menu so the player can choose a default object to drop when pressing the button (as well as how to save that default item, so when the player reloads the game, they don't have to change the default object again).
  3. How to call the event from within RGSS.
  4. (Extra) If you need this feature in more places than the labyrinth (or you have multiple labyrinths), you might want to implement the whole even thing as RGSS script. So you'll also have to learn how to create events from within RGSS (in which case you can ignore point 3).
 

Latest Threads

Latest Posts

Latest Profile Posts

Tempted to come up with a unique spell naming system....But ''Fire Magic'' and ''Fire,Fira,Firaga'' are so easily recognizable :p
Yesterday I discovered that I can copy/paste multiple commands by holding shift. I tried this when I started developing holding ctrl and when it didn't work I just copied every single command one by one. For two years.

I am in heaven now.
All right, so lesson learned. No more complicated battle systems for me.
Whew, just finished a whirlwind of deadlines. Finally a tiny break. You know...I should go update my 2020 banner now.
image_2021-06-16_153010.png

Why are barrels to difficult? xD I feel like i Barrel...y made it....eh EHHH!? :p

Forum statistics

Threads
112,281
Messages
1,067,070
Members
145,905
Latest member
Hanayura
Top