Diagonal facing = Shoots event projectile diagonally?

I am trying to make the player shoot a projectile(event) into the direction he faces.
I have made it work for direction: Up, Left, Right, Down.
But I can't make it work with if I face upperleft, upperright. lowerleft, lowerright.

Have I made the event wrong?
Would really appreciate some help with this!

I am using MV3D plugin with "wasd" movement and turn around with mouse (like any fps out on the market today).

A bonus would be if the projectile could detect exactly by how many pixels in each direction the player (mouse) is facing. Adding a "Z" variable would be an even bigger bonus but I sense that might be a too far stretch for this?

The one who helps me will end up in the credits of my game(s).



This is the event for checking the direction the player faces.
Anything wrong here?
Spoiler: Player Direction check
projectile help.png

This is the projectle event
Spoiler: Projectile Event
projectile help1.png


And please explain to me like I'm 5 years old 😀
Spoiler: This is me trying to understand
47065598522_ae0d001d73.jpg
Is CHAR_DIR definitely being set to 1/3/7/9 when moving diagonally?
Is CHAR_DIR definitely being set to 1/3/7/9 when moving diagonally?
I don't know what you mean. I only want it possible to shoot my projectiles in the direction I'm facing
What I mean is that your event is checking the value of a variable called CHAR_DIR, but have you verified that moving diagonally actually sets the value of that variable to what you'd expect? If the projectile isn't moving in the expected direction, that points to the variable not actually being the value the conditional branch is checking for, which would be an issue with whatever is setting that variable to the directional values in the first place.
What I mean is that your event is checking the value of a variable called CHAR_DIR, but have you verified that moving diagonally actually sets the value of that variable to what you'd expect? If the projectile isn't moving in the expected direction, that points to the variable not actually being the value the conditional branch is checking for, which would be an issue with whatever is setting that variable to the directional values in the first place.
Ah ok, now I know what you mean
Well, do you have a plan on how I can make it work the way I hope?
It should not be needed to my as in holding down a button but just to check that the player face diagonally so I can shoot while standing still also.
I might have a plan, but you need to tell me how your existing mechanic works as I'm not psychic. What is it that's setting the value of CHAR_DIR?
I might have a plan, but you need to tell me how your existing mechanic works as I'm not psychic. What is it that's setting the value of CHAR_DIR?
The only thing I did was following the steps of the youtube video I attached and it's all in that event. How it checks which CHAR_DIR value it is must be a base function from Rpgmaker mv I guess?

Nothing made in a plugin.
Oh sorry, I missed it at the very beginning, you're setting it to the direction of player.

That's your problem: the base MV engine doesn't support 8-directional movement. There is a switch for it in the code, but unless you go in and change it you'll only get up, down, left or right.

Getting the input direction itself just requires you to change Game_Player's getInputDirection function to return Input.dir8 instead of Input.dir4, but you also need to modify the code that slices a character graphic based on direction value and a couple of other bits.
Oh sorry, I missed it at the very beginning, you're setting it to the direction of player.

That's your problem: the base MV engine doesn't support 8-directional movement. There is a switch for it in the code, but unless you go in and change it you'll only get up, down, left or right.
I guessed it could be like that.
Is there any way of getting the player mouse direction from the mv3d plugin?

#mv3d
I guessed it could be like that.
Is there any way of getting the player mouse direction from the mv3d plugin?

#mv3d
I'm not sure offhand but try changing the command near the top that sets the value of CHAR_DIR to a "script" operand and type "Input.dir8".
I'm not sure offhand but try changing the command near the top that sets the value of CHAR_DIR to a "script" operand and type "Input.dir8".
Thanks. I'll try it later
I'm not sure offhand but try changing the command near the top that sets the value of CHAR_DIR to a "script" operand and type "Input.dir8".
I don't think it worked. Wonked up the projectile movement. What should I type exactly and where you said? Just to be sure I didn't do wrong.
I don't think it worked. Wonked up the projectile movement. What should I type exactly and where you said? Just to be sure I didn't do wrong.
1645223399811.png


Where you've got "Control Variables : #0041 CHAR_DIR = Direction of Player", edit that, choose "script" for the operand instead of "game data", and write "Input.dir8". Remove the line below it.
View attachment 216728

Where you've got "Control Variables : #0041 CHAR_DIR = Direction of Player", edit that, choose "script" for the operand instead of "game data", and write "Input.dir8". Remove the line below it.
Nopes, same outcome as my attempts. The projectile shows freezed in the upper corner and then disappears. freezed in same corner no matter what direction I face.
You probably have another plugin that's buggering it up then.

Original thread: https://forums.rpgmakerweb.com/threads/diagonal-facing-shoots-event-projectile-diagonally.145018/