The RPG Maker Resource Kit

RMRK RPG Maker Creation => General Tutorials and Eventing => RPG Maker General => Event Systems Database => Topic started by: Tezuka on January 10, 2008, 01:06:38 AM

Title: [RM2k, RM2k3 & RMXP] Simple cooking system
Post by: Tezuka on January 10, 2008, 01:06:38 AM
This was originally a help post, but I thought I could give it a thread of its own. Anyway:

This system has two halves, it can be used perfectly with just the switch section, but the variable side makes it a little more fun.

First, make two switches, both as your ingredients like so;

Switch 1: Bread
Switch 2: Lettuce

Items can be used as the switches also, this will allow to see the items in your Inventory. Thanks AlienSoldier!

Event: If 1 and 2 are on and you press an event, say for instance, a sandwich icon in the menu you will start cooking it and you recieve one sandwich. This is the simple way.

You could add a bit more and use Variables to add a bit of "chance" to it. You can basically make a variable of "If Sandwich is cooking, what are are the odds of it working?", so Variable 1: Sandwich cooking can triggered when you hit the sandwich icon (Along with the Bread and Lettuce switches). When this is done, you can goto the Variable side of things, so "If Variable 1 is on, use random variable numbers for the probability of sandwich cooking succeeding", after this point you can do what you want with the numbers, make it random as shown here:

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi36.photobucket.com%2Falbums%2Fe9%2FTezuka101%2Fvar.png&hash=d331539d0841493155f98e90d95a3d474f18e6a3)


Change both zeros to the numbers of your liking.

After this, you can use this Conditional Branch:

Code: [Select]
<>Branch if Car [xxxx:Sandwich Cooking] is y or more/less
   <>Message: Failed!
   <>
: Else Handler
   <>Message: SUCCESS!
   <>Change Items: 1 Sandwich Add
   <>
: End
<>

This can seem confusing, but that is the basics.

Just replace "xxxx" with switch number and "y" with the number you want.

Finished product in RMXP from Aliensoldier:

Code: [Select]
@>Text: Do you want to cook with the available ingredients?
@>Show Choice: Yes, No
   : When [Yes]
     @>Text: What would you like to cook?
     @>Show Choice: Sandwich, Nevermind
        : When [Sandwich]
          @>Conditional Branch: [Bread] in inventory
           @>Conditional Branch: [Lettuce] in inventory
            @>Change Item: [Bread], -1
            @>Change Item: [Lettuce], -1
            @>Control Variables: [Sandwich cooking] = Random No. (1...10)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 30 frame(s)
            @>Conditional Branch: Variable [0003:Sandwich cooking] >= 5
              @>Play ME: '007-Fanfare01', 100, 100
              @>Text: SUCCESS! (Adquired 1x Sandwich)
              @>
             :Else
              @>Play ME: '005-Defeat', 100, 100
              @>FAILURE!
              @>
             :Branch End
            @>
           :Else
            @>Text: Not enough ingredients.
            @>
           :Branch End
       : When [Nevermind]
         @>
       :Branch End
    :When [No]
      @>
    :Branch End
@>

For the graphic side of things, you will need to do that yourself.

If you are using RMXP, test this and see if it works, I have not tried it in RMXP.

You can use any switch or variable slot as your ingredients and success probability.
Title: Re: [RM2k3 and maybe RMXP?] Simple cooking system (prototype)
Post by: Knight Rider on January 10, 2008, 02:26:54 AM
A great simple system for a mini-game!  ;D

I have tested it in XP and it works. Also i suggest you use items instead of switches
Title: Re: [RM2k3 and maybe RMXP?] Simple cooking system (prototype)
Post by: Kokowam on January 10, 2008, 02:45:55 AM
Yeah. For a check to see if an item is in your inventory. Also, removing one of those items when you make a sammich. :)
Title: Re: [RM2k3 and maybe RMXP?] Simple cooking system (prototype)
Post by: Brady on January 10, 2008, 03:41:31 AM
Yeah. For a check to see if an item is in your inventory. Also, removing one of those items when you make a sammich. :)

