Projectile map ability

Niloc

Veteran
Veteran
Joined
Jul 27, 2020
Messages
47
Reaction score
3
First Language
French
Primarily Uses
Other
Hello,
I'm building a stealth game in which my character uses some sort of map abilities.

One of the ability I try to build is a projectile that my character can throw at one of the ennemies to temporarly stun them. What I want to do is, when the user press a specific key, then the player throw a projectile in the direction that the character is facing, and if it collides with an ennemy, then something happens to the ennemy.
I'm really not sure how to get started on this.
Here is a quick draw on how it would look :
ScStun.gif

Does anyone have an idea on how to do this ?
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
281
Reaction score
257
First Language
german
Primarily Uses
RMMV
Chances are high that there are already Plugins out there doing actions like you described. In short, I can tell you a solution that only requires eventing. When you are a beginner in MV then it could be a little bit difficult but it will teach you a lot of what RMMV can.

Make a Event with parallel process. It wont work well as Common Event, because with all the Variables and Event IDs some parameters are map-specific. Then make a Event that represents the bullet.

The bullet event (parallel process):
Place it at any location of your map. With eventing we can spawn it at the Player's position. The even't page should have a switch as condition so the bullet is only visible when the Player fires.

The main event (parallel process):
Using IF statements you can check if a specific key is pressed. Using Plugins you can expand it and use eg. the Ctrl button. But lets keep it simple and use Space. Once the player presses that key, you do this (roughly)
- store X, Y coordinates and direction of the Player using Variable OPs
- There's a command to move an event to specific position. Call this command and use the variables we just stored. Using a Move Event you can turn the bullet into the player's direction.
- Make some switch OP to activate the bullet event.
- by the way, once you gained more practice, you can use this switch as condition to not fire twice within a very short time

Now we go back into the bullet event:
- store its X, Y coordinates using Variable OPs
- the following must be repeated for each guard. So for each guard, you store their X, Y coordinates, too.
- using IF conditions, you can check if the bullet's X any Y coordinates are identical. Then you got a hit.
- you need some mechanism to erase the bullet and allow the Player to fire again. Turning off the Switch could do the trick.

Well, this is a very briefly instructions to do it. You may need some hours until everything works fine. But then you have learned a lot about RMMV to improve this mechanic. Like, the bullet should dissappear when it hits a wall.
 

Niloc

Veteran
Veteran
Joined
Jul 27, 2020
Messages
47
Reaction score
3
First Language
French
Primarily Uses
Other
Well that could work indeed, the thing I am a bit worried about with this method is that I'm gonna have maybe hundreds of Guards during the whole game, so I would have to individually store their coordinates all the time ?
 

Aerosys

Veteran
Veteran
Joined
Apr 23, 2019
Messages
281
Reaction score
257
First Language
german
Primarily Uses
RMMV
Ah okay, well then you should look if there's a Plugin out there or, if not, make a request in JS forums. I bet you are not the first planning to do this mechanic, so there should exist. a Plugin
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,416
Reaction score
4,479
First Language
English
Primarily Uses
RMMV

I've moved this thread to JS Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Yaaay! My second public script is out and approved! A VX Ace Final Fantasy IX styled Throw Script!

I look forward to all the constructive feedback I get but most importantly I hope everyone who ends up using it enjoys!

Yaaaay! Making scripts is fun lol. :D
When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.
Got inspired and started writing a simple tower defence battle system last night :o

Forum statistics

Threads
100,525
Messages
976,810
Members
132,080
Latest member
nwr
Top