CanDoIt Posted February 27 Share Posted February 27 How to perform action that use book from bookstation and get how uses left on books ? Link to comment https://forums.kleientertainment.com/forums/topic/169917-clientside-action-to-read-book-and-check-uses-left/ Share on other sites More sharing options...
CanDoIt Posted February 28 Author Share Posted February 28 (edited) Managed how to read book, but how to get uses left if not mastersim ? Nothing in replica local ImageButton = require "widgets/imagebutton" local function Read(self) local items = self.container.replica.container:GetItems() local book = items[1] GLOBAL.ThePlayer.replica.inventory:UseItemFromInvTile(book) end AddClassPostConstruct("widgets/containerwidget", function(self) local oldopenfn = self.Open function self:Open(container, doer, ...) oldopenfn(self, container, doer, ...) -- local widget = container.replica.container:GetWidget() if doer and doer:HasTag("reader") then self.buttonx = self:AddChild(ImageButton("images/ui.xml", "button_small.tex", "button_small_over.tex", "button_small_disabled.tex", nil, nil, {1,1}, {0,0})) self.buttonx.image:SetScale(1.07) self.buttonx.text:SetPosition(2,-2) self.buttonx:SetPosition(-200, 0) self.buttonx:SetText("READ") self.buttonx:SetTextSize(33) self.buttonx.text:SetColour(0, 0, 0, 1) self.buttonx:SetOnClick(function() Read(self) end) self.buttonx:Show() end end local oldclosefn = self.Close function self:Close(...) if self.container and self.container.prefab:find("bookstation") then self.buttonx:Kill() end return oldclosefn(self, ...) end end) Edited February 28 by CanDoIt forgot argument for Read function Link to comment https://forums.kleientertainment.com/forums/topic/169917-clientside-action-to-read-book-and-check-uses-left/#findComment-1852704 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now