Jzkann

*creative title*
Member
Joined
Aug 23, 2017
Messages
25
Reaction score
1
First Language
Italian
Primarily Uses
RMVXA
Hello there. I'm creating some Firearms in my game. Basically, they're Items that when you use them in battle, they call a common event that executes a particular skill and the ammo capacity (a variable) decreases. When this variable is 0, the weapon will reload and shoot if you have other ammo, while, if you have 0 ammo, it will tell you. Right now, I created two weapons: a Handgun (The Arguer) and a Shotgun (Super Shorty). The Handgun works as expected, but not the shotgun: it shoots normally, but the ammo capacity doesn't decrease. Here are the screens:
Handgun common event:
handgun.png

Shotgun common event:
shotgun.png

I checked, and I'm 100% sure the item calls correctly the common event.
The skill works correctly, although I think it's not the skill's problem.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,820
Reaction score
8,229
First Language
German
Primarily Uses
RMMV
several comments:

1) you should check the correct number of bullets in inventory with a combination of contol variable and conditional branch.
Using only the conditional branch "in inventory" is true even if there is only 1 bullet in inventory, and that would result in your code giving the player a full reload for a single bullet left.

2) have you checked if you have a plugin where you missed a configured variable?
Some plugins use variables to control their options and if one of your plugins do this you are required to make sure it's correctly configured.
Because if one of your plugins redirected the variable #3 without your knowledge that could cause those problems.

3) use the search function to find all events that use variable #3 - if it is used at a different event that could also cause problems.

4) if you still haven't found the cause, add show text commands to all branches giving the values of the variables used, that often helps in localizing the problem. For example it might be something entirely different that causes this, and you need the V[3] in all branches to track the logic.
 

Jzkann

*creative title*
Member
Joined
Aug 23, 2017
Messages
25
Reaction score
1
First Language
Italian
Primarily Uses
RMVXA
several comments:

1) you should check the correct number of bullets in inventory with a combination of contol variable and conditional branch.
Using only the conditional branch "in inventory" is true even if there is only 1 bullet in inventory, and that would result in your code giving the player a full reload for a single bullet left.

2) have you checked if you have a plugin where you missed a configured variable?
Some plugins use variables to control their options and if one of your plugins do this you are required to make sure it's correctly configured.
Because if one of your plugins redirected the variable #3 without your knowledge that could cause those problems.

3) use the search function to find all events that use variable #3 - if it is used at a different event that could also cause problems.

4) if you still haven't found the cause, add show text commands to all branches giving the values of the variables used, that often helps in localizing the problem. For example it might be something entirely different that causes this, and you need the V[3] in all branches to track the logic.
Thanks for the tips.
For the first tip, how do I check how many bullets does the player have? Because I don't know how to do the process that you said (combination of control variable and conditional branch)
For the second one, I'm sure no script uses the variable #3.
For the third one, I checked, and no event controls that variable.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,422
Reaction score
601
First Language
Italian
Primarily Uses
RMVXA
For the first tip, how do I check how many bullets does the player have? Because I don't know how to do the process that you said (combination of control variable and conditional branch)
You can store the number of bullets the player is holding in a variable and then, use a conditional branch to check that variable. For arguments sake I am going to use variable 4 in my example.
Code:
Variable 4 = Amount of Bullets
Conditional Branch: Variable 4 >= 7
  Variable #3 = 7
Else
  Variable #3 = Variable #4
end
For the second one, I'm sure no script uses the variable #3.
For the third one, I checked, and no event controls that variable.
Not to be rude but from your event I can be 100% sure that is not your case. Variables are initialized with a value of 0. If your variable is neither equal to 0 nor greater than 0 (thus being less than 0) that means something modified its value somewhere else. It could be either an event or a script but something did change its value, even if you do not know what.

That said if you do not know what modified its value and everything else works as intended I would recommend you to use a different variable in order to not break other things that are currently working properly. Even so I recommend using "Variable #ID <= 0" instead of just "Variable #ID == 0". This way you handle exceptions together with normal cases. It also allows you to use that variable somewhere else and then reset it automatically once you reload regardless of its value (I still do not recommend using the same variable for multiple purposes unless you are having very serious memory shortage).
 

Latest Threads

Latest Profile Posts

Sometimes you Just need to realise someone is beyond help... Still hard to walk away tho :(
100 Horror/Tragedy Sample Maps, Penguin Mech Sprite, & TileD Templates | RPG Maker News #70

Continuing working on abs. So far I have done the workout twice. I am excited to see the results after a couple of weeks. How is everyone doing? :)
MZ: oh boy imma work today
Me, excited: Really?
MZ, doesn't do what I tell It too
Me: I Thought-
MZ: I am Working!
Oof, this "side project" of mine is starting to get as complex as a VS plugin, at least as far as plugin parameters are concerned. I think I now understand why a plugin like this doesn't already exist(that I know of). Learning a lot while trying to make it work though!

Forum statistics

Threads
112,216
Messages
1,066,609
Members
145,822
Latest member
ghanovdn
Top