zUsername

  • Content Count

    175
  • Joined

  • Last visited

Community Reputation

49 Excellent

1 Follower

About zUsername

  • Rank
    Member
...

Badges

Recent Profile Visitors

2691 profile views
  1. Done. Add me on steam for the file. A new meter; Chakra meter. An action to heal other players (it costs a significant amount of chakra).
  2. Thanks you. I just submitted a thread to bug tracker. Hope they will fix it soon.
  3. 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.
  4. 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.
  5. 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.
  6. You mising AddNetwork(). Try to put this code after local anim = inst.entity:AddAnimState() inst.entity:AddNetwork()
  7. You must post the code here so we can figure out what happened with you?
  8. 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)
  9. You can print(TimeLastSincePoop(inst)) when TimeLastSincePoop(inst) = 120 Its will poop
  10. 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
  11. 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.
  12. Can you give me a log file and character.lua file ?
  13. It will get 40 and delete that extra 10 you harvested.