Agreed.  A check for the items in your inventory, then removing said items always adds to the idea of cooking, actually using ingredients.  I'm usin' somethin' similar in mine :)
Title: Re: [RM2k3 and maybe RMXP?] Simple cooking system (prototype)
Post by: Knight Rider on January 10, 2008, 03:44:29 AM
Here's the event i made using the example of Tezuka

Code: [Select]
@>Text: Do you want to cook with the available ingredients?
@>Show Choice: Yes, No
   : When [Yes]
     @>Text: What would you like to cook?
     @>Show Choice: Sandwich, Nevermind
        : When [Sandwich]
          @>Conditional Branch: [Bread] in inventory
           @>Conditional Branch: [Lettuce] in inventory
            @>Change Item: [Bread], -1
            @>Change Item: [Lettuce], -1
            @>Control Variables: [Sandwich cooking] = Random No. (1...10)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 5 frame(s)
            @>Play SE: "042-Knock03", 80, 100
            @>Wait: 30 frame(s)
            @>Conditional Branch: Variable [0003:Sandwich cooking] >= 5
              @>Play ME: '007-Fanfare01', 100, 100
              @>Text: SUCCESS! (Adquired 1x Sandwich)
              @>Change Item: [Sandwich], +1
             :Else
              @>Play ME: '005-Defeat', 100, 100
              @>FAILURE!
              @>
             :Branch End
            @>
           :Else
            @>Text: Not enough ingredients.
            @>
           :Branch End
       : When [Nevermind]
         @>
       :Branch End
    :When [No]
      @>
    :Branch End
@>
Title: Re: [RM2k3 and maybe RMXP?] Simple cooking system (prototype)
Post by: Tezuka on January 10, 2008, 01:35:11 PM
Just as I planned it out, thanks AlienSoldier! +rep

Also items do seem like the better choice, I'll update the event system.
Title: Re: [RM2k3 & RMXP] Simple cooking system
Post by: Knight Rider on January 10, 2008, 02:53:55 PM
 ;)

Edit: oops forgot to put below the SUCCESS (Adquired 1x Sandwich) the "Change Items: [Sandwich], +1
Title: Re: [RM2k3 & RMXP] Simple cooking system
Post by: Tezuka on January 11, 2008, 05:20:13 PM
Yeah I didn't notice that myself, just fixed the "air sandwich" problem. :tpg:

Thanks again, AlienSoldier!
Title: Re: [RM2k, RM2k3 & RMXP] Simple cooking system
Post by: DarkMaster2101 on June 04, 2008, 07:37:36 AM
BEHOLD!!!  Don't just limit the system to cooking.  You can do many things like smelting copper and tin to make bronze or having an alchemy system like on Dragon Quest VIII.  Also if you prepare the string right, you can have multiple choices on different pages from nesting IF statements:

My Hypothesis with minimal demonstration:

You want to have the following choices for meals:  Sandwich, Cabbage Rolls, Green Tea, Next Page, Cake, Nevermind.

@>Text: What would you like to cook?
      @>Conditional Branch: [Sandwich ingredients*] in inventory
           @>Conditional Branch: [Cabbage Rolls ingredients*] in inventory
                @>Conditional Branch: [Green Tea ingredients*] in inventory
                     @>Conditional Branch: [Cake ingredients*] in inventory
                           @>Show Choice: Sandwich, Cabbage Rolls, Green Tea, Next
                                : When [Sandwich]
                       ~~~
                                : When [Next]
                               @>Show Choice: Cake, Previous
                       ~~~
                     Else Show Choice:  Sandwich, Cabbage Rolls, Green Tea, Nevermind


And the less ingredients you have, the less choices you get as well.  It's probably best to just skip this method and for the string of choices just have recipes learned or something but all this is something you could test out.