Setting variables to the number of weapons, armor in your inventory.

Rumble82

Villager
Member
Joined
Nov 29, 2015
Messages
6
Reaction score
0
First Language
English
I've looked through the forum and I haven't seen anything on this. So here's the issue I have a Dialog box to report what item was just found. I can't figure out how to put my screen shot on here so I'll just type it.

set startingvar = number of item in inventory(we'll say this is 0 for the example)

change item + 1 

Set newtotalvar = number of item in inventory(this should be 1 )

if startingvar not equal to 0

                 newtotalvar =  newtotalvar -startingvar

end

Text:

            \v[ newtotalvarnumbe] item was found ! (this works and reports a 1 as the var value)

So what's the issue?

If I use the number of a armor or weapon I get a value of 0 every time. It's not setting the value to anything.  
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
Please provide screenshots of the event code you're using. That is a lot better and your description is unclear in several points, we need to see your event code itself to find the errors.

That said, from what you wrote it's clear why you get a zero - you're setting the newtotal to the starting value, and if the starting value is not zero you substract the starting value from newtotal. That will always result in zero as you substract the starting value from a variable that is set to the same value.
 

Rumble82

Villager
Member
Joined
Nov 29, 2015
Messages
6
Reaction score
0
First Language
English
It only fires the if if the starting var is NOT 0 if the starting value is 0 it will not substract anything. The starting value is only set once at the begin.

easy example:

 You have 2 apples

I store you have 2 apples(var1)

 I give you 1 apple

You now have 3 apples

I store you have 3 apples(var2)

I then report var 2 - var 1 

in this case it would be 1. 
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
Then please give screenshots of your events - because somewhere in the line you're using a wrong command, and we need to see what you really placed in the event, not what you believe to have placed there.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,714
First Language
English
Primarily Uses
RMMV
What plugins do you have?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
I assume "Items I Had" is the name of a variable - but you don't define that variable in these events, so it depends on where it is defined.

And it is different from what you wrote in the texts above - there you wrote that the conditional branch would check the first variable, but in reality you're checking a completely unconnected third variable if that is not zero.

Please post screenshots where that variable is defined as well as the events or skills that are calling those two common events.

Additionally, please don't crop screenshots - for determing which event is called where the ID of the event may become important.
 

Rumble82

Villager
Member
Joined
Nov 29, 2015
Messages
6
Reaction score
0
First Language
English
YEP_CoreEngine

YEP_BattleEngineCore

YEP_AutoPassiveStates

Yep_BattleAICore

Yep_SkillCore

Yep_MessageCore

Yep_EquipCore

Yep_itemCore

Yep_EventChasePlayer

Yep_X_SkillCooldowns

in that order.
 

Rumble82

Villager
Member
Joined
Nov 29, 2015
Messages
6
Reaction score
0
First Language
English
Here they are again

 Works

 
Doesn't Work

 
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
Rumble82, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

If you want to add something and your own post is the last one, please edit it.

1) Check if you have the latest versions of Yanfly's scripts, especially the itemcore as that script had a bug that was solved weeks ago.

2) please add show text commands with \V for the variable after each control variable command to check which value is in which variable at which step.

3) you still didn't explain where and how you call those common events, because by themselves they do nothing at the moment and can't even be tested without a call from somewhere.
 

Rumble82

Villager
Member
Joined
Nov 29, 2015
Messages
6
Reaction score
0
First Language
English
Updating the script fixed it. Thank you for your help
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top