
zUsername
-
Content Count
175 -
Joined
-
Last visited
Community Reputation
49 ExcellentAbout zUsername
-
Rank
Member
Badges
Recent Profile Visitors
2757 profile views
-
"itemget" event for backpack
zUsername replied to zUsername's topic in [Don't Starve Together] Mods and Tools
Thanks you. I just submitted a thread to bug tracker. Hope they will fix it soon. -
inst:ListenForEvent("gotnewitem", function(inst, data) if data then print("data") end if data.item then print("data.item") end if data.slot then print("data.slot") end if data.src_pos then print("data.src_pos") end end) I'm tested this code in dedicated server as client and the code works fine. But if I start hosting without dedicated server, data.src_pos will return nil. So I hope you guys can fix it.
-
"itemget" event for backpack
zUsername replied to zUsername's topic in [Don't Starve Together] Mods and Tools
I have problem with gotnewitem now. inst:ListenForEvent("gotnewitem", function(inst, data) inst:ListenForEvent("gotnewitem", function(inst, data) if data then print("data") end if data.item then print("data.item") end if data.slot then print("data.slot") end if data.src_pos then print("data.src_pos") end -- data.src_pos = nil on host. But it's work fine on dedicated server. end) data.src_pos = nil on host. But it's work fine on dedicated server. And the second question is AddStategraphPostInit for "wilson_client" not work on host too. So any idea? And I'm working on client_only_mod. Thank in advance. -
"itemget" event for backpack
zUsername replied to zUsername's topic in [Don't Starve Together] Mods and Tools
Nice. Thanks you -
local function Test(inst) inst:ListenForEvent("itemget", function(inst, data) -- "itemget" only work in player inventory. print(data.item.prefab) end) end local function pfn(player) player:DoTaskInTime(1,function() local inst = _G.ThePlayer if not inst or not inst.components.playercontroller then player:DoTaskInTime(1,function() pfn(player) end) return end Test(inst) end) end AddPlayerPostInit(pfn) I have a problem. "itemget" event only trigger when item going in player inventory and not trigger when item going in backpack. So do we have event which will work on both player inventory and backpack? And the mod I'm working on is "client_only_mod". Thank in advance.
-
Gloves as a weapon (help needed)
zUsername replied to ParanoiaGod69's topic in [Don't Starve Together] Mods and Tools
Did you had art sssets for your Gloves? -
HELP! Perk to carry more!
zUsername replied to Boot's topic in [Don't Starve Together] Mods and Tools
try add this code above: if not GLOBAL.TheWorld.ismastersim then return inst end local function test(self) if not GLOBAL.TheWorld.ismastersim then return end local _OnPutInInventory = self.OnPutInInventory self.OnPutInInventory = function(self, owner) if owner ~= nil and owner.prefab == "yourcharacter" then if self.inst.components.stackable ~= nil and self.inst.replica.stackable ~= nil and not self.inst.replica.stackable.newsize then self.inst.replica.stackable.newsize = true self.inst.components.stackable.maxsize = self.inst.components.stackable.maxsize + 10 end end return _OnPutInInventory(self, owner) end local _OnDropped = self.OnDropped self.OnDropped = function(self, randomdir) if self.inst.components.stackable ~= nil and self.inst.replica.stackable ~= nil and self.inst.replica.stackable.newsize then self.inst.replica.stackable.newsize = false self.inst.components.stackable.maxsize = self.inst.components.stackable.maxsize - 10 if self.inst.components.stackable.stacksize > self.inst.components.stackable.maxsize then self.inst.components.stackable.stacksize = self.inst.components.stackable.maxsize end end return _OnDropped(self, randomdir) end end AddComponentPostInit("inventoryitem", test) -
You can print(TimeLastSincePoop(inst)) when TimeLastSincePoop(inst) = 120 Its will poop
-
HELP! Perk to carry more!
zUsername replied to Boot's topic in [Don't Starve Together] Mods and Tools
First add this code to modmain.lua local function test(self) local _OnPutInInventory = self.OnPutInInventory self.OnPutInInventory = function(self, owner) if owner ~= nil and owner.prefab == "yourcharacter" then if self.inst.components.stackable ~= nil and self.inst.replica.stackable ~= nil and not self.inst.replica.stackable.newsize then self.inst.replica.stackable.newsize = true self.inst.components.stackable.maxsize = self.inst.components.stackable.maxsize + 10 end end return _OnPutInInventory(self, owner) end local _OnDropped = self.OnDropped self.OnDropped = function(self, randomdir) if self.inst.components.stackable ~= nil and self.inst.replica.stackable ~= nil and self.inst.replica.stackable.newsize then self.inst.replica.stackable.newsize = false self.inst.components.stackable.maxsize = self.inst.components.stackable.maxsize - 10 if self.inst.components.stackable.stacksize > self.inst.components.stackable.maxsize then self.inst.components.stackable.stacksize = self.inst.components.stackable.maxsize end end return _OnDropped(self, randomdir) end end AddComponentPostInit("inventoryitem", test) Second download attachment file. Third move downloaded attachment file to yourmod/scripts/components stackable_replica.lua -
local function TimeSinceLastPoop(inst) if inst.lastpooptime ~= nil then --checks if lastpooptime is not nil, which means you have pooped sometime before return GetTime() - inst.lastpooptime end return 0 end -- Spawn poop when sanity is low (basicly crap your pants) local function OnSanityDelta(inst, data) if data.newpercent <= .20 then if inst.lastpooptime == nil or TimeSinceLastPoop(inst) > TUNING.SEG_TIME*4 then inst.lastpooptime = GetTime() inst.components.talker:Say("AHH! I just saw something just jumped at me!") SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end end local master_postinit = function(inst) inst.lastpooptime = nil inst:ListenForEvent("sanitydelta", OnSanityDelta) end Tested.
-
Can you give me a log file and character.lua file ?
-
HELP! Perk to carry more!
zUsername replied to Boot's topic in [Don't Starve Together] Mods and Tools
It will get 40 and delete that extra 10 you harvested.