Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
Hi everyone! For some things, I had thought that, using the answer selector, one of them would need to have certain objects.

By example:

Someone asks you for 10 wood. And in the options you put:

-Deliver wood
-Better not

And that when selecting "deliver wood" if you do not have 10 wood in inventory, the npc tells you that you do not have enough, and that when you have 10 or more, accept them and continue the event.

Is it possible with variables? I looked with plugins but only found one of skills.

Thank you!
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,138
Reaction score
15,532
First Language
English
Primarily Uses
RMMV

I've moved this thread to MV Support. Thank you.



Code:
Text: I need 10 wood. Can you give it to me?
Show Choices: Deliver Wood, Better Not
When [Deliver Wood]
  Control Variables: Counter = Item [Wood] in Inventory
  Conditional Branch (If): Counter >= 10
    Change Items [Wood] - 10
    Text: Here's 10 Wood
    Control Switches [Gave Wood] = ON (or a self switch, if you only want to affect this event)
  Else
    Text: I don't have it
  End
When [Better Not]
  Text: I don't have it
End
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
[move]MV Support[/move]

Code:
Text: I need 10 wood. Can you give it to me?
Show Choices: Deliver Wood, Better Not
When [Deliver Wood]
  Control Variables: Counter = Item [Wood] in Inventory
  Conditional Branch (If): Counter >= 10
    Change Items [Wood] - 10
    Text: Here's 10 Wood
    Control Switches [Gave Wood] = ON (or a self switch, if you only want to affect this event)
  Else
    Text: I don't have it
  End
When [Better Not]
  Text: I don't have it
End
I've tried it and it doesn't work for me.

The most likely thing is that he has done something wrong (I am very bad with variables)

I put a capture of how I have done it, to better see my mistake.
 

Attachments

  • Sin título-1.jpg
    Sin título-1.jpg
    93.6 KB · Views: 9

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,138
Reaction score
15,532
First Language
English
Primarily Uses
RMMV
It looks okay to me. What scenario are you testing, and what is the result? Do you have 10 wood in inventory at the time?
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
It looks okay to me. What scenario are you testing, and what is the result? Do you have 10 wood in inventory at the time?
Is just a new map to test the event, and yes, have the 10 wood
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,138
Reaction score
15,532
First Language
English
Primarily Uses
RMMV
Can you explain in more detail what you are doing, what you expect to happen, and what is happening? I can't see what you're doing, so I can't troubleshoot. And I can't see if it's working properly, but just not giving the results you expect because it wasn't set up that way.

Here are some suggestions - change the messages so they say different things. That will show you which message it is falling through to.

If you choose Deliver Wood and you have 10 wood and it gives the "Don't have it" message, go into debug (F9) and see what is in variable 6. Or right after the Control Variables command, add a Show Text command with \v[6] so it will tell you what is in that variable.

Finally, post a screenshot showing what plugins you have, just in case one of those might be interfering with the variable or the choices.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,305
Reaction score
8,750
First Language
German
Primarily Uses
RMMV
experience shows that there are exactly three possible causes when something like this happens:

1) the event doesn't work because you mixed up the event properties, especially page conditions.
we can't check that because you gave us an incomplete event screenshot - the contents are only half of the event, the rest of the event window is also important and can cause problems.

2) a plugin changes the variable values because you forgot to configure it.
Whenever you add a plugin, you have to configure it before doing anything else (even adding another plugin). That is for many reasons, and if you do not understand any configuration setting then you should learn about it before continuing.
In this case, a good number of plugins use variables to communicate with events. If you do not configure those variables and reserve them by naming them, you risk using the same variable for something else - and then it becomes difficult to sort out what is changing the variable value.

3) you choose the wrong item.
Don't laugh, but it has happened before when a user had two items with the same name and selected the wrong one to get an inventory count.


Final tip:
Instead of writing "I don't have it", write "I only have \v[6] wood" in the show text.
That will tell both you and the player how many wood they have in that moment, making both playing and bughunting easier.
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,056
Reaction score
686
First Language
Polish
Primarily Uses
RMMV
Are you sure you have the same "wood" in inventory and check the same wood? Also, the same with variable. Are you sure you're checking "Counter" variable nr 6? Make that sure.
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
Here you have a complete image of the event

Sin título-1.jpg

And yes, I have checked if it is the same object and that, and there is no other wood in the inventory, only the one that I created to test this.

When i use "I only have \v[6] wood" in the text, say i have 0 wood, but then I enter the inventory, and I have 10.

I also tried creating a new empty project in case it was a plugin problem, and the same thing happens.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,305
Reaction score
8,750
First Language
German
Primarily Uses
RMMV
When i use "I only have \v[6] wood" in the text, say i have 0 wood, but then I enter the inventory, and I have 10.

I also tried creating a new empty project in case it was a plugin problem, and the same thing happens.
If the wood is reported as zero, then there are only two possibilities left:
either you're using the wrong wood item/wrong counter variable, or there is a plugin that changes the variable #6.

There is no other possibility at all.

So re-check your item list, and rename the variable to wood counter to make sure it is the correct one.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,780
Reaction score
1,629
First Language
English
Primarily Uses
RMMV
Your Control Variable doesn't look right to me. When I do that, the line says:
Code:
Control Variables : #0006 Counter = The number of Wood

That's Control Variables -> Game Data -> Item (first option)

What are you clicking on to get a line that looks like yours? If you're going down to the Script box and just pasting in the pseudo-code Shaz gave you...that was pseudo-code, to give you the idea, not computer code you can paste into your project.
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,056
Reaction score
686
First Language
Polish
Primarily Uses
RMMV
@Ganelan, then I'm almost sure that the Wood you have in your inventory is not the wood that you're assign to the variable. Do you have two "Wood" items in database? Check that.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,780
Reaction score
1,629
First Language
English
Primarily Uses
RMMV
I'm almost sure that the Wood you have in your inventory is not the wood that you're assign to the variable.
I don't think he's assigning anything to the variable.
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
@Ganelan, then I'm almost sure that the Wood you have in your inventory is not the wood that you're assign to the variable. Do you have two "Wood" items in database? Check that.

No, i just have one Wood item in the inventary
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
Your Control Variable doesn't look right to me. When I do that, the line says:
Code:
Control Variables : #0006 Counter = The number of Wood

That's Control Variables -> Game Data -> Item (first option)

What are you clicking on to get a line that looks like yours? If you're going down to the Script box and just pasting in the pseudo-code Shaz gave you...that was pseudo-code, to give you the idea, not computer code you can paste into your project.

In variable control, but I don't see any more option to say which specific object to select. (Sorry for being so lost)
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,056
Reaction score
686
First Language
Polish
Primarily Uses
RMMV
By inventory, you mean backpack while playing the game, right? (if you are playing, press ESC to enter menu, then check "Inventory" - do you have wood items there?)
But are you sure you have only one item in item database (F5 in Editor, then check "Items" tab)?
If you click "Control Variables", you need to select "Game Data" from the list, then you can specify what data you want assign to that variable -> you need to select that "Wood" items (the same that you've got in backpack ingame).
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,780
Reaction score
1,629
First Language
English
Primarily Uses
RMMV
In variable control, but I don't see any more option to say which specific object to select. (Sorry for being so lost)
I told you exactly what to click in the post you quoted.
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
No, I only have one wood there. And I do not understand. And I don't understand: "If you click" Control Variables ", you need to select" Game Data "from the list, then you can specify what data you want to assign to that variable"

How do I assign that?
 

Ganelan

Villager
Member
Joined
May 16, 2020
Messages
24
Reaction score
4
First Language
spanish
Primarily Uses
RMMV
OK! Finally.
I had not understood Game Data, I confused it with something else because I have the program in Spanish and I got mixed up with the names.

There, it works perfectly. Thank you all!
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,056
Reaction score
686
First Language
Polish
Primarily Uses
RMMV
OK! Finally.
I had not understood Game Data, I confused it with something else because I have the program in Spanish and I got mixed up with the names.

There, it works perfectly. Thank you all!
Glad you've figured it out! :)

Btw, please do not doublepost, use "edit" instead in future.
 

Latest Threads

Latest Posts

Latest Profile Posts

"Yeah. It's been a rough road lately. But that's the thing about the Rangers. It doesn't matter how hard it gets, or how many of them fall. They never stop fighting. The Rangers NEVER stop fighting".

Angela Deth, you are a hero of mine. Sorry for my first run of Wasteland 3.
We must press on. For all those we couldn't save. For all those we might yet save.
FirestormNeos wrote on DarkPlasmaBall's profile.
asking this here instead of the thread in question to avoid derailing it, but I'm curious; is there a particular reason you'd include a "Terms of Use" for an RPG Maker game? Like, are there multiplayer features for the game you're working on?
The holidays are upon us! Everyone search for safety from the grocery store music!
I don't understand people sometime. Walking to work today came across someone walking the opposite way in a nice suit, I politely move to the side into the shrubbery so he doesn't have to get his suit dirty and say "good morning" as he passes me, he turns around glaring daggers and asks "why are you talking to me?" like he's bloody offended by me wishing him a good morning or something. Just, why?

Forum statistics

Threads
117,138
Messages
1,104,892
Members
153,202
Latest member
EnderMon
Top