You are here

Making a cookpot - a simple crafting container?

13 posts / 0 new
Last post
QuenGalad
Making a cookpot - a simple crafting container?

I had a look at the existing systems here on the vault, but they are all much too big and complicated for the small module I'm making.

I'd like to have a cookpot - a placeable where the PC can put in some (food ingredient) items, and they are transmuted into another (food) item. I've seen something like that in the OC (in Eltoora's lab, which required casting spells at it) and I looked at those scripts, but they were way over my head. I'm also pretty sure that there was something in HotU which didn't require spells at all - you just put the items in the placeable inventory and they were transmuted instantly just like that - but I can't find it.

Would a script like that be as complicated as Eltoora's (and thus not realy useable by me), or can this be done easier?

  • up
    50%
  • down
    50%
Tarot Redhand

I did something similar in "Hrothgar's Resting Place". In answer to your last question, yes it can be done easier (although I would prefer the word simpler). But first you need to answer a few design questions -

  1. Is it just one cookpot in the whole module or are there others scattered throughout?
  2. Is this just a one-shot meal or can the PC do this multiple times?
  3. Does it involve just one ingredient or more?
  4. Can the PC only make one type of meal or can they make other meals by using other ingredients?
  5. If the latter, how do they get the recipes?

TR

  • up
    50%
  • down
    50%
QuenGalad

Hey!

So, in order not to just be a mooch on other people's skills, I tried to work this out on my own.

I made a simple script (see below) that is actually kinda-satisfying to me, but it has several small problems.

This is the script I made:

 
void main()
{
 
object oPot = OBJECT_SELF;
object oPC = GetLastOpenedBy();
if (!GetIsPC(oPC)) return;
 
if(GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_ADDED)
    {
      object oStuff = GetInventoryDisturbItem();
 
      if(GetTag(oStuff)== "meat")                    
        {
        ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE);
        AssignCommand(oPot, PlaySound("as_an_sludggurg1"));
        CreateItemOnObject("foodx_1",oPot);
        DestroyObject(oStuff);
        }
      else if(GetTag(oStuff)== "fish")
        {
        ActionPlayAnimation(ANIMATION_PLACEABLE_CLOSE);         
        AssignCommand(oPot, PlaySound("as_na_steamshrt2"));
        CreateItemOnObject("foodx_2",oPot);
        DestroyObject(oStuff);
        }
 
    }
 
}
 
 
And it works, in that it produces the food items when the meat (or fish) is tossed in. I'm so proud of myself.

The problems are that:

- I have no idea how to do this with mixed ingredients, and that's what I eventually want to do,

- the "play animation - close" was supposed to close the container (pot) so that the whole vanishing-and-creating doesn't take place clunkily in the open. However, I forgot that the placeable in question (pots from NWN2 added via CEP) does not have a closing animation. I don't know how else to close the inventory panel when the food is added in.
 
To answer your questions:
 
- There is only this one cookpot, though I would like to eventually make a similar thing producing not food but other items
- The PC should be able to do it multiple times
- Currently only one ingredient but I'd love to be able to mix them
- There is a cookbook so getting recipes is not a problem.
 
Thanks!
  • up
    50%
  • down
    50%
Fester Pot

This is what I use for an upcoming module. It goes on the OnClosed of a container.

#include "nw_i0_tool"

