Author Topic: Need a cook pot script  (Read 307 times)

Legacy_GIANTSWORD

  • Full Member
  • ***
  • Posts: 175
  • Karma: +0/-0
Need a cook pot script
« on: September 24, 2014, 08:05:26 am »


               

Hey guys,


 


I have numerous meats and ingredients that I'd like to be able to put inside of a cook pot and have it stew up some grub.


 


You open cook pot > add ingredients > cook pot locks on close > delayed flavor text and possibly a little smoke > message saying it smells done > cook pot unlocks > when you open you have your food.


 


The ingredients will be simple from 2 to 3 ingredients max.


 


Is it possible to have it cook up specified items determined by what you put inside of it?  The players would have to reference a cook book in order to figure out what goes together to make the good stuff.


 


 


Some issues and questions -


 


what if they put in more ingredients than they need, would said script gobble them up and still cook with what it has or would you need to put in exact items to get it to cook?  


 


If you put in ingredients that don't amount to anything could you get "gruel" or something to that effect I could put some mediocre status effects on if consumed.  (I hope this is possible..)


 


Lastly, on my campfire I have an extinguish option that kicks the fire out.  This option goes away when I give the cook pot an inventory instead of a conversation.  I could just have players bash the cook pot placeable in order to extinguish it but I like the idea of them choosing to "tear down the cookp pot" and get their cook pot back instead of bashing the fire with their weapon.  Not sure how this would be done. 


 


If all this isn't possible with the cookpot inventory idea I could do the whole thing through a conversation with the cook pot.  I just really like the idea of players being able to actually put ingredients inside the pot.


 


 



               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
Need a cook pot script
« Reply #1 on: October 25, 2014, 06:18:57 pm »


               I think the simplest way to handle this is a custom function that returns what the ingredients can make, ASSUMING each "meal" made by this system requires at least 1 unique ingredient, because it would run into issues if multiple recipes shared the same ingredients.


// Custom Prototype...

string GetMealName(string sIngTag1, string sIntTag2 = "", string sIntTag3 = "", ... etc...)
{
  string sMeal = "INVALID_INGREDIENTS";  
if(sIngTag1 == "ThisIngredientTagName" && sIngTag2 == "ThisIngredientTagName"  &&
    sInTag3 == "ThisIngredientTagName")    
{ return "MEAL_NAME"; }
 else if(sIngTag1 == "ThisIngredientTagName" && sIngTag2 == "ThisIngredientTagName"  &&
             sInTag3 == "ThisIngredientTagName")    
{ return "MEAL_NAME"; }
else if(sIngTag1 == "ThisIngredientTagName" && sIngTag2 == "ThisIngredientTagName"  &&
            sInTag3 == "ThisIngredientTagName")    
{ return "MEAL_NAME"; }  
return sMeal; // By Default return invalid ingredients for any meal...
}

// ***In the coding of your script***

// By Default all tags are invalid..string
sTag1 = "";
string sTag2 = "";
string sTag3 = "";

// Identify sTag1 - sTag3 by looping through the items and setting their tags...

object oPot = OBJECT_SELF ;  // define this...

int nIngredients = 0;
object oItem = GetFirstItemInInventor(oPot);
while(GetIsObjectValid(oItem))
{
  nIngredients += 1;

  if(nIngredients == 1)
  { sTag1 = GetTag(oItem); }
 
  else if(nIngredients == 2)
  { sTag2 = GetTag(oItem); }
 
  else if(nIngredients == 3)
  { sTag3 = GetTag(oItem); }
 oItem = GetNextItemInInventory(oPot);
}

string sMeal = GetMealName(sTag1, sTag2, sTag3);

// Handle invalid ingredients to make a meal..

if(sMeal == "INVALID_INGREDIENTS")
{
  // Code for Invalid Meal Ingredients...
}

// Otherwise handle other meals...
else if(sMeal == "MEAL_NAME_1")  // Change this to the actual meal name...
{  // Code for this meal...}
// etc...
else if(sMeal == "MEAL_NAME_1") // Change this to the actual meal name...
{  
  // Code for this meal...
}