MV Shooting system?

I am looking for either plugin, or some kind of guide that would explain how such thing could be created.

I saw a lot of Resident Evil games being made on RM, that have the real-time shooting systems that allow to damage enemies from afar, and some even have projectile animations.

So i want to learn how it was created, or just to find a plugin that would allow simillar thing.
Galv Map Projectiles or QJ Bullet would be the top plugins for that. They're both free.

Galv Map Projectiles or QJ Bullet would be the top plugins for that. They're both free.

Thank you. I assume there are not simplified guides to any of those two? It's been several hours already of me reading the descriptions, but still unable to understand how certain options for either plugin work.
Simplified guide? Not that I know of but I've used both and both come with demo projects.
Simplified guide? Not that I know of but I've used both and both come with demo projects.
Maybe you can tell me where in plugin description i can find those features:

- Changing the fire key from mouse to something else (because i don't know if it will work on controllers that have just one key for action).

- Setting the enemy. That one i understood how to do only for Galv's plugin, i know what comment text makes the event targetable, but i still have no idea how to change the hp of the target - everything requires only single shot.

As for other plugin - i just lost in the wall of text of the description, and failing to understand anything at all. I tried to look how the events are scripted on the map, and understood nothing. Part of the commentary being in chinese does not help(

The only thing that i might barely understand is how to set up shooting, but haven't tried yet, because i wanted to solve other problems first.
QJ Bullet is what I'm using now so I'll answer regarding that plugin.
It has two common events handling what happens when enemies hit and when the player is hit

Enemy hit:
1739898446767.png


Player hit:
1739898489581.png

You CAN make more of these if you have different bullets that do different things when the enemy/player is hit.
They're called under the Action: ["C[1,5]"] property in the bullet where 1 is the common event number and 5 is the power.

this.BP[1] is the bullet's power.
Code:
 "C[commonEvent id,value1,value2......]":start commonEvent and pass in parameters.
             (1) You can get the parameters in commonEvent. e.g:  this.BP[1] refer to value1.
             (2) You can use this.EID to get the Target character id.
                 -1 refer to player.the number greater than 0 refer to event.
             (3) Use this.bullet.x/this.bullet.y to get the x/y of bullet when it diasppears.

Bullet properties will look like this. The default is TouchInput, i.e. a mouse click or screen touch. You can change it to Input.isPressed('shift') or whatever you want.
1739900648390.png

If not using the mouse to aim (initial rotation M[]) you would have to go by player direction (PD[]) or something else?
1739900909539.png

Enemies have their HP defined on the first page. The first page is set to just define that enemy HP then self switch to the next page. The demo has the enemies on a spawn map and spawns them in.
1739898643475.png

The next page just defines what group it's part of
1739898803414.png


This is just the death page
1739898841174.png
QJ Bullet is what I'm using now so I'll answer regarding that plugin.
It has two common events handling what happens when enemies hit and when the player is hit

Enemy hit:
View attachment 331866

Player hit:
View attachment 331867
You CAN make more of these if you have different bullets that do different things when the enemy/player is hit.
They're called under the Action: ["C[1,5]"] property in the bullet where 1 is the common event number and 5 is the power.

this.BP[1] is the bullet's power.
Code:
 "C[commonEvent id,value1,value2......]":start commonEvent and pass in parameters.
             (1) You can get the parameters in commonEvent. e.g:  this.BP[1] refer to value1.
             (2) You can use this.EID to get the Target character id.
                 -1 refer to player.the number greater than 0 refer to event.
             (3) Use this.bullet.x/this.bullet.y to get the x/y of bullet when it diasppears.

Bullet properties will look like this. The default is TouchInput, i.e. a mouse click or screen touch. You can change it to Input.isPressed('shift') or whatever you want.
View attachment 331873
If not using the mouse to aim (initial rotation M[]) you would have to go by player direction (PD[]) or something else?
View attachment 331874
Enemies have their HP defined on the first page. The first page is set to just define that enemy HP then self switch to the next page. The demo has the enemies on a spawn map and spawns them in.
View attachment 331868
The next page just defines what group it's part of
View attachment 331870

This is just the death page
View attachment 331871

Thank you so much! You explanation were excellent and I got everything working, except for the last part - when enemy dies, i have this error. It seems like it wants to know what event to clear, but i am not sure where this should be selected.
I used to have same type of error about hit animation, because i forgot to set certain animation on hit. But this time i don't know where should i set the required parameter.

Also i have three more questions.

1 - Can i change the sound when shooting happens? Not the impact sound, but the shot itself.
2 - This question is only when you have gamepad (any) - what button makes you shoot, and which gamepad is that? The thing is that i don't have gamepad myself, but from people who tested game it seems like they have just one button that performs action. And since by default action is performed by enter and mouse click (and also space if i recall right), i wonder what button would work for shooting?
3) How do you write messages bellow picture? It seems like whatever i try to do that isn't working.
Due to that image with the error is here, and not above.

1739917118026.png
when enemy dies, i have this error.
Are you spawning the enemy in? I think that is the "unspawn event" command if you are using QJ's spawner. If it's not spawned in you would just erase event.

These are the default gamepad mappings
Code:
Input.gamepadMapper = {
    0: 'ok',        // A
    1: 'cancel',    // B
    2: 'shift',     // X
    3: 'menu',      // Y
    4: 'pageup',    // LB
    5: 'pagedown',  // RB
    12: 'up',       // D-pad up
    13: 'down',     // D-pad down
    14: 'left',     // D-pad left
    15: 'right',    // D-pad right
};

So if you have a parallel event with if(Input.isPressed('pageup'))
LB on the gamepad would fire that bullet.


These buttons aren't defined, but if you were to put this script in a plugin file or call it within the game they would then be defined (if you do it in game it won't save though, so you would have to rerun the script every game session
Code:
Input.gamepadMapper[6] = 'lt';//LT
    Input.gamepadMapper[7] = 'rt';//RT
    Input.gamepadMapper[8] = 'start';//start
    Input.gamepadMapper[9] = 'select';//select

I don't know what you mean by messages below the picture?
Are you spawning the enemy in?
No, have yet to test that in another level. I just have pre-place enemy for test.
You were right, replacing that with erase event worked.
So if you have a parallel event with if(Input.isPressed('pageup'))
And what button this reffers to?
TouchInput.isPressed()
It looks like no button defined, but left mouse click still fires projectile.

I don't know what you mean by messages below the picture?
If i paste the image on this forums i can't write underneath it. I tried clicking with mouse - area can't be selected, i tried shift+enter, does not skip picture, i tried moving it with mouse, moving past it with arrow keys...

And what about the shooting sound, can i add it? I think i need to add command to the parallel script call (that would be logical), but when i tried to add AudioManager.playSe({name: 'gun1', pan: 0, pitch: 100, volume: 100}); - i got "unexpected token" error.

And one more question about the common event - it seems like the plugin tries to read common event 1 on enemy hit. So if another event is on first spot, it is played instead. Can that be changed?
checking the gamepad, it seems 12 = not the UP d-pad
but rather 13 while I check down the triggers, I wonder is 12 is even correct
or to which controller it is.

I checked PS3, PS4, Xbox1, Xbox360 controllers input, but 12 isn't UP.

so which one is that correct?

I made reference to the 4 controllers input and why default doesn't match.

TouchInput.isPressed()
this is more mobile related or touch-screen related, gamepads are inputs,
not touch input.
this is more mobile related or touch-screen related, gamepads are inputs,
not touch input.
So if you are using QJ Bullet demo with one of your controllers, can you shoot? Because that is the default code there, and i would really like to know if it even works on controller, and if it does - what key is used to fire?
No, have yet to test that in another level. I just have pre-place enemy for test.
You were right, replacing that with erase event worked.

And what button this reffers to?
TouchInput.isPressed()
It looks like no button defined, but left mouse click still fires projectile.
TouchInput is click or touch screen press.
Input.isPressed('shift') is "shift" is pressed. X on the gamepad is mapped to shift by default so either pressing X on the gamepad or shift on the keyboard would make the bullet fire if you used

if(Input.isPressed('shift')){
//bullet script here
}
If i paste the image on this forums i can't write underneath it. I tried clicking with mouse - area can't be selected, i tried shift+enter, does not skip picture, i tried moving it with mouse, moving past it with arrow keys...
I just clicked to the right of the picture and hit enter to go to the next line
And what about the shooting sound, can i add it? I think i need to add command to the parallel script call (that would be logical), but when i tried to add AudioManager.playSe({name: 'gun1', pan: 0, pitch: 100, volume: 100}); - i got "unexpected token" error.
There's the moveJS property
Code:
MoveJS:The default is [].Specifies that after the bullet moves to a few frames, it starts
         to execute a script every few frames.
         Base format:
         [wait time before circling,waiting interval,script]
         wait time before circling:greater than 0.
         waiting interval:greater than 0.
         script:string.
         e.g:     [[60,5,"console.log(this.speed)"],[0,5,"console.log(this.x)"]]
         After the bullet runs for 60 frames, output the bullet speed to the console once, and then
         output the bullet speed to the console every 5 frames when the bullet starts running, the
         X coordinate of the bullet is output to the console once, and then the X coordinate of the
         bullet is output to the console every 5 frames.
         The rest are the same as UpdateJS.
I haven't tested it but you could try
Code:
MoveJS:[[5,9999999,'AudioManager.playSe({name: 'gun1', pan: 0, pitch: 100, volume: 100})']]
After 5 frames play the sound effect ( the 999999 is the wait so it only plays once instead of repeating)

Sound effects are also tied to animations so you could tell it to play a blank animation with a SE attached.
And one more question about the common event - it seems like the plugin tries to read common event 1 on enemy hit. So if another event is on first spot, it is played instead. Can that be changed?
Yes. The common event played is defined in the Action: ["C[1,5]"] property in the bullet where 1 is the common event number and 5 is the power. Change 1 to 25 or whatever common event you want played. You can have every bullet play a different common event on collision this way.
I haven't tested it but you could try
Syntax error - unexpected identifier.

Just to be sure - i should add it to the parallel script that responds for the shooting, right?
Like this -
1739988932361.png



Also i have one more question: how do i proceed if i need an enemy to perform certain events when it touches the player? Since the event is running on parallel, i can't use event touch as a condition. I tried to use conditional branch, but there is no condition such as event touch there.
So if you are using QJ Bullet demo with one of your controllers, can you shoot? Because that is the default code there, and i would really like to know if it even works on controller, and if it does - what key is used to fire?
never tried a controller on the pc though, only have PS4, but I have to see if it works.
but I wonder why the gamepad isn't accurate which might cause it?

for example, this one is for PS4 mapper (indentifier keys)
JavaScript:
Gamepad_PS4 = {
    0: "PS4_PS", // 0|100
    1: "PS4_SHARE", // 0|100
    2: "PS4_OPTIONS", // 0|100
    3: "PS4_R1", // 0 ~ 100
    4: "PS4_R2", // 0 ~ 100
    5: "PS4_R3", // 0|100 =>  right stick (click)
    6: "PS4_L1", // 0 ~ 100
    7: "PS4_L2", // 0 ~ 100
    8: "PS4_L3", // 0|100 =>  left stick (click)
    9: "PS4_RX", // -100 ~ 100 =>   right stick
    10: "PS4_RY", // -100 ~ 100 =>   right stick
    11: "PS4_LX", // -100 ~ 100 =>   left stick
    12: "PS4_LY", // -100 ~ 100 =>   left stick
    13: "PS4_UP", // 0|100
    14: "PS4_DOWN", // 0|100
    15: "PS4_LEFT", // 0|100
    16: "PS4_RIGHT", // 0|100
    17: "PS4_TRIANGLE", // 0|100
    18: "PS4_CIRCLE", // 0|100
    19: "PS4_CROSS", // 0|100
    20: "PS4_SQUARE", // 0|100
    27: "PS4_TOUCH", // 0|100
    //  "PS4_TOUCHX" -100 ~ 100
    //  "PS4_TOUCHY" -100 ~ 100
};

but I did ps3, xb360 and xb1 but, 12,13,14,15 and others match which can be
inside a gamepad, which I try to make for controllers.

see which one is the same, configure those as base, but rest can be used otherwise.

so I wonder how they come to 12 = dPad is UP which is none of the 4 I checked.

need to check the PS5, but you should play around with controller if they work.

just the keymapper and gamepad, see what button you want to use
and match them up I think and it should theoretically work.
just just the keymapper and gamepad, see what button you want to use
and match them up I think and it should theoretically work.

The problem is that the only button aside from left mouse that is comfortable to use is space. And space is not in the either configs.

So i would rather leave things as they are (with ability to use touch control), but i am not sure if it will work at all. If you don't have a pc it will probably be very problematic to test, so i think that i will ask for this help in other place, later, after more pressing issues will be solved.
if you mean controller for mobiles (though does exist to make gaming easier),
than touch input with input should match, but probably above my head.

I just try to sort the keymapper for gamepads and continue to work from there.
to match with keymapper and probably touch.

left click, right click, wheel click can be matched either to OK, and CANCEL
which the 2 does. but I didn't really tried a controller on games, except 1 for
quick testing.

you can try to add a console and insert a controller, there was a snippet to see
if the controller was connected and check for input, so you can try to combine
or map before hand to make it work.

depends what you aim for, but I can try to find how they affect, maybe you
need a controller plugin to configure the input for it.
The thing is that i don't have any controllers, but i want people with controllers (on PC) to have no problems playing the game. But since i have no controller myself, i can't check if the shooting function works on controller without remapping anything, and what button it uses. I think that i might also look for some emulator software to test such things and not bother other people. Last time i failed to make it work, but it was long time ago, maybe it will work out better now.
I can try tomorrow on his demo with my PS4 controller, to see if it works.
will report back to you if it worked or not 🙂
Syntax error - unexpected identifier.

Just to be sure - i should add it to the parallel script that responds for the shooting, right?
Like this -
Did you put a comma after the MoveJS property? You're getting syntax errors meaning some bracket, comma or other grammatical symbol is misplaced.
Also i have one more question: how do i proceed if i need an enemy to perform certain events when it touches the player? Since the event is running on parallel, i can't use event touch as a condition. I tried to use conditional branch, but there is no condition such as event touch there.
Only the first page (set the HP) and last page (death) are parallels. They only run for a few frames. The enemy will be on the middle page 99.99% of the time and you can set that to event touch.
Did you put a comma after the MoveJS property?
No, i just copied your code. Sadly i don't know how it works.

I put the comma at the end of the line, but it does not work still. Is this what you meant?
Same error. Tried putting it right after movejs as well, same result.

1740067319761.png

Original thread: https://forums.rpgmakerweb.com/threads/shooting-system.175564/