void main()
{
  // Original script by Axe Murderer found:
  // nwn.bioware.com/forums/viewtopic.html?topic=354311&forum=47&highlight=multiple+items

  object oPC = GetLastOpenedBy();
  object oContainer = OBJECT_SELF;
  object oMod = GetModule();

  // GET TAG OF AREA PC IS IN
  // FOR SPECIFIC ITEMS TO BE
  // MADE FOR SPECIFIC QUEST RELATED
  // ITEMS
  string sArea = GetTag(GetArea(oPC));


  ///// ITEM TAGS /////

  /// KNOWN INGREDIENTS

  // Apple
  // Banana
  // Cherry
  // Blueberry
  // Grape
  // Orange
  // Strawberry
  // Pear
  // Lemon
  // Lime

  // Tomato
  // Potato
  // Onion
  // Cabbage
  // Lettuce
  // Garlic
  // Carrot
  // Cabbage
  // Cucumber

  // Salt
  // Sugar
  // Wine
  // Ale

  // Rice
  // Fish
  // Beef
  // Chicken

 // CHICKEN-LEMON VEGETABLE SOUP

  object oChickenLVegSoup1 = GetItemPossessedBy(oContainer, "tomato");
  object oChickenLVegSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oChickenLVegSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oChickenLVegSoup4 = GetItemPossessedBy(oContainer, "cabbage");
  object oChickenLVegSoup5 = GetItemPossessedBy(oContainer, "chicken");
  object oChickenLVegSoup6 = GetItemPossessedBy(oContainer, "salt");
  object oChickenLVegSoup7 = GetItemPossessedBy(oContainer, "lemon");

  // VEGETABLE SOUP

  object oVegSoup1 = GetItemPossessedBy(oContainer, "tomato");
  object oVegSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oVegSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oVegSoup4 = GetItemPossessedBy(oContainer, "cabbage");
  object oVegSoup5 = GetItemPossessedBy(oContainer, "salt");

  // BEEF VEGETABLE SOUP

  object oBeefVegSoup1 = GetItemPossessedBy(oContainer, "tomato");
  object oBeefVegSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oBeefVegSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oBeefVegSoup4 = GetItemPossessedBy(oContainer, "cabbage");
  object oBeefVegSoup5 = GetItemPossessedBy(oContainer, "beef");
  object oBeefVegSoup6 = GetItemPossessedBy(oContainer, "salt");

 // CHICKEN VEGETABLE SOUP

  object oChickenVegSoup1 = GetItemPossessedBy(oContainer, "tomato");
  object oChickenVegSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oChickenVegSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oChickenVegSoup4 = GetItemPossessedBy(oContainer, "cabbage");
  object oChickenVegSoup5 = GetItemPossessedBy(oContainer, "chicken");
  object oChickenVegSoup6 = GetItemPossessedBy(oContainer, "salt");

  // HEARTY BEEF SOUP

  object oHeartyBeefSoup1 = GetItemPossessedBy(oContainer, "beef");
  object oHeartyBeefSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oHeartyBeefSoup3 = GetItemPossessedBy(oContainer, "onion");
  object oHeartyBeefSoup4 = GetItemPossessedBy(oContainer, "garlic");
  object oHeartyBeefSoup5 = GetItemPossessedBy(oContainer, "salt");

  // BEEF SOUP

  object oBeefSoup1 = GetItemPossessedBy(oContainer, "beef");
  object oBeefSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oBeefSoup3 = GetItemPossessedBy(oContainer, "onion");
  object oBeefSoup4 = GetItemPossessedBy(oContainer, "garlic");
  object oBeefSoup5 = GetItemPossessedBy(oContainer, "salt");

  // CHICKEN SOUP

  object oChickenSoup1 = GetItemPossessedBy(oContainer, "chicken");
  object oChickenSoup2 = GetItemPossessedBy(oContainer, "potato");
  object oChickenSoup3 = GetItemPossessedBy(oContainer, "onion");
  object oChickenSoup4 = GetItemPossessedBy(oContainer, "garlic");
  object oChickenSoup5 = GetItemPossessedBy(oContainer, "salt");

 // COOL BERRY SOUP

  object oFruitSoup1 = GetItemPossessedBy(oContainer, "strawberries");
  object oFruitSoup2 = GetItemPossessedBy(oContainer, "blueberries");
  object oFruitSoup3 = GetItemPossessedBy(oContainer, "lemon");
  object oFruitSoup4 = GetItemPossessedBy(oContainer, "sugar");
  object oFruitSoup5 = GetItemPossessedBy(oContainer, "wine");

 // CHUNKY POTATO SOUP

  object oPotatoSoup1 = GetItemPossessedBy(oContainer, "potato");
  object oPotatoSoup2 = GetItemPossessedBy(oContainer, "onion");
  object oPotatoSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oPotatoSoup4 = GetItemPossessedBy(oContainer, "salt");

 // CABBAGE SOUP

  object oCabbageSoup1 = GetItemPossessedBy(oContainer, "cabbage");
  object oCabbageSoup2 = GetItemPossessedBy(oContainer, "onion");
  object oCabbageSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oCabbageSoup4 = GetItemPossessedBy(oContainer, "salt");

 // BEEF AND CABBAGE SOUP

  object oBeefCabbageSoup1 = GetItemPossessedBy(oContainer, "cabbage");
  object oBeefCabbageSoup2 = GetItemPossessedBy(oContainer, "onion");
  object oBeefCabbageSoup3 = GetItemPossessedBy(oContainer, "carrot");
  object oBeefCabbageSoup4 = GetItemPossessedBy(oContainer, "beef");
  object oBeefCabbageSoup5 = GetItemPossessedBy(oContainer, "salt");

 // TOMATO SOUP

  object oTomatoSoup1 = GetItemPossessedBy(oContainer, "tomato");
  object oTomatoSoup2 = GetItemPossessedBy(oContainer, "garlic");
  object oTomatoSoup3 = GetItemPossessedBy(oContainer, "salt");

 // CUCUMBER SOUP

  object oCucumberSoup1 = GetItemPossessedBy(oContainer, "cucumber");
  object oCucumberSoup2 = GetItemPossessedBy(oContainer, "garlic");
  object oCucumberSoup3 = GetItemPossessedBy(oContainer, "salt");

  // SET VARIABLES UP
  // VEGETABLES
  object oTomato = OBJECT_SELF;
  object oPotato = OBJECT_SELF;
  object oOnion = OBJECT_SELF;
  object oGarlic = OBJECT_SELF;
  object oCarrot = OBJECT_SELF;
  object oCabbage = OBJECT_SELF;
  object oCucumber = OBJECT_SELF;
  object oLettuce = OBJECT_SELF;

  // FRUIT
  object oStrawberry = OBJECT_SELF;
  object oLemon = OBJECT_SELF;
  object oBlueberry = OBJECT_SELF;

  // BEEF & CHICKEN
  object oBeef = OBJECT_SELF;
  object oChicken = OBJECT_SELF;

  // EXTRA FLAVOUR
  object oSugar = OBJECT_SELF;
  object oSalt = OBJECT_SELF;
  object oWine = OBJECT_SELF;

  object oItem = GetFirstItemInInventory( oContainer);

// ----------------------------------------------------------------------------
// Building the meals
// ----------------------------------------------------------------------------

// START TO CYCLE THROUGH CONTAINER FOR INGREDIENTS

string sRes;

object oSound = OBJECT_SELF;

while ( GetIsObjectValid( oItem))
{
        //cycle to next item
        sRes = GetResRef(oItem);

        // check items resref
        // VEGETABLES
        if (sRes == "tomato")
        {
        oTomato = oItem;
        }

        else if (sRes == "potato")
        {
        oPotato = oItem;
        }

        else if (sRes == "onion")
        {
        oOnion = oItem;
        }

        else if (sRes == "lettuce")
        {
        oLettuce = oItem;
        }

        else if (sRes == "carrot")
        {
        oCarrot = oItem;
        }

        else if (sRes == "garlic")
        {
        oGarlic = oItem;
        }

        else if (sRes == "cabbage")
        {
        oCabbage = oItem;
        }

        else if (sRes == "cucumber")
        {
        oCucumber = oItem;
        }


        // FRUIT

        else if (sRes == "lemon")
        {
        oLemon = oItem;
        }
        else if (sRes == "strawberries")
        {
        oStrawberry = oItem;
        }
        else if (sRes == "blueberries")
        {
        oBlueberry = oItem;
        }

        // MEAT

        else if (sRes == "beef1")
        {
        oBeef = oItem;
        }

        else if (sRes == "beef2")
        {
        oBeef = oItem;
        }

        else if (sRes == "beef3")
        {
        oBeef = oItem;
        }

        else if (sRes == "beef4")
        {
        oBeef = oItem;
        }

        else if (sRes == "chicken1")
        {
        oChicken = oItem;
        }

        else if (sRes == "chicken2")
        {
        oChicken = oItem;
        }

        // FLAVOUR
        else if (sRes == "sugar")
        {
        oSugar = oItem;
        }

        else if (sRes == "salt")
        {
        oSalt = oItem;
        }

        else if (sRes == "firebellywine")
        {
        oWine = oItem;
        }


 oItem = GetNextItemInInventory(oContainer);
}

       // VEGETABLES
       string sTomato = GetTag(oTomato);
       string sPotato = GetTag(oPotato);
       string sOnion = GetTag(oOnion);
       string sCarrot = GetTag(oCarrot);
       string sGarlic = GetTag(oGarlic);
       string sCabbage = GetTag(oCabbage);
       string sCucumber = GetTag(oCucumber);
       string sLettuce = GetTag(oLettuce);

       // FRUIT
       string sStrawberry = GetTag(oStrawberry);
       string sBlueberry = GetTag(oBlueberry);
       string sLemon = GetTag(oLemon);

       // MEAT
       string sBeef = GetTag(oBeef);
       string sChicken = GetTag(oChicken);

       // FLAVOUR
       string sSalt = GetTag(oSalt);
       string sSugar = GetTag(oSugar);
       string sWine = GetTag(oWine);

// *************** SEVEN INGREDIENTS ONLY *****************************************

// CHICKEN-LEMON VEGETABLE SOUP
// 1 Tomato
// 1 Potato
// 1 Carrot
// 1 Cabbage
// 1 Chicken
// 1 Salt
// 1 Lemon

if  ((sTomato == "tomato") &&
     (sPotato == "potato") &&
     (sCarrot == "carrot") &&
     (sCabbage == "cabbage") &&
     (sChicken == "chicken") &&
     (sSalt == "salt") &&
     (sLemon == "lemon"))
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"tomato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))==1)
            {
            DestroyObject(oChickenLVegSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))-1);
          }
     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oChickenLVegSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oChickenLVegSoup3);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }
          if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1)
            {
            DestroyObject(oChickenLVegSoup4);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"chicken")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))==1)
            {
            DestroyObject(oChickenLVegSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oChickenLVegSoup6);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"lemon")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"))==1)
            {
            DestroyObject(oChickenLVegSoup7);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"))-1);
          }



     // Rewards and creates foods

     // PLAYER IN CATHEDRAL FORCED TO HAVE LINDA'S SPOON
     // WORKS ANYWHERE ELSE.
     // MONESTARY OF ERU SIDE-QUEST SOUP!

     if (sArea == "C1AR0623B7")
     {
       if ( HasItem(oPC, "lindaspoon"))
       {
        AssignCommand(oPC, SpeakString("Linda's spoon fades as the soup comes to a boil!"));
        AssignCommand(OBJECT_SELF, PlaySound(""));
        CreateItemOnObject("chlvsoup", oContainer);
        RewardPartyXP(25, oPC, FALSE);
        DestroyObject(GetObjectByTag("lindaspoon"));
        SetLocalInt(GetModule(), "eru_q", 35);
        FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
        DelayCommand(5.0, FloatingTextStringOnCreature("You learn something new. . .", oPC));
        DelayCommand(5.0, AddJournalQuestEntry("eruquest", 35, GetFirstPC(), TRUE, FALSE, TRUE));
        return;
       }
       else
       {
       AssignCommand(oPC, SpeakString("Strangely, the soup fails to come to a boil."));
       CreateItemOnObject("tomato", oContainer);
       CreateItemOnObject("potato", oContainer);
       CreateItemOnObject("carrot", oContainer);
       CreateItemOnObject("cabbage", oContainer);
       CreateItemOnObject("chicken", oContainer);
       CreateItemOnObject("salt", oContainer);
       CreateItemOnObject("lemon", oContainer);
       return;
       }
     }
     else
     {

     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("clvsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     return;
     }
    }

// *************** SIX INGREDIENTS ONLY *****************************************

// HEARTY BEEF SOUP
// 2 Beef
// 1 Potato
// 1 Onion
// 1 Garlic
// 1 Salt

if  (   (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef")) == 2) &&
        (sGarlic == "garlic") &&
        (sPotato == "potato") &&
        (sOnion == "onion") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"beef")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))==2)
            {
            DestroyObject(oHeartyBeefSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))-2);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oHeartyBeefSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oHeartyBeefSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"garlic")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))==1)
            {
            DestroyObject(oHeartyBeefSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oHeartyBeefSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("hbsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     return;
     }

// BEEF VEGETABLE SOUP
// 1 Tomato
// 1 Potato
// 1 Carrot
// 1 Cabbage
// 1 Beef
// 1 Salt

if  ((sTomato == "tomato") &&
     (sPotato == "potato") &&
     (sCarrot == "carrot") &&
     (sCabbage == "cabbage") &&
     (sBeef == "beef") &&
     (sSalt == "salt"))
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"tomato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))==1)
            {
            DestroyObject(oBeefVegSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))-1);
          }
     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oBeefVegSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oBeefVegSoup3);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }
          if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1)
            {
            DestroyObject(oBeefVegSoup4);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"beef")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))==1)
            {
            DestroyObject(oBeefVegSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oBeefVegSoup6);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("bvsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     return;
     }

// CHICKEN VEGETABLE SOUP
// 1 Tomato
// 1 Potato
// 1 Carrot
// 1 Cabbage
// 1 Chicken
// 1 Salt

if  ((sTomato == "tomato") &&
     (sPotato == "potato") &&
     (sCarrot == "carrot") &&
     (sCabbage == "cabbage") &&
     (sChicken == "chicken") &&
     (sSalt == "salt"))
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"tomato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))==1)
            {
            DestroyObject(oChickenVegSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))-1);
          }
     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oChickenVegSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oChickenVegSoup3);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }
          if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1)
            {
            DestroyObject(oChickenVegSoup4);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"chicken")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))==1)
            {
            DestroyObject(oChickenVegSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oChickenVegSoup6);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("cvsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     return;
     }

// *************** FIVE INGREDIENTS ONLY ****************************************


// BEEF SOUP
// 1 Beef
// 1 Potato
// 1 Onion
// 1 Garlic
// 1 Salt

if  (   (sBeef == "beef") &&
        (sGarlic == "garlic") &&
        (sPotato == "potato") &&
        (sOnion == "onion") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"beef")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))==1)
            {
            DestroyObject(oBeefSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oBeefSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oBeefSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"garlic")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))==1)
            {
            DestroyObject(oBeefSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oBeefSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("beefsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// CHICKEN SOUP
// 1 Chicken
// 1 Potato
// 1 Onion
// 1 Garlic
// 1 Salt

if  (   (sChicken == "chicken") &&
        (sGarlic == "garlic") &&
        (sPotato == "potato") &&
        (sOnion == "onion") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"chicken")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))==1)
            {
            DestroyObject(oChickenSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"chicken"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oChickenSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oChickenSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"garlic")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))==1)
            {
            DestroyObject(oChickenSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oChickenSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("chicksoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// BEEF AND CABBAGE SOUP
// 1 Cabbage
// 1 Onion
// 1 Carrot
// 1 Beef
// 1 Salt

if  (   (sCabbage == "cabbage") &&
        (sOnion == "onion") &&
        (sCarrot == "carrot") &&
        (sBeef == "beef") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if (GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if ( (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1))
            {
            DestroyObject(oBeefCabbageSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oBeefCabbageSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oBeefCabbageSoup3);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }

if (GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"beef")))
          {
            if ( (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))==1))
            {
            DestroyObject(oBeefCabbageSoup4);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"beef"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oBeefCabbageSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("bcsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     return;
     }

// COOL FRUIT SOUP
// 1 Strawberry
// 1 Blueberry
// 1 Lemon
// 1 Sugar
// 1 Bottle of Wine

if  (   (sStrawberry == "strawberries") &&
        (sBlueberry == "blueberries") &&
        (sLemon == "lemon") &&
        (sWine == "wine") &&
        (sSugar == "sugar")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"strawberries")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"strawberries"))==1)
            {
            DestroyObject(oFruitSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"strawberries"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"strawberries"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"blueberries")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"blueberries"))==1)
            {
            DestroyObject(oFruitSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"blueberries"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"blueberries"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"lemon")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"))==1)
            {
            DestroyObject(oFruitSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"lemon"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"sugar")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"sugar"))==1)
            {
            DestroyObject(oFruitSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"sugar"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"sugar"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"wine")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"wine"))==1)
            {
            DestroyObject(oFruitSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"wine"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"wine"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("fruitsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// VEGETABLE SOUP
// 1 Tomato
// 1 Potato
// 1 Carrot
// 1 Cabbage
// 1 Salt

if  ((sTomato == "tomato") &&
     (sPotato == "potato") &&
     (sCarrot == "carrot") &&
     (sCabbage == "cabbage") &&
     (sSalt == "salt"))
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"tomato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))==1)
            {
            DestroyObject(oVegSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))-1);
          }
     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oVegSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oVegSoup3);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }
          if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1)
            {
            DestroyObject(oVegSoup4);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }
     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oVegSoup5);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("vegsoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// *************** FOUR INGREDIENTS ONLY ****************************************

// TOMATO SOUP
// 2 Tomato
// 1 Garlic
// 1 Salt

if  (   (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato")) == 2) &&
        (sGarlic == "garlic") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"tomato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))==2)
            {
            DestroyObject(oTomatoSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"tomato"))-2);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"garlic")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))==1)
            {
            DestroyObject(oTomatoSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))-1);
          }


     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oTomatoSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("tomatosoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// CUCUMBER SOUP
// 2 Cucumber
// 1 Garlic
// 1 Salt

if  (   (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cucumber")) == 2) &&
        (sGarlic == "garlic") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cucumber")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cucumber"))==2)
            {
            DestroyObject(oCucumberSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cucumber"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cucumber"))-2);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"garlic")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))==1)
            {
            DestroyObject(oCucumberSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"garlic"))-1);
          }


     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oCucumberSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("cucmbersoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// CHUNKY POTATO SOUP
// 1 Potato
// 1 Onion
// 1 Carrot
// 1 Salt

if  (   (sPotato == "potato") &&
        (sOnion == "onion") &&
        (sCarrot == "carrot") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"potato")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))==1)
            {
            DestroyObject(oPotatoSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"potato"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oPotatoSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oPotatoSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }



     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oPotatoSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("tomatosoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

// CABBAGE SOUP
// 1 Cabbage
// 1 Onion
// 1 Carrot
// 1 Salt

if  (   (sCabbage == "cabbage") &&
        (sOnion == "onion") &&
        (sCarrot == "carrot") &&
        (sSalt == "salt")
    )
    {
     // Cleans out container

if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"cabbage")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))==1)
            {
            DestroyObject(oCabbageSoup1);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"cabbage"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"onion")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))==1)
            {
            DestroyObject(oCabbageSoup2);
            }
          SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"onion"))-1);
          }

     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"carrot")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))==1)
            {
            DestroyObject(oCabbageSoup3);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"carrot"))-1);
          }



     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF,"salt")))
          {
            if (GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))==1)
            {
            DestroyObject(oCabbageSoup4);
            }
        SetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"), GetItemStackSize(GetItemPossessedBy(OBJECT_SELF,"salt"))-1);
          }


     // Rewards and creates foods
     AssignCommand(OBJECT_SELF, PlaySound(""));
     CreateItemOnObject("cabbagesoup", oContainer);
     RewardPartyXP(5, oPC, FALSE);
     FloatingTextStringOnCreature("Food cooked successfully. . .", oPC);
     }

}

FP!

 

  • up
    100%
  • down
    0%
Mannast

I have used a system that checks the container's inventory in the OnClosed event for the container. That way, the PC can put in multiple items and then close it. The script can get the first item in inventory and look at a list of primary ingredients, similar to what you have done. Once found, it can look for the secondary ingredient(s). If present, then you do the creation and take the ingredients away.
I can post a short example if you want - I just have to find it...
---------------------------
void main()
{
object oSelf = OBJECT_SELF;
object oPC = GetLastOpenedBy(oSelf);
object oItem = OBJECT_INVALID;
string sSource, sRTag;
int iNum = 0;
oItem = GetFirstItemInInventory(oSelf);
while(GetIsObjectValid(oItem))
{
//Fried eggs
if(GetTag(oItem)=="fresh_eggs")
{
object oItem2 = GetItemPossessedBy(oSelf, "butter");
if(oItem2!=OBJECT_INVALID)
{
DestroyObject(oItem);
DestroyObject(oItem2);
sSource = "cook_food";
iNum = 1;
sRTag = "fried_eggs";
}
}
//Other recipe checks here
//Alchemists Fire Flask - you can use this format for all sorts of recipes
if(GetTag(oItem)=="alchemists_fire")
{
object oItem2 = GetItemPossessedBy(oSelf, "throwing_flask");
if(oItem2!=OBJECT_INVALID)
{
DestroyObject(oItem);
DestroyObject(oItem2);
sSource = "X1_WMGRENADE002";
iNum = 1;
sRTag = "";//default tag
}
//
//Create new food
while(iNum!=0)
{
object oCooked = CreateItemOnObject(sSource, oPC, iNum, sRTag);//create cooked food in PC inventory
iNum--;
}
//finished. now go again and see if there is more to cook
oItem = GetNextItemInInventory(oSelf);
}
//get here, there are no more items in inventory
return;
}

Portable Hole System, Scry and Teleport System, Throwing Objects, Prodding Traps, Portable Placeables and a Vanilla Basemodule, among other things

  • up
    100%
  • down
    0%
Tarot Redhand

<edit - I was beginning to ramble as it is in the wee small hours here so I've just posted the link to a test module and the actual code here. will make an explanatary post after I sleep>

OK here is my take on a solution (will get back to you on that pm, just been too busy creating this). What it does is check that the PC has the recipe book that you mentioned. If not this script just tells the Pc they can't cook without it. Actually this script needs a number of custom items to be created - the cook book, the ingrediants, the cooked meals. Like the other scripts in this thread, It goes in the OnClosed event slot of your cooking pot.

The script needs each ingredient to have the same tag - Ingredient - and an int variable called - iIngredientNumber. I've actually made a test module for it and it seems to work. Here is a link to that module for you to try.

----------------------------------------------------------------------------------------

//needed for GetNumItems()
 
#include "nw_i0_plot"
 
// The following constants match the numbers given to the variable "iIngredientNumber" on each actual item
 
const int Garlic = 1;
const int RedWine = 2;
const int WhiteWine = 4;
const int Fish = 8;
const int RotGut = 16;
const int Water = 32;
const int Barley = 64;
const int GreenBerry = 128;
const int Herbs = 256;
const int Spices = 512;
const int Beef = 1024;
const int Mutton = 2048;
const int Pork = 4096;
const int Venison = 8192;
const int SmallBeer = 16384;
 
// Number of ingredients needed for each recipe
 
const int NumberNeeded = 4;
 
void DestroyIngredients(); // see function
 
void main()
{
 
//create recipes
 
    int SpicyFish = Fish | WhiteWine | Herbs | Spices;
    int MuttonBroth = Mutton | Barley | GreenBerry | Herbs;
    int BeefTraditional = Beef | SmallBeer | Garlic | Spices;
    int SharpVenison = Venison | GreenBerry | RedWine | RotGut;
 
//The rest of these variables are explained later
 
    int iMeal = 0;
    int iIngredientCount = 0;
    int iInvalidIngrediantsDetected = FALSE;
    int iMealMatched = TRUE;
 
    string sMealName = "";
 
    object oCookBook;
    object oTestObject;
    object oPC = GetLastClosedBy();
 
    if(GetIsPC(oPC)) //make sure it is a PC using the cookpot
    {
        if(GetLocalInt(OBJECT_SELF, "bMealJustCooked")) //reduce possibility of erroneous message when cooked meal removed from pot
        {
            SetLocalInt(OBJECT_SELF, "bMealJustCooked", FALSE);
            return;
        }
 
        oCookBook = GetItemPossessedBy(oPC, "RecipeBook");
 
        if(oCookBook != OBJECT_INVALID) //make sure PC has recipe book in their possession
        {
            iIngredientCount = GetNumItems(OBJECT_SELF, "Ingredient");
 
            if(iIngredientCount == NumberNeeded) //make sure we have correct number of ingredients
            {
                oTestObject = GetFirstItemInInventory();
 
                while(oTestObject != OBJECT_INVALID) //create a number based on what is actually in the pot
                {
                    if(GetTag(oTestObject) == "Ingredient") //make sure only ingredients are counted
                        iMeal |= GetLocalInt(oTestObject, "iIngredientNumber");
                    else
                        iInvalidIngrediantsDetected = TRUE; //Oh dear, not an ingredient
 
                    oTestObject = GetNextItemInInventory();
                }
 
                if(iInvalidIngrediantsDetected) //Something that wasn't an ingredient was found
                {
                    SpeakString("There is a foul smell as what you put in the pot burns!");
                    DelayCommand(3.0f, SpeakString("Perhaps if you'd only put valid ingredients in the pot..."));
                    DestroyIngredients();
                }
                else //does what we have in the pot match a valid recipe? If yes, replace ingredients with meal
                {
                    DestroyIngredients(); //get rid of ingredients
 
                    if(iMeal == SpicyFish)
                    {
                        CreateItemOnObject("spicyfishmeal");
                        sMealName = "Spicy Fish";
                    }
                    else if(iMeal == MuttonBroth)
                    {
                        CreateItemOnObject("muttonbrothmeal");
                        sMealName = "Mutton Broth";
                    }
                    else if(iMeal == BeefTraditional)
                    {
                        CreateItemOnObject("traditionalbeef");
                        sMealName = "Traditional Beef";
                    }
                    else if(iMeal == SharpVenison)
                    {
                        CreateItemOnObject("sharpvenison");
                        sMealName = "Sharp Venison";
                    }
                    else
                        iMealMatched = FALSE;
 
                    if(iMealMatched) // Yippee we have just cooked something
                    {
                        SetLocalInt(OBJECT_SELF, "bMealJustCooked", TRUE);
                        SpeakString("There is an appetising smell coming from the pot.");
                        DelayCommand(3.0f, SpeakString("Seems like your " + sMealName + " is ready to eat."));
                    }
                    else    //Oh dear, they may have been ingredients but they don't match any known meal
                    {
                        SpeakString("There is a strange, unsettling smell from the pot!");
                        DelayCommand(3.0f, SpeakString("You throw the pot contents away. Perhaps if you'd had the right ingredients..."));
                    }
                }
            }
            else if(iIngredientCount == 0) //Pot contains no ingredients whatsoever!
            {
                SpeakString("There is a foul smell as whatever you put in the pot burns!");
                DelayCommand(3.0f, SpeakString("Perhaps if you'd put actual ingredients in the pot..."));
                DestroyIngredients();
            }
            else //wrong number of ingredients in pot
            {
                SpeakString("There is a foul smell as your ingredients burn!");
                DelayCommand(3.0f, SpeakString("Perhaps if you'd had the right number of ingredients..."));
                DestroyIngredients();
            }
        }
        else // Oh dear - no recipe book
        {
            SpeakString("Without a recipe book you don't know how to cook!");
        }
    }
}
 
//used a number of times - empties the pot of everything
 
void DestroyIngredients()
{
    object oTestObject;
 
    oTestObject = GetFirstItemInInventory();
    while(oTestObject != OBJECT_INVALID)
    {
        DestroyObject(oTestObject);
        oTestObject = GetNextItemInInventory();
    }
}
 
TR
  • up
    100%
  • down
    0%
Tarot Redhand

In order to help to explain the above code I have created a flowchart that shows some of the how it does it and what it does. Due to the ease of using it for images, this flowchart is in the new forums here.

TR

  • up
    100%
  • down
    0%
QuenGalad

Thank you so much everyone for this amazing input!

It's incredible how much there is to learn in the world of NWN scripting. I didn't even know items could have variables attached! (That part was sooo confusing until it finally clicked. And then I spent ages searching for a place to add variables to an item in the toolset to confirm my suspicion that this might be what's meant here.)

I have to sleep on all this really cool code you guys have given me - and then to work out which bits can I adapt without messing it up - but I can see there's more possibilities here than I've dreamed of.

Thank you!

  • up
    50%
  • down
    50%
Tarot Redhand
In order to understand how FP's and and Mannast's scripts work I took it upon myself to tidy their code (using notepad++) so that all 3 followed a consistent layout (if interest is shown and FP and Mannast approve, I can make these versions available to anyone who wants a copy). I didn't alter any of the comments in the code. Having done this I feel I am now in a position to give an assessment of each. I will endeavor to be as impartial as I can given that one of the three is mine.
 
Fester Pot’s
 
Pros
Versatile system that can be expanded as needed.
Can handle recipes that require 2 or more of the same ingredient.
Can handle differing sized recipes and could be modified to handle new recipes with more ingredients or less.
Only destroys the ingredients used.
 
Cons
At 1159 lines this is big.
Compared to the other 2 systems this is slow.
Compared to the other 2 systems this one uses a lot of memory.
Adding new ingredients takes lots of lines of code.
Depending on the recipe, adding a new recipe can add a lot of code (in the 10’s of lines at least)
 
Code
Reasonably well commented and self-documenting.
Might have benefited from the use of sub functions to both shorten the code and make it even more readable.
 
Mannast’s
 
Pro’s
Small – This is the smallest system here.
Easily expandable.
As presented this will be fast and uses a small amount of memory.
 
Cons
Only one recipe presented
Will take a comparatively large number of lines to expand.
 
Code
Reasonably well commented.
Variable names could be better to aid both readability and maintainability.
 
Mine
 
Pros
Only one of the three to make use the recipe book requested.
Adding an ingredient only takes 1 line of code and a new blueprint with a tag of “Ingredient” and a variable called “iIngredientNumber” with value that is a power of 2.
Adding a recipe only takes 1 line of code and a new entry added to the description in the recipe book.
Comparatively fast.
Comparatively low memory usage.
 
Cons
Fixed size recipes i.e. all recipes have the same number of ingredients.
Each recipe can only use one of each ingredient.
Maximum of 32 different ingredients.
With one exception anything in the cookpot when it closes, is destroyed. (Exception if PC doesn’t have the cookbook, nothing is destroyed)
Known issue if the cooked meal is not removed from the cookpot when the cookpot is next opened, the meal is destroyed (“you let it burn”).
 
Code
Obviously I think my code is well commented and well self-documented. You may disagree.
 
One little oddity I spotted in both FP’s and Mannast’s code. The code of all three systems is intended to be used in the OnClosed event of the cookpot so why do they both get the PC object with the line -
 
object oPC = GetLastOpenedBy();
 
instead of the more logical -
 
object oPC = GetLastClosedBy();
 
which is what I used? Do they know something I don’t?
 
TR
 
  • up
    100%
  • down
    0%
Tarot Redhand

If anyone is thinking of playing with the one I made you might find the premade list of all the values for the power of 2 that fit into an int useful. It is part of the separate appendix I did for my "TR's Basics - Boolean Algebra" package. As I say the appendix is a separate download so you don't need to download that if you don't want/need/whatever it.

TR

  • up
    50%
  • down
    50%
G-Nome Savagepope

Order of operation, the first thing that happens is; Player opens the object.

Logically, the time to call data on the handler is at the moment of intiation.

Does it have any bearing on the code? No, not likely.

I would hazard a guess that they create from the perspective side of the player, Not the creator. Since the creator arcetype puts the creation before the creature, and here we see the Creature creating a creation for the sake of a creator and still, in the workings of the machination, puting the actions of the creature prioritized to before the creation.

I bet they even hold doors open for little old ladies.

(I'm just mindwarping a muse, pay me no never-you-mind)

-

Thanks guys, I needed a simple starting point from whence to cobble a simple crafting system. I needed this insight to get me moving in the right direction.

                                         Cheers.

  • up
    50%
  • down
    50%
Mannast

In all fairness, I was just offering an example so QuenGalad had some options for making their own script. I edited out a number of different bits and only showed the recipes that had multiple ingredients. And Tarot is correct with the GetLastClosedBy() function - I just typed in something from above because I copied the bits from the middle of my actual cooking script (from my Vanilla Basemodule) and realized after posting I didn't get the oPC.

  • up
    50%
  • down
    50%
Tarot Redhand

No criticism was intended. I just did an anlysis of what was posted and tried to be just as hard on what I presented as I was on everyone elses.

TR

  • up
    50%
  • down
    50%