Jump to content

Help with cooking script


starz82

Recommended Posts

Could anyone help me out with this cooking script? I'm a complete noob at this kind of thing but I'm trying to wrap my head around it. I've managed to get it working mostly how I want it, but there's a few things I can't get working properly. There's probably a few mistakes in the working script someone could correct I'm sure. The script is attached to a container. Here's what I have so far.

 

ScriptName CookeryContainerScript

Float Timer
Float AngleX
Float AngleY
Float AngleZ

Ref Pot
Ref Fire
Ref Food

Short DoOnce
Short IngredientsDoOnce
Short Button
Short BeefCount
Short ChickenCount
Short VenisonCount
Short PotatoCount
Short OnionCount
Short CarrotCount



Begin OnActivate


If (IngredientsDoOnce == 0)
MessageBox "What would you like to cook?", "Beef Stew", "Chicken Stew", "Venion Stew", "Open", "Pack Up", "Cancel"

ElseIf (IngredientsDoOnce == 2)
If (Timer >= 1)
Message "There is already food cooking."
EndIf
EndIf
End



Begin GameMode

Set Button to GetButtonPressed

Set Timer to Timer - GetSecondsPassed

Set BeefCount to Player.GetItemCount Beef
Set ChickenCount to Player.GetItemCount Chicken
Set VenisonCount to Player.GetItemCount Venison
Set PotatoCount to Player.GetItemCount Potato
Set OnionCount to Player.GetItemCount Onion
Set CarrotCount to Player.GetItemCount Carrot

;PLACER
If (DoOnce == 0)
Set IngredientsDoOnce to 0
Set Fire to PlaceAtMe CookingFire 1, 0, 0
Fire.SetAngle X AngleX
Fire.SetAngle Y AngleY
Fire.SetAngle Z -100
Fire.SetAngle x -90
Fire.SetAngle y 0
Fire.SetAngle z 0
Fire.Enable
Set DoOnce to 1
EndIf

;COOKED
If (IngredientsDoOnce == 2)
If (Timer <= 1)
Message "The food is now cooked."
AddItem Food 1
Set IngredientsDoOnce to 0
EndIf
Endif

;RECIEVER
If (IngredientsDoOnce == 1)
Message "The food is cooking."
Set Timer to 60
Set IngredientsDoOnce to 2
EndIf

;INGREDIENTS
If (IngredientsDoOnce == 0)
If (Button == 0 && BeefCount > 0 && PotatoCount > 0 && OnionCount > 0 && CarrotCount > 0)
Player.RemoveItem Beef 1
Player.RemoveItem Potato 1
Player.RemoveItem Onion 1
Player.RemoveItem Carrot 1
Set Food to BeefStew
Set IngredientsDoOnce to 1
EndIf

If (Button == 1 && ChickenCount > 0 && PotatoCount > 0 && OnionCount > 0 && CarrotCount > 0)
Player.RemoveItem Chicken 1
Player.RemoveItem Potato 1
Player.RemoveItem Onion 1
Player.RemoveItem Carrot 1
Set Food to ChickenStew
Set IngredientsDoOnce to 1
EndIf

If (Button == 2 && VenisonCount > 0 && PotatoCount > 0 && OnionCount > 0 && CarrotCount > 0)
Player.RemoveItem Venison 1
Player.RemoveItem Potato 1
Player.RemoveItem Onion 1
Player.RemoveItem Carrot 1
Set Food to VenisonStew
Set IngredientsDoOnce to 1
EndIf

If (Button == 3)
Activate
EndIf

If (Button == 4)
Set Pot to CookeryContainer
Fire.Disable
Pot.Disable
Player.AddItem CookingGear 1
EndIf

If (Button == 5)
Return
EndIf
EndIf
End

 

 

If it's possible, I'd like to bypass the message box and open the container if there is cooked food already inside it. I've tried to do "ElseIf (IngredientsDoOnce == 3)" but it didn't work. Also, I'd like to add a ingredient check message. Such as "You do not have the correct ingredients". I've tried adding this to the end of the ingredients block with "else" but that didn't work either, it shows as soon as activate the container. I won't give up trying to work this out, but any help is greatly appreciated. Cheers.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...