Search the Community
Showing results for tags 'chance'.
Found 1 result
Hi everyone, I have been working on project that includes weapon which makes enemies fall asleep after hit. I had searched through game files and I haven't found any code lines to make my effect based on luck. I mean that I don't want this effect to occur everytime character hits with the weapon. So maybe you know method to cause sleep on attack every few hits. This is the code: ------sleep local function sleepattack(inst, owner, target) if not target:IsValid() then --target killed or removed in combat damage phase return end target.SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo") if target.components.sleeper ~= nil then target.components.sleeper:AddSleepiness(100, 15, inst) elseif target.components.grogginess ~= nil then target.components.grogginess:AddGrogginess(100, 15) end end Thanks in advance and have a great day/night