Jump to content

intog

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About intog

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

887 profile views
  1. Thanks. Yes I worked that out by digging around. The tutorial needs to be updated/corrected because it doesn't work as written.
  2. I've used Leadwerks on/off and wanted to get a refresher and start from scratch on lua scripting. I'm starting with this tutorial: http://www.leadwerks.com/werkspace/page/tutorials/_/lua-scripting-r12 upon running, I get this error: Can someone assist? I'm not sure what this error means, but I pasted directly from the sample as the tutorial states. Thanks!
  3. Is there any way to adjust the shadows?
  4. Hi everyone, I'm new here and somewhat new to programming (other than Actionscript 8 years ago and OpenSCAD modeling recently) I followed through Jorn's Project Saturn videos and now I'm wondering how I can finish the inventory scripts on my own. Jorn left off with an open function for using the item, but didn't go into how to remove the item after it's used. I'm guessing I need to remove that item's table from the inventory table but am a little lost on doing that and also since there are 3 scripts working together for the inventory, I'm not sure where this function would reside. Here is my bottle.lua script that I modified slightly to make it reusable for other items: Edit: Nevermind I fixed it on my own by adding a new variable to the table using the code in red: --this was the Bottle.lua script-- Script.InvIcon = "" -- path "Icon" "Tex file (*tex) :tex" Script.collectOnce = true -- bool "Collect once?" Script.reuseItem = true -- bool "Reuse Item?" Script.itemName = "Item" --string "Item Name" Script.useOnce = true -- bool "Use Once?" function Script:Use(player) -- allows hand use local playerInventory = player.script:GetInventory() -- reference player inventory if playerInventory == nil then error("no inventory") end System:Print("we got inventory") if not playerInventory:IsFull() then -- if inventory is NOT full, then: System:Print("we place the " ..self.itemName.. " into the inventory") local item = self:CreateInventoryItem() playerInventory:AddItemToInventory(item) if self.collectOnce then self.entity:Release() end end end function Script:CreateInventoryItem() item = InventoryItem:Create() item.name = self.itemName item.texture = Texture:Load(self.InvIcon) item.useOnce = self.useOnce item.UseInventoryItem = function() System:Print("You used the " .. self.itemName .. "!") end return item end Then I updated the use function in Inventory.lua (from the videos): if self.items.useOnce then self.items = nil end Thanks for your help!
×
×
  • Create New...