ClownTech Posted April 26, 2023 Share Posted April 26, 2023 So i recently made a code which ups a value +1 every time you die (deathcount) and When playing on worlds without caves where im the host, it works fine. however when i host it on a world with caves where the world is being hosted off a dedicated server, it does not go up in value because it hasn't sent to all the clients in the server. i believe this is to do with netvar, however i havent dabbled into it enough to understand it, if anybody could help that would be awe some Modmain; Spoiler local deathcountUI = require "/widgets/deathcounterwidget" AddClassPostConstruct("widgets/statusdisplays", function(self) self.owner.deathcounterwidget = self:AddChild(deathcountUI(self.owner, 0, 0)) end) Widgets; Spoiler local widget = require "widgets/widget" local text = require "widgets/text" local deathcountUI = Class(widget, function(self, inst, anchor_x, anchor_y) self.inst = inst self.x = anchor_x self.y = anchor_y widget._ctor(self, "deathcountUI") self.title = self:AddChild(text(BODYTEXTFONT, 33, "Death Count: ", UICOLOURS.WHITE)) self.title:SetPosition(self.x - 100, self.y + 20) self.deaths = self:AddChild(text(BODYTEXTFONT, 33)) self.deathsval = 0 self.title:Show() tostring(1) inst:ListenForEvent("death", function(inst, data) self.deathsval = self.deathsval + 1 self.deaths:SetString(self.deathsval) end) -- self:StartUpdating() self.deaths:SetString(self.deathsval) self.deaths:SetColour(44, 0, 0, 1) self.deaths:SetPosition(self.x + 20, self.y + 20) end) return deathcountUI Link to comment https://forums.kleientertainment.com/forums/topic/147404-code-works-on-nocaves-worlds-but-not-on-worlds-with-caves/ Share on other sites More sharing options...
Littlefat1213 Posted May 3, 2023 Share Posted May 3, 2023 you know the death event is pushed by health component , and the components only exists in mastersim, the client side may can't listen for it Link to comment https://forums.kleientertainment.com/forums/topic/147404-code-works-on-nocaves-worlds-but-not-on-worlds-with-caves/#findComment-1633356 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