Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sticks = 0
- Logs = 0
- Rope = 0
- Stonerocks = 0
- Ironrocks = 0
- Goldrocks = 0
- Forge = 0
- Stoneaxe = 0
- Ironaxe = 0
- Stonepickaxe = 0
- Ironpickaxe = 0
- Goldingot = 0
- Ironingot = 0
- function menuSelect()
- print("Please make a selection.")
- sel = {}
- sel[1] = "[Gather (Wood)]"
- sel[2] = "[Gather (Ore)]"
- sel[3] = "[Go to (Forge)]"
- sel[4] = "[Inventory]"
- print(sel[1] , sel[2] , sel[3] , sel[4])
- local choice = io.read()
- if choice == "Wood" then
- gatherWood()
- elseif choice == "Ore" then
- gatherOre()
- elseif choice == "Forge" then
- atForge()
- elseif choice == "Inventory" then
- inVentory()
- else menuSelect()
- end
- end
- function inVentory()
- print("--------------------")
- print("Player Inventory")
- print("[Return] [Crafting]")
- print("Sticks: " .. Sticks)
- print("Logs: " .. Logs)
- print("Rope: " .. Rope)
- print("Stone Rocks: " .. Stonerocks)
- print("Iron Rocks: " .. Ironrocks)
- print("Gold Rocks: " .. Goldrocks)
- print("Stone Axe: " .. Stoneaxe)
- print("Iron Axe: " .. Ironaxe)
- print("Stone Pickaxe: " .. Stonepickaxe)
- print("Iron Pickaxe: " .. Ironpickaxe)
- print("Forge: " .. Forge)
- print("Iron Ingot: " .. Ironingot)
- print("Gold Ingot: " .. Goldingot)
- print("--------------------")
- local choice = io.read()
- if choice == "Return" then
- menuSelect()
- elseif choice == "Crafting" then
- cRaft()
- else inVentory()
- end
- end
- function cRaft()
- print("Crafting Menu")
- print("[Stone Axe] [Iron Axe] [Iron Pickaxe] [Forge] [Return]")
- local choice = io.read()
- if choice == "Stone Axe" and Sticks >= 1 and Rope >= 1 and Stonerocks >= 1 then
- print("Stone Axe Crafted!")
- Stoneaxe = Stoneaxe + 1
- Rope = Rope - 1
- Stonerocks = Stonerocks - 1
- Sticks = Sticks - 1
- cRaft()
- elseif choice == "Stone Axe" and Sticks < 1 or Rope < 1 or Stonerocks < 1 then
- print("Not enough materials!")
- cRaft()
- elseif choice == "Iron Axe" and Sticks >= 1 and Rope >= 1 and Ironingot >= 1 then
- print("Iron Axe Crafted!")
- Ironaxe = Ironeaxe + 1
- Ironingot = Ironingot - 1
- Rope = Rope - 1
- Sticks = Sticks - 1
- cRaft()
- elseif choice == "Iron Axe" and Sticks < 1 or Rope < 1 or Ironingot < 1 then
- print("Not enough materials!")
- cRaft()
- elseif choice == "Iron Pickaxe" and Sticks >= 1 and Ironingot >= 1 then
- print("Iron Pickaxe Crafted!")
- Ironpickaxe = Ironpickaxe + 1
- Ironingot = Ironingot - 1
- Sticks = Sticks - 1
- cRaft()
- elseif choice == "Iron Pickaxe" and Sticks < 1 or Ironingot < 1 then
- print("Not enough materials!")
- cRaft()
- elseif choice == "Forge" and Stonerocks >= 5 then
- print("Forge Crafted")
- Forge = Forge + 1
- Stonerocks = Stonerocks - 5
- cRaft()
- elseif choice == "Forge" and Stonerocks < 5 then
- print("Not enough materials!")
- cRaft()
- elseif choice == "Return" then
- inVentory()
- else cRaft()
- end
- end
- function gatherWood()
- print("Please make a selection.")
- print("[Gather (Sticks)] [Gather (Logs)] [Gather (Rope)] [Return]")
- local choice = io.read()
- if choice == "Sticks" then
- gatherSticks()
- elseif choice == "Logs" then
- gatherLogs()
- elseif choice == "Rope" then
- gatherRope()
- elseif choice == "Return" then
- menuSelect()
- else gatherWood()
- end
- end
- function gatherSticks()
- print("You venture into the woods to collect some sticks...")
- math.randomseed(os.time())
- local chance = math.random(0 , 100)
- if chance >= 40 then
- print("You found 3 sticks!")
- Sticks = Sticks + 3
- menuSelect()
- elseif chance < 40 then
- print("You found 5 sticks!")
- Sticks = Sticks + 5
- menuSelect()
- end
- end
- function gatherLogs()
- if Stoneaxe >= 1 then
- print("You venture into the woods to chop some trees...")
- print("You cut 6 logs!")
- Logs = Logs + 5
- menuSelect()
- end
- if Ironaxe >= 1 then
- print("You venture into the woods to chop some trees...")
- print("You cut 12 logs!")
- Logs = Logs + 5
- menuSelect()
- end
- if Stoneaxe < 1 or Ironaxe < 1 then
- print("You don't have an axe!")
- menuSelect()
- end
- end
- function gatherRope()
- print("You venture into the woods to collect some rope...")
- math.randomseed(os.time())
- local chance = math.random(0 , 100)
- if chance >= 20 then
- print("You found 1 rope!")
- Rope = Rope + 1
- menuSelect()
- elseif chance < 20 then
- print("You found 3 rope!")
- Rope = Rope + 3
- menuSelect()
- end
- end
- function gatherOre()
- print("Please make a selection.")
- print("[Gather (Stone Rocks)] [Gather (Iron Rocks)] [Gather (Gold Rocks)] [Return]")
- local choice = io.read()
- if choice == "Stone Rocks" then
- gatherStone()
- elseif choice == "Iron Rocks" then
- gatherIron()
- elseif choice == "Gold Rocks" then
- gatherGold()
- elseif choice == "Return" then
- menuSelect()
- else gatherOre()
- end
- end
- function gatherStone()
- print("You venture into the woods to collect some stone...")
- math.randomseed(os.time())
- local chance = math.random(0 , 100)
- if chance >= 20 then
- print("You found 3 stone!")
- Stonerocks = Stonerocks + 3
- menuSelect()
- elseif chance < 20 then
- print("You found 5 stone!")
- Stonerocks = Stonerocks + 5
- menuSelect()
- end
- end
- function gatherIron()
- print("You venture into the woods to collect some iron...")
- print("You found 3 iron ore!")
- Ironrocks = Ironrocks + 3
- menuSelect()
- end
- function gatherGold()
- if Ironpickaxe >= 1 then
- print("You venture into the woods to collect some gold...")
- print("You found 2 gold ore!")
- Goldrocks = Goldrocks + 2
- menuSelect()
- elseif Ironpickaxe < 1 then
- print("You don't have a pickaxe!")
- menuSelect()
- end
- end
- function atForge()
- if Forge >= 1 then
- print("Welcome to your forge!")
- forgeCraft()
- elseif Forge < 1 then
- print("You don't have a forge!")
- menuSelect()
- end
- end
- function forgeCraft()
- print("[Iron Ingot] [Gold Ingot] [Return]")
- local choice = io.read()
- if choice == "Iron Ingot" and Ironrocks >= 3 then
- print("Smelted 1 iron ingot!")
- Ironingot = Ironingot + 1
- Ironrocks = Ironrocks - 3
- forgeCraft()
- elseif choice == "Iron Ingot" and Ironrocks < 3 then
- print("Not enough materials!")
- forgeCraft()
- elseif choice == "Gold Ingot" and Goldrocks >= 5 then
- print("Smelted 1 gold ingot!")
- Goldingot = Goldingot + 1
- Goldrocks = Goldrocks - 5
- forgeCraft()
- elseif choice == "Gold Ingot" and Goldrocks < 5 then
- print("Not enough materials!")
- forgeCraft()
- elseif choice == "Return" then
- menuSelect()
- else forgeCraft()
- end
- end
- menuSelect()
- io.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement