Search the Community
Showing results for tags 'chance'.
Found 2 results
[Code] Chance to cause effect
posted a topic in [Don't Starve Together] Mods and ToolsHi 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
Dodge Chance for Character
posted a topic in [Don't Starve Together] Mods and ToolsHello! I was wondering a couple of things, Firstly how would I make a character have the ability to dodge say 40% of all attacks done to them? I guess it would en tale no damage being given on a random chance basic and maybe a "miss" sound being played. I can do the sound just the dodge part I have no idea where to start. Also speaking of starting, I made a couple mods a while ago and am getting back into it but forgot alot of stuff, what are some good resources to have for the scripting aspect of modding? Every tutorial I have seen thus far is always just the basics and never really explains any scripting or anything. Thank you!