-- spawnable items shelter etc --entity_number1 = 45 --shelter --entity_number2 = 30 --workbench --entity_number3 = 30 --stove -- globals --Level one g_berriescollected = 0 -- Add any new global items to this list g_tuberscollected = 0 g_mushroomscollected = 0 g_woodcollected = 0 g_flintcollected = 0 g_featherscollected = 0 g_fiberscollected = 0 g_waterscollected = 0 g_berry_pie = 0 g_berry_soup = 0 g_mbtbroth = 0 g_mbtpie = 0 g_fdagger = 0 g_faxe = 0 g_fhammer = 0 g_ibow = 0 g_arrow = 0 g_meatcollected = 0 g_hidecollected = 0 g_meat_pie = 0 g_meat_soup = 0 g_shelter = 0 g_workbench = 0 g_cooker = 0 g_ironscollected = 0 g_coppercollected = 0 g_leadcollected = 0 g_exp = 0 g_planks = 0 g_logs_made = 0 g_sulphurscollected = 0 g_saltpeterscollected = 0 g_carbonscollected = 0 g_furnace = 0 g_lathe = 0 g_iingot = 0 -- iron ingots g_lingot = 0 -- lead ingots g_cingot = 0 -- copper ingots g_singot = 0 -- steel ingot g_pistol = 0 g_rifle = 0 g_rifle_ammo = 0 g_pistol_ammo = 0 g_bandages = 0 g_medipack = 0 g_antidote = 0 g_booster = 0 g_splate = 0 g_resin = 0 g_nails = 0 g_flask = 0 g_cstation = 0 g_kills = 0 local tSize = 2 -- Buttons Arrays local MainButtons = {} local RecipeButtons = {} local Cursor = nil function survival_inventory_init(e) if GetDeviceWidth() > 1600 then tSize = 1 end if GetDeviceWidth() > 2200 then tSize = 3 end -- Option Buttons as Button 1 - whatever local use = LoadImage( "scriptbank\\ss1\\use.png" ) MainButtons = {['iIron'] = { x = 3, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option1.png" )) }, ['iLead'] = { x = 14, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option2.png" )) }, ['iCopper'] = { x = 25, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option3.png" )) }, ['exit'] = { x = 47, y = 69, w = 6, h = 15, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_ok.png" )) }, ['lathe'] = { x = 70, y = 38, w = 4, h = 2, s = CreateSprite( use ) }, ['cstation'] = { x = 92, y = 38, w = 4, h = 2, s = CreateSprite( use ) }, ['furnace'] = { x = 70, y = 50, w = 4, h = 2, s = CreateSprite( use ) }, ['exp'] = { x = 80, y = 3, w = 12, h = 5, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option7.png" )) }, -- Menu icons ['tools'] = { x = 52, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option8.png" )) }, ['weapons'] = { x = 52, y = 30, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option9.png" )) }, ['bldgs'] = { x = 52, y = 43, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option10.png" )) }, ['food'] = { x = 52, y = 57, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option11.png" )) }, ['fibers'] = { x = 3, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option12.png" )) }, ['water'] = { x = 3, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\flask.png" )) }, ['flint'] = { x = 3, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option14.png" )) }, ['wood'] = { x = 3, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option15.png" )) }, ['meat'] = { x = 14, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option16.png" )) }, ['hides'] = { x = 27, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\b_option17.png" )) }, ['nails'] = { x = 38, y = 26, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\nails.png" )) }, -- Menu icons end -- Use Buttons ['hammer'] = { x = 70, y = 19, w = 4, h = 2, s = CreateSprite( use ) }, ['axe'] = { x = 92, y = 19, w = 4, h = 2, s = CreateSprite( use ) }, ['dagger'] = { x = 70, y = 29, w = 4, h = 2, s = CreateSprite( use ) }, ['bow'] = { x = 92, y = 29, w = 4, h = 2, s = CreateSprite( use ) }, ['arrow'] = { x = 92, y = 33, w = 4, h = 2, s = CreateSprite( use ) }, ['byPie'] = { x = 70, y = 56, w = 4, h = 2, s = CreateSprite( use ) }, ['bySoup'] = { x = 92, y = 56, w = 4, h = 2, s = CreateSprite( use ) }, ['mtPie'] = { x = 70, y = 60, w = 4, h = 2, s = CreateSprite( use ) }, ['mtSoup'] = { x = 92, y = 60, w = 4, h = 2, s = CreateSprite( use ) }, ['mbtSoup'] = { x = 92, y = 64, w = 4, h = 2, s = CreateSprite( use ) }, ['mbtPie'] = { x = 70, y = 64, w = 4, h = 2, s = CreateSprite( use ) }, ['shelter'] = { x = 70, y = 44, w = 4, h = 2, s = CreateSprite( use ) }, ['stove'] = { x = 92, y = 42, w = 4, h = 2, s = CreateSprite( use ) }, ['wkbench'] = { x = 92, y = 46, w = 4, h = 2, s = CreateSprite( use ) }, ['tubers'] = { x = 15, y = 18, w = 3, h = 3, s = CreateSprite( LoadImage( "scriptbank\\ss1\\tubers.png" )) }, ['berries'] = { x = 26, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\berries.png" )) }, ['iron'] = { x = 14, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\iron.png" )) }, ['copper'] = { x = 26, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\copper.png" )) }, ['lead'] = { x = 38, y = 34, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\lead.png" )) }, ['planks'] = { x = 14, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\planks.png" )) }, ['logs'] = { x = 26, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\logs.png" )) }, ['resin'] = { x = 38, y = 42, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\resin.png" )) }, ['chems'] = { x = 3, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems.png" )) }, ['chems2'] = { x = 14, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems2.png" )) }, ['chems3'] = { x = 26, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\chems3.png" )) }, ['steel'] = { x = 38, y = 59, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\isteel.png" )) }, ['splate'] = { x = 38, y = 50, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\splate.png" )) }, ['hndgun'] = { x = 57, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pistol.png" )) }, ['lnggun'] = { x = 57, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\rifle.png" )) }, ['ammo1'] = { x = 77, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\ammo.png" )) }, ['ammo2'] = { x = 77, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\ammo.png" )) }, ['pistol'] = { x = 70, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['pAmmo'] = { x = 92, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['rifle'] = { x = 70, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['rAmmo'] = { x = 92, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['title'] = { x = 39, y = 0, w = 20, h = 10, s = CreateSprite( LoadImage( "scriptbank\\ss1\\title.png" )) }, ['shrooms'] = { x = 37, y = 18, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\mushroom.png" )) }, ['bandage'] = { x = 5, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\dressing.png" )) }, ['medkit'] = { x = 5, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\medikit.png" )) }, ['pill1'] = { x = 25, y = 73, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pill1.png" )) }, ['pill2'] = { x = 25, y = 80, w = 4, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\pill2.png" )) }, ['dressing'] = { x = 18, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['mediKit'] = { x = 18, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['antidote'] = { x = 37, y = 74, w = 4, h = 2, s = CreateSprite( use ) }, ['booster'] = { x = 37, y = 82, w = 4, h = 2, s = CreateSprite( use ) }, ['recipes'] = { x = 4, y = 3, w = 13, h = 4, s = CreateSprite( LoadImage( "scriptbank\\ss1\\recipies.png" )) } } RecipeButtons = { ['recipes'] = { x = 10, y = 10, w = 80, h = 80, s = CreateSprite( LoadImage( "scriptbank\\ss1\\recipes.png" )) } } -- MouseCursor Cursor = CreateSprite( LoadImage ( "scriptbank\\ss1\\cursor.png" )) SetSpriteSize ( Cursor, 2.5, 2.5 ) SetSpritePosition( Cursor, 200, 200 ) for _, v in pairs( MainButtons ) do SetSpriteSize ( v.s, v.w , v.h ) SetSpritePosition ( v.s, 200, 200 ) end for _, v in pairs( RecipeButtons ) do SetSpriteSize ( v.s, v.w , v.h ) SetSpritePosition ( v.s, 200, 200 ) end end local MouseActive = false local pressed = false local MouseDown = false local function ShowMouseCoords() -- for if you need to know them Prompt ("X :"..g_MouseX.." Y:"..g_MouseY) end local function MainMenuActivated() for _, v in pairs( MainButtons ) do SetSpritePosition ( v.s, v.x, v.y ) end end local function RecipeMenuActivated() for _, v in pairs( RecipeButtons ) do SetSpritePosition ( v.s, v.x, v.y ) end end local currMenu = 'Main' local function HideSprites() if currMenu == 'Main' then for _, v in pairs( MainButtons ) do SetSpritePosition ( v.s, 200, 200 ) end elseif currMenu == 'recipes' then for _, v in pairs( RecipeButtons ) do SetSpritePosition ( v.s, 200, 200 ) end end end local function MouseDeactivated() DeactivateMouse() MouseActive = false SetSpritePosition( Cursor, 200, 200 ) SetPlayerWeapons(1) HideSprites() end local function ShowMainMenu() Panel( 0, 0, 100, 88) -- background Panel( 37, 1, 61, 10) -- Top Panel( 1, 13, 49.5, 68) -- left Panel( 49.5, 13, 99, 68) -- right Panel( 55, 69, 99, 86) -- right bottom Panel( 1, 69, 45, 86) -- left bottom Panel( 78, 1, 98, 10) -- survival exp Panel( 1, 1, 21, 10) -- survival exp local function doText(x, y, name, value) TextColor( x, y, tSize, name .. " " .. math.floor( value ), 10, 255, 10 ) end --menu text plants doText( 8, 20, "Fibers", g_fiberscollected ) doText( 19, 20, "Tubers", g_tuberscollected ) doText( 32, 20, "Berries", g_berriescollected ) doText( 42, 20, "Shrooms", g_mushroomscollected ) --menu text water doText( 8, 27, "Flask", g_flask ) doText( 8, 29, "Water", g_waterscollected ) -- menu text minerals doText( 19, 36, "Iron", g_ironscollected ) doText( 8, 36, "Flint", g_flintcollected ) doText( 32, 36, "Copper", g_coppercollected ) doText( 43, 36, "Lead", g_leadcollected ) -- menu text Chems doText( 8, 52, "Sulphur", g_sulphurscollected ) doText( 19, 52, "Saltpeter", g_saltpeterscollected ) doText( 32, 52, "Carbon", g_carbonscollected ) doText( 43, 52, "S Plate", g_splate ) -- menu text wood doText( 8, 44, "Wood", g_woodcollected ) doText( 19, 44, "Planks", g_planks ) doText( 32, 44, "Logs", g_logs_made ) doText( 43, 44, "Resin", g_resin ) -- menu text meat doText( 19, 28, "Meat", g_meatcollected ) -- menu text Skins doText( 32, 28, "Hides", g_hidecollected ) doText( 43, 28, "Nails", g_nails ) -- menu text tools doText( 57, 20, "Hammers Crafted", g_fhammer ) doText( 79, 20, "Axe's Crafted", g_faxe ) --menu text weapons and ammo doText( 57, 30, "Daggers Crafted", g_fdagger ) doText( 79, 30, "Bows Crafted", g_ibow ) doText( 79, 34, "Arrows Crafted", g_arrow ) --menu text housing doText( 57, 45, "Shelters Crafted", g_shelter ) doText( 79, 43, "Stove Crafted", g_cooker ) doText( 79, 47, "Workbench Crafted", g_workbench ) doText( 57, 51, "Furnace Crafted", g_furnace ) doText( 57, 39, "Lathe Crafted", g_lathe ) doText( 79, 39, "Chem Station Crafted", g_cstation ) -- menu text food doText( 57, 57, "Berry pies crafted", g_berry_pie ) doText( 79, 57, "Berry soup crafted", g_berry_soup ) doText( 57, 61, "Meat Pies crafted", g_meat_pie ) doText( 79, 61, "Meat soup crafted", g_meat_soup ) doText( 57, 65, "Meat,berry & Tuber Broth crafted", g_mbtbroth ) doText( 79, 65, "Meat,berry & Tuber Pie crafted", g_mbtpie ) -- menu text ingots doText( 8, 61, "Iron(i)", g_iingot ) doText( 19, 61, "Lead(i)", g_lingot ) doText( 30, 61, "Copper(i)", g_cingot ) doText( 43, 61, "Steel(i)", g_singot ) -- Advanced Weapons doText( 64, 75, "Pistols", g_pistol ) doText( 64, 83, "Rifles", g_rifle ) doText( 82, 75, "Pistol Ammo", g_pistol_ammo ) doText( 82, 83, "Rifle Ammo", g_rifle_ammo ) --menu text experience doText( 91, 6, '', g_exp ) -- Meds doText( 10, 75, "Bandages", g_bandages ) doText( 10, 83, "Medipacks", g_medipack ) doText( 30, 75, "Antidote", g_antidote ) doText( 30, 83, "Boosters", g_booster ) end local function ShowRecipesMenu() -- Text stuff for Recipes in here end local function HandleMouseClicks( e ) local bt_clicked = 'none' if currMenu == 'Main' then -- Handle Your mouse click events here for k, v in pairs( MainButtons ) do if g_MouseX > v.x and g_MouseX < v.x + v.w and g_MouseY > v.y and g_MouseY < v.y + v.h then bt_clicked = k break end end if bt_clicked == 'none' then return end --PromptDuration( bt_clicked , 2000 ) -- Handle your bt_clicked events here: bt_clicked option chosen if bt_clicked == 'iIron' then -- Button 1 clicked PromptDuration ( "Iron Ingot", 3000 ) elseif bt_clicked == 'iLead' then PromptDuration ( "Lead Ingot", 3000 ) elseif bt_clicked == 'iCopper' then PromptDuration ( "Copper Ingot", 3000 ) elseif bt_clicked == 'exit' then MouseDeactivated() elseif bt_clicked == 'cstation' and (g_iingot >=4 and g_cingot >=4 and g_watercollected >=4 and g_woodcollected >=4) then g_iingot = g_iingot - 4 -- take items from inventory g_cingot = g_cingot - 4 -- take items from inventory g_woodcollected = g_woodcollected - 4 -- take items from inventory g_cstation = g_cstation + 1 PromptDuration ( " You Crafted a Lathe", 3000 ) elseif bt_clicked == 'lathe' and (g_iingot >=4 and g_cingot >=4 and g_woodcollected >=4) then g_iingot = g_iingot - 4 -- take items from inventory g_cingot = g_cingot - 4 -- take items from inventory g_woodcollected = g_woodcollected - 4 -- take items from inventory g_lathe = g_lathe +1 PromptDuration ( " You Crafted a Lathe", 3000 ) elseif bt_clicked == 'furnace' and (g_ironscollected >=6 and g_flintcollected >=6 and g_woodcollected >=4) then g_ironscollected = g_ironscollected - 4 -- take items from inventory g_woodcollected = g_woodcollected - 4 -- take items from inventory g_flintcollected = g_flintcollected - 6 -- take items from inventory g_furnace = g_furnace + 1 g_exp = g_exp + 100 -- adds exp N.B you can change this to what you want depending on the complexity of each item PromptDuration ( " You crafted a Furnace", 3000 ) elseif bt_clicked == 'exp' then PromptDuration ( "Experience", 3000 ) -- lines below are to tell GG what to actually do when the buttons are pressed e.g copy and paste a section and edit to suit -- use buttons elseif bt_clicked == 'hammer' and (g_woodcollected >= 2 and g_fiberscollected >= 2 and g_flintcollected >= 2) then AddPlayerWeapon(453) -- number of the Hammer entity goes here g_woodcollected = g_woodcollected - 2 -- take items from inventory g_fiberscollected = g_fiberscollected - 2 -- take items from inventory g_flintcollected = g_flintcollected - 2 -- take items from inventory g_fhammer = g_fhammer + 1 -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp N.B you can change this to what you want depending on the complexity of each item PromptDuration ( "You Crafted a Hammer", 3000 ) elseif bt_clicked == 'axe' and (g_woodcollected >= 2 and g_fiberscollected >= 2 and g_flintcollected >= 2) then AddPlayerWeapon(452) -- number of the Axe entity goes here g_woodcollected = g_woodcollected - 2 -- take items from inventory g_fiberscollected = g_fiberscollected - 2 -- take items from inventory g_flintcollected = g_flintcollected - 2 -- take items from inventory g_faxe = g_faxe + 1 -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted an Axe", 3000 ) elseif bt_clicked == 'dagger' and (g_woodcollected >= 2 and g_fiberscollected >= 2 and g_flintcollected >= 2) then AddPlayerWeapon(454) -- number of the Dagger entity goes here g_woodcollected = g_woodcollected - 2 -- take items from inventory g_fiberscollected = g_fiberscollected - 2 -- take items from inventory g_flintcollected = g_flintcollected - 2 -- take items from inventory g_fdagger = g_fdagger + 1 -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted a Dagger", 3000 ) elseif bt_clicked == 'bow' and (g_woodcollected >= 2 and g_fiberscollected >= 2 and g_flintcollected >= 2) then AddPlayerWeapon(455) -- number of the Bow entity goes here g_woodcollected = g_woodcollected - 2 -- take items from inventory g_fiberscollected = g_fiberscollected - 2 -- take items from inventory g_flintcollected = g_flintcollected - 2 -- take items from inventory g_ibow = g_ibow + 1 -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted a Bow", 3000 ) elseif bt_clicked == 'arrow' and (g_woodcollected >= 2 and g_fiberscollected >= 2 and g_flintcollected >= 2) then AddPlayerAmmo(456) -- number of the Arrows entity goes here g_woodcollected = g_woodcollected - 2 -- take items from inventory g_fiberscollected = g_fiberscollected - 2 -- take items from inventory g_flintcollected = g_flintcollected - 2 -- take items from inventory g_arrow = g_arrow + 1 -- adds crafted item to inventory for exp g_exp = g_exp + 10 -- adds exp PromptDuration ( "You Crafted 10 Arrows", 3000 ) elseif bt_clicked == 'byPie' and (g_berry_pie >= 1) then SetPlayerHealth( g_PlayerHealth + 21 ) PromptDuration ( "Eat Berry Pie", 3000 ) elseif bt_clicked == 'bySoup' and (g_berriescollected >= 2 and g_watercollected >= 2) then g_berriescollected = g_berriescollected - 2 -- subtract berries from inventory g_watercollected = g_watercollected - 2 -- subtract water from inventory SetPlayerHealth( g_PlayerHealth + 11 ) AddPlayerHealth ( 40 ) g_exp = g_exp + 10 -- adds exp PromptDuration ( "You eat some Berry Soup", 3000 ) elseif bt_clicked == 'mtPie' and (g_meat_pie >= 1) then SetPlayerHealth( g_PlayerHealth + 35 ) PromptDuration ( "You Eat Meat Pie", 3000 ) elseif bt_clicked == 'mbtSoup' and (g_mbtbroth >= 1) then SetPlayerHealth( g_PlayerHealth + 60 ) PromptDuration ( "You Eat Meat, Berry & Tuber Soup", 3000 ) elseif bt_clicked == 'mbtPie' and (g_mbtpie >= 1) then SetPlayerHealth( g_PlayerHealth + 100 ) PromptDuration ( "You Eat Meat, Berry & Tuber Pie", 3000 ) elseif bt_clicked == 'mtSoup' and (g_watercollected >= 2 and g_meatcollected >= 2) then g_watercollected = g_watercollected - 2 -- subtract water from inventory g_meatcollected = g_meatcollected - 2 -- subtract meat from inventory SetPlayerHealth( g_PlayerHealth + 31 ) AddPlayerHealth( 40 ) g_exp = g_exp + 10 --adds exp PromptDuration ( "You eat Meat Soup", 3000 ) elseif bt_clicked == 'shelter' and (g_woodcollected >= 2 and g_fiberscollected >= 2) then g_woodcollected = g_woodcollected - 2 --take items from inventory g_fiberscollected = g_fiberscollected - 2 --take items from inventory g_shelter = g_shelter + 1 -- add shelter to inventory g_exp = g_exp + 50 -- adds exp PromptDuration ( "You have crafted a shelter", 3000 ) elseif bt_clicked == 'stove' and (g_woodcollected >=2 and g_flintcollected >=2) then g_woodcollected = g_woodcollected - 2 --take items from inventory g_flintcollected = g_flintcollected - 2 --take items from inventory g_cooker = g_cooker + 1 -- add fire to inventory g_exp = g_exp + 50 -- adds exp PromptDuration ( "You have crafted a cooker", 3000 ) elseif bt_clicked == 'wkbench' and (g_woodcollected >= 2 and g_flintcollected >= 2 and g_ironscollected >= 4) then g_woodcollected = g_woodcollected - 2 --take items from inventory g_flintcollected = g_flintcollected - 2 --take items from inventory g_ironscollected = g_ironscollected - 4 --take items from inventory g_workbench = g_workbench + 1 g_exp = g_exp + 100 -- adds exp PromptDuration ( "You have crafted a Workbench", 3000 ) elseif bt_clicked == 'pistol' and (g_pistol >= 1) then AddPlayerWeapon( 457 ) -- number of the Pistol entity goes here g_pistol = g_pistol - 1 PromptDuration ( "Pistol Used", 3000) elseif bt_clicked == 'pAmmo' and (g_pistol_ammo >= 1 ) then AddPlayerAmmo( 458 ) -- number of the Pistol Ammo entity goes here g_pistol_ammo = g_pistol_ammo - 1 PromptDuration ( "Pistol Ammo Used", 3000 ) elseif bt_clicked == 'rifle' and (g_rifle >=1 ) then AddPlayerWeapon( 459 ) -- number of the Rifle entity goes here g_rifle = g_rifle - 1 PromptDuration ( "Rifle Used", 3000 ) elseif bt_clicked == 'rAmmo' and (g_rifle_ammo >= 1 ) then AddPlayerAmmo( 460 ) g_rifle_ammo = g_rifle_ammo - 1 PromptDuration ( "Rifle Ammo Used", 3000 ) elseif bt_clicked == 'dressing' and (g_bandages >= 1 ) then AddPlayerHealth( 50 ) g_bandages = g_bandages - 1 PromptDuration ( "Dressing Used", 3000 ) elseif bt_clicked == 'mediKit' and (g_medipack >= 1 ) then AddPlayerHealth( 100 ) g_medipack = g_medipack - 1 PromptDuration ( "Medikit Used", 3000 ) elseif bt_clicked == 'antidote' then PromptDuration ( "Antidote Used", 3000 ) elseif bt_clicked == 'booster' then PromptDuration ( "Booster Used", 3000 ) elseif bt_clicked == 'recipes' then -- change menu HideSprites() currMenu = 'recipes' RecipeMenuActivated() end elseif currMenu == 'recipes' then -- Recipe stuff in here for k, v in pairs( RecipeButtons ) do if g_MouseX > v.x and g_MouseX < v.x + v.w and g_MouseY > v.y and g_MouseY < v.y + v.h then bt_clicked = k break end end if bt_clicked == 'none' then return end --PromptDuration( bt_clicked , 2000 ) if bt_clicked == 'recipes' then HideSprites() currMenu = 'Main' MainMenuActivated() end end end function survival_inventory_main( e ) local baseOsT = nil function survival_inventory_main( e ) TextColor(3,94,3,"Evil Kill Counter "..g_kills,255,0,0) local T = os.time() if baseOsT == nil then baseOsT = T end TextColor(3, 97, 3, os.date("You have survived for %X", T - baseOsT) , 252, 3, 47) if GetInKey() == "i" then if not pressed then pressed = true if MouseActive then MouseActive = false MouseDeactivated() else MouseActive = true ActivateMouse() currMenu = 'Main' MainMenuActivated() end end else pressed = false end if MouseActive then SetPlayerWeapons(0) SetSpritePosition ( Cursor , g_MouseX ,g_MouseY ) if g_MouseClick == 1 then if not MouseDown then MouseDown = true HandleMouseClicks( e ) end else MouseDown = false end if currMenu == 'Main' then ShowMainMenu() elseif currMenu == 'Recipes' then ShowRecipesMenu() end else DeactivateMouse() end end end