Chickens and Eggs

Hi all,

Brand new user here.  I just downloaded the program a few weeks ago and have been having a blast with it.  At this point I feel like I have a pretty basic understanding of how to set up some pretty simple events (dialog, self switches, conditions, etc) but I've come up with a scenario recently that I don't quite know how to tackle.  I've been looking online for some tutorials but I'm not sure if my problem is something that can be solved with switches or variables or something else altogether.  I apologize if this is covered somewhere else but a point in the right direction would be greatly appreciated.

Anyways, the scenario goes like this:

You meet a chef who needs an egg to cook an omelet.  There are two chickens in a nearby house; one of which gives you a rotten egg and one gives you a regular one.  Your player can retrieve an egg from either or both and take it/them back to the chef who will then make either a tasty omelet (regular egg) or a nasty omelet (rotten egg).  I'd like to set this up where if you only have the regular egg he'll take it from you and make the tasty omelet and if you only have the rotten egg he'll take it to make the nasty one.  However if you have BOTH eggs in your inventory you get to choose which one you give him and then he'll make the corresponding omelet.  This event only happens once so you can only get one omelet or the other.  Both will be key items to open up other separate scenarios later in the game.  I can figure out how to set up the global switches after this event but I can't figure out how to set up the conditions to trigger it correctly in the first place.    

Also, to make things slightly more complicated, I want to set it up so you can only have one of each egg in your inventory at a time.  Once you got an egg from a particular chicken you can't get another one until you either consume it or use it in an event.  Once it's out of your inventory you can then gather another one from the chickens.  I guess I'd like to set the inventory max for both eggs to 1.

I hope this makes sense.  Anyone have some advice?

Thanks so much!
So you only want to be able to give the chef one egg? What do you want to happen when you talk to him again - will there be any mention of whether you gave him a rotten or good egg, and whether he made you a rotten or tasty omelet?


What happens with the chickens? If you have taken an egg from a hen and given it to the chef, can you then come back and take another egg from the same hen? If you take an egg from one hen and give it to the chef, and he makes you an omelet, can you then go to the other hen and get an egg from it as well? Or does the collecting of eggs stop after you've given one to the chef?


You will need to use nested conditions on the chef event to see if you have both eggs or only one, and which one, along with a choice when you have both.


You'll need to use multiple event pages on the chef and turn on a switch which conditions the next page after he makes the omelet, so you can't keep going back and getting more.


You'll need to have multiple pages on each of your hens to stop you getting another egg when you already have one, and possibly to stop you getting an egg from a hen you haven't collected from already, if you've given the other egg to the chef. It depends on what you want to happen there.
Also, to make things slightly more complicated, I want to set it up so you can only have one of each egg in your inventory at a time. Once you got an egg from a particular chicken you can't get another one until you either consume it or use it in an event. Once it's out of your inventory you can then gather another one from the chickens. I guess I'd like to set the inventory max for both eggs to 1.
Well now you're making no sense. First you say you want the player to be able to retrieve two eggs, either a rotten or normal one. And if the player has both, it can choose which one to give ... but now you say the player can only have one or the other egg in their inventory?
Thanks for the responses guys. 

Celianna:  To be clear, I want the player to only retrieve one egg per chicken at a time, meaning they can have only one rotten egg and one regular egg, but no more.  Only after they use one of the eggs can they return to the corresponding hen and get another egg.  Does that help?

Shaz:  Once you give the chef an egg to work with he makes the appropriate omelet and then gives it to you.  If you talk to him again he simply tells you something like, "No more for you.  I've done enough" and makes no mention of it again.  He simply doesn't care.  I will set different global conditions for both omelets so that it will slightly influence the game later depending on which one you get.  For instance, if you have the nasty omelet in your inventory a certain character will ask you for it and if you give it to him he'll give you a certain item.  If you have the other omelet a different character will ask you for it and give you a completely different item.  That much I can figure out on my own.  It's the setting of "multiple conditions" (having just the regular egg or just the rotten egg or both eggs?) that I'm having trouble figuring out.  Could you help me understand a little better what nested conditions would look like in this case?

For the chickens, you can always get one more egg out of them as long as you don't have one in your inventory.  Whether or not you can continue to get your one egg at a time from each hen isn't really tied to the chef event.  You see, these eggs will be able to trigger multiple events through the game and they're consumable.  Essentially, they will be a multi-use item.  I understand what you're saying about setting up multiple pages with the chickens so thanks for the input.  I guess I could've figured that one out on my own but I think I was confused about it because originally I wanted to make it where you could only have TWO of each egg and I wasn't sure how to set that up.  In that case, would I want to use nested conditions there somehow too?

Thanks for your time 😀 !
Make use of the option for "Item X is in Inventory" in the Conditional Branch command.

Have each Chicken only give you their egg if you don't already have one of that type.  (e.g. - the Rotten Chicken - If Rotten Egg is in inventory, "Bawk!  You already got my egg!", Else, "Bawk!  Here's a rotten egg I laid", *gain one Rotten Egg*, End Branch)

Use similar logic for the Chef.  You will probably want to use an "If Good Egg is in inventory" branch, and inside both parts of it, nest an "If Rotten Egg is in inventory" branch.  Therefore you'll have four different things that can occur based on whether you are in possession of both eggs, just the good egg, just the rotten egg, or neither.
Celianna: To be clear, I want the player to only retrieve one egg per chicken at a time, meaning they can have only one rotten egg and one regular egg, but no more. Only after they use one of the eggs can they return to the corresponding hen and get another egg. Does that help?
Are there more chickens? Can the player have several eggs in their inventory?


Basically, do as Wavelength said, use the 'if item X is in inventory' condition in the conditional branch. So first check for a normal egg, and in that conditional branch add another one that checks for the rotten one. If both true, use a show choices option to let the player choose which one he wants to use (and then remove the egg from the inventory based on the choice), then use exit event processing. If the player has no rotten egg, in the else branch, remove the normal egg and use exit event processing.


Then add another conditional branch that checks if the rotten egg is in the inventory (not in a nested branch, but on its own), if true remove the egg and add 'exit event processing'.


For any time the player has an egg taken out of the inventory to cook an omelet, turn on self Switch A.


Below all of the conditional branches, add the text "You have no eggs". Due to adding exit event processing for the conditional branches, this text will never show up if the player has an egg, but if the player doesn't have an egg, all the conditional branches will be ignored and this text will display instead.


Create a new second event page, with its condition set to Self Switch A is ON, and show some text saying the chef already made an omelet for you.
Thanks for the advice, guys.  I'll try out your suggestions and let you know how it turns out.

And Celianna, there are just two chickens so far.  I think that's all I can handle!
Alright ... for your chicken events, have two event pages. The first page will have no conditions, and the event commands will simply be to give the player the appropriate egg. The second page will have a condition of Item [X] in Inventory. The chicken who gave the good egg will use the good egg item in the condition; the chicken who gave the rotten egg will have the rotten egg item in the condition. The event commands will just let you know you can't get another egg from the chicken yet.

For the chef event, you will have two pages. Your event will look something like this:

Conditional Branch: Item [Good Egg] in Inventory Conditional Branch: Item [Rotten Egg] in Inventory Show Choices: Give Good Egg, Give Rotten Egg WHEN Give Good Egg Jump to Label: Good Egg WHEN Give Rotten Egg Jump to Label: Rotten Egg Choice End Else # Good egg is in inventory, but rotten egg is not Jump to Label: Good Egg Branch EndElse # Good egg is not in inventory Conditional Branch: Item [Rotten Egg] in Inventory Jump to Label: Rotten Egg Else # No egg in inventory Show Text: <chef asks for egg> # Skip everything else on this event page Exit Event Processing Branch EndBranch EndLabel: Good Egg .. remove good egg from inventory .. have chef make tasty omelette .. turn on switch for tasty omelette (though you could just add a condition to whatever event requires the tasty omelette to see if it's in inventory) .. turn on self switch A Exit Event ProcessingLabel: Rotten Egg .. remove rotten egg from inventory .. have chef make nasty omelette .. turn on switch for nasty omelette (though you could just add a condition to whatever event requires the nasty omelette to see if it's in inventory) .. turn on self switch AOn the next event page, set Self Switch A to be the condition, and have him say whatever you want after he's given you the omelette.The reason I've used labels and Jump to Label above is without it, you'd have to put the good egg and bad egg processing in two different places. With just two conditions, this is not so bad, but if you had three or four conditions, that's a lot of repeating, a lot of changing needed if you want to handle even one little thing differently, and a lot more places where things could be forgotten - it would be much harder to debug when something went wrong, as it would appear to happen more randomly. Personally, I also find using labels and jumping also makes it easier to read, as you're not filling up your choices/conditions with the actual processing to be done when each is met.
Ok, I'll look into that too.  I wasn't even aware of labels and jumping and all of that.  Looks like it could potentially make things a little easier than the way I was planning on doing it.

Thanks!
A lot of people don't like them. Used poorly, they can give you buggy, difficult to read/maintain code. If you know what you're doing though, they can be really handy.
So, just a little update.  I tried the nested conditions and after a few tries finally got it to work.  I understand the logic of it now so I've got a good idea of how to tackle similar situations in the future.  It never occurred to me that you could set up conditions in that way so thanks for the input.  I'll try to experiment with using labels a little later this weekend.  Thanks again for the help!

Original thread: https://forums.rpgmakerweb.com/threads/chickens-and-eggs.34809/