Jump to content

Grillby Information  

10 members have voted

  1. 1. Should Grillby set things near him on fire if near them for too long?

    • Yes
      2
    • Yes, but not man-made objects
      4
    • No, being able to light objects with his hands is enough
      3
    • No, he shouldn't be able to, nor should he be allowed to light objects with his hands
      1
  2. 2. Do you have any ideas you are completely against in this mod?

    • Fuel Bar
      1
    • Ice Flingomatic targeting system
      0
    • Automatically cooking food
      0
    • Giving off light if above a certain Fuel level
      0
    • Severe penalties when wet (despite drying faster)
      0
    • Extra sanity around fire, Papyrus, Sans, or other sources
      1
    • Alcoholic Drinks (meaning the alcohol system and Alcohol Poisoning)
      1
    • Normal Drinks (meaning the Juice Bar entirely)
      0
    • Sanity loss around all water, even unavoidable water
      1
    • Lack of ability to freeze or overheat
      2
    • Nothing (since the forums require the field if you answer Question #1)
      5
  3. 3. If I were to remove the Alcohol System, what would you like to see in place of it (as the drinks need a debuff for balancing)?

    • Sanity loss (getting drunk and seeing things)
      3
    • Health penalties (alcohol is unhealthy)
      3
    • Hunger penalties (not sure why this would be, plus this would be redundant, probably not included)
      0
    • No penalties (drink away)
      1
    • Other (leave a comment below!)
      0


Recommended Posts

On 1/27/2016 at 6:39 PM, NyctoDarkMatter said:

I can make this a bit simpler. The MAIN thing I need is for someone to post the code for draining Wetness at a higher rate while wet. If I can do that, I can write a similar code to drain all of his other stats when wet, but I'm not sure how to make Wetness drain faster. I've tried looking at codes of heat sources and umbrellas and such, but I mainly find resistances, not draining.

To make a character dry faster you can just alter their base drying rate, in master_postinit:

inst.components.moisture.baseDryingRate = 5

Note that the default base drying rate is 0. Additionally, if you want him to dry even faster than that you'll also have to raise the max rate (since 5.1 is the default cap):

inst.components.moisture.maxPlayerTempDrying = 20

 

Okay, so I know how to link status effects to when it rains; how can I change this example code to work when wet, not just when it's raining?

local function RainDebuff(inst)
	-- Starts debuffs: -.2 stats in .1 seconds
    inst.components.health:StartRegen(-.2, .1)
	inst.components.hunger:StartRegen(-.2, .1)
	inst.components.sanity:StartRegen(-.2, .1)
end

Oh, and I currently have this listening:

    inst:WatchWorldState("startrain", RainDebuff)
    inst:WatchWorldState("stoprain", Normal)
Edited by NyctoDarkMatter
Added WorldState info.

Add flags to your functions

local function RainDebuff(inst)
	-- Starts debuffs: -.2 stats in .1 seconds
	inst.components.health:StartRegen(-.2, .1)
	inst.components.hunger:StartRegen(-.2, .1)
	inst.components.sanity:StartRegen(-.2, .1)

	-- Flags
	inst.raindebuff = true
	inst.drynormal = nil
end

local function Normal(inst)
	-- Stop debuffs, etc.
	
	-- Flags
	inst.raindebuff = nil
	inst.drynormal = true
end

Put this on the prefab file

local function OnMoistureDelta(inst)
	-- Get moisture
	local moisture = inst.components.moisture.moisture
	-- If wet
	if moisture > 0 then
		-- If debuff is applied, then return, don't apply again
		if inst.raindebuff then
			return
		end
		RainDebuff(inst)
	-- Not wet
	else
		-- Go to normal, if you aren't yet
		if inst.drynormal then
			return
		end
		Normal(inst)
	end
end

to trigger the functions once per state (wet or dry).

And add this inside the master_postinit

	-- You start dry
	inst.drynormal = true

	-- Listen to moisture changes
	inst:ListenForEvent("moisturedelta", OnMoistureDelta)
	-- This will run after the moisture value loads
	-- because the OnLoad of moisture component changes the moist value
	-- and doesn't trigger the event
	inst:DoTaskInTime(0, OnMoistureDelta)

to listen to the moisture changes.

Edited by DarkXero
local function RainDebuff(inst)
	-- Starts debuffs: -.2 stats in .1 seconds
    inst.components.health:StartRegen(-.2, .1)
	inst.components.hunger.custom_rate_fn = function(inst)
        return TUNING.DAPPERNESS_LARGE * -1
	end
	inst.components.sanity.custom_rate_fn = function(inst)
        return TUNING.DAPPERNESS_LARGE * -3
	end
	

Okay, so Sanity and Health drain are working fine, Hunger isn't draining at all. How can I change the Hunger rate in this code?
Also, @DarkXero, the Health regen doesn't stop when rain stops or when the character is no longer wet (I also noticed that wetness was stuck at 1). How can I fix this?

19 minutes ago, NyctoDarkMatter said:

How can I change the Hunger rate in this code?

inst.components.hunger:SetRate(2)

The normal hunger rate is 1.

19 minutes ago, NyctoDarkMatter said:

the Health regen doesn't stop when rain stops or when the character is no longer wet (I also noticed that wetness was stuck at 1)

My code determines that you are "wet" (debuff applies) if your moisture is over 0. If it's stuck at 1, then the health regen won't stop.

Post what you did to grillby's moisture on the prefab file.

--various moisture codebits from master_postinit:
	--Grillby dries very quickly when he gets wet. hue
	inst.components.moisture.baseDryingRate = 3
	inst.components.moisture.maxPlayerTempDrying = 20

	-- Listen to moisture changes
	inst:ListenForEvent("moisturedelta", OnMoistureDelta)
	-- This will run after the moisture value loads
	-- because the OnLoad of moisture component changes the moist value
	-- and doesn't trigger the event
	inst:DoTaskInTime(0, OnMoistureDelta)

	-- You start dry
	inst.drynormal = true

--OnMoistureDelta:
local function OnMoistureDelta(inst)
	-- Get moisture
	local moisture = inst.components.moisture.moisture
	-- If wet
	if moisture > 0 then
		-- If debuff is applied, then return, don't apply again
		if inst.raindebuff then
			return
		end
		RainDebuff(inst)
	-- Not wet
	else
		-- Go to normal, if you aren't yet
		if inst.drynormal then
			return
		end
		Normal(inst)
	end
end

--Various rain functions.
local function RainDebuff(inst)
	-- Starts debuffs: -.2 stats in .1 seconds
    inst.components.health:StartRegen(-.2, .1)
	inst.components.hunger:SetRate(5)
	inst.components.sanity.custom_rate_fn = function(inst)
        return TUNING.DAPPERNESS_LARGE * -3
	end
	
		-- Flags
	inst.raindebuff = true
	inst.drynormal = nil
end


local function RainDebuffSanity(inst)
	-- Starts sanity debuff: -.2 sanity in .1 seconds
	inst.components.sanity.custom_rate_fn = function(inst)
        return TUNING.DAPPERNESS_LARGE * -1
    end
end

local function Normal(inst)
	-- Stop debuffs, etc.
	
	-- Flags
	inst.raindebuff = nil
	inst.drynormal = true
end

That's everything having to do with Moisture in Grillby's code. Ironically, the Moisture bar disappeared, it's just that when I checked my Moisture (as I play with a controller, and pause shows my stats), my moisture was still at 1, thus killing me. Even when it stopped raining and I spawned a fire, the 1 refused to go away.

I attached grillby.lua for further reference. He works phenomenally thanks to you, @DarkXero. I'm just trying to sort out this little itty bug. If I have to, I can set it to require like 10 moisture so that it doesn't immediately start murdering your stats upon rain.

grillby.lua

@NyctoDarkMatter

I think the moisture stuck at 1 is modmain related, so I will have to check that out.

I attach the grillby prefab file. Your Normal(inst) function didn't disable the debuffs at all, that explains nothing stopping.

I removed the rain portions to make it strictly wetness related.

grillby.lua

@DarkXero I left the normal rain functions in there because I still want him to lose Sanity in rain, just nothing else. Would I just readd my chunks for that or how could I redo that?

Attaching modmain now for you to look at.

 

modmain.lua

@DarkXero I had it happen when I used console commands to force precipitation. The rain quickly went away on it's own ironically. I had a Rain Coat equipped during and after the rain stopped and I was still taking damage, and opening my inventory while using a controller revealed a hidden value of 1 Wetness even though the Wetness meter had disappeared. Weirder still, I THINK the sanity stopped draining but I'm not entirely sure since I was watching the Health more than Sanity. I'll test it again in a sec.

@DarkXero It still says 1, but everything works fine. Not sure what would cause that but it's fine now. ^^ I do need to repair some stuff cuz jesus, 3x Hunger Rate eats your soul. And the health drain is a bit fast too. I guess it makes sense since you're a fire, but it might be a bit extreme to lose all of your hunger after mere seconds of rain. Is there a way to play a hissing sound every so often while the Wet thing is active? And is there a way to have a natural, maybe, 30% resistance that stacks with any item (so that items that offer 70% resistance or more give the full 100%)?

10 minutes ago, NyctoDarkMatter said:

Is there a way to play a hissing sound every so often while the Wet thing is active?

local function Hiss(inst)
	inst.hiss_task = nil
	if inst.wetdebuff then
		inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")
		inst.hiss_task = inst:DoTaskInTime(4 + math.random() * 5, Hiss)
	end
end

local function WetDebuff(inst)
	-- Starts debuffs: -.2 stats in .1 seconds
	inst.components.health:StartRegen(-0.2, 0.1)
	inst.components.hunger:SetRate(5)
	inst.wetinsanity = -TUNING.DAPPERNESS_LARGE
	-- Flags
	inst.wetdebuff = true
	inst.drynormal = nil
	-- Hissing start
	Hiss(inst)
end

This should add a periodic hissing to the wet debuff.

10 minutes ago, NyctoDarkMatter said:

And is there a way to have a natural, maybe, 30% resistance that stacks with any item (so that items that offer 70% resistance or more give the full 100%)?

inst.components.moisture.inherentWaterproofness = 0.3

 

2 minutes ago, NyctoDarkMatter said:

Attaching an image to the post. See the 1 below the Sanity bar? That's the hidden Wetness.

Run on console

 print(ThePlayer.components.moisture.moisture)

or AllPlayers[2] on dedicated server, for the info to appear on the console.

Just now, DarkXero said:

print(ThePlayer.components.moisture.moisture)

That shows a 0, so I'm not sure why it shows a 1 on the side. It may be a glitched leftover of the controller. Not exactly sure.

1 minute ago, DarkXero said:

inst.components.moisture.inherentWaterproofness = 0.3

Will add that in just a moment. That's very helpful.


Will also add the hissing, thanks a lot DarkXero. Forums are being weird and I'm not sure why. Won't let me quote the hiss code.

3 minutes ago, NyctoDarkMatter said:

That shows a 0, so I'm not sure why it shows a 1 on the side.

Probably it has to deal with some HUD shenanigans, like how 0.99000001 translates to 100 for the werebeaver meter.

2 minutes ago, NyctoDarkMatter said:

math.random()

math.random() generates pseudo-random numbers uniformly distributed. Supplying argument alters its behavior:

  • math.random() with no arguments generates a real number between 0 and 1.

  • math.random(upper) generates integer numbers between 1 and upper.

  • math.random(lower, upper) generates integer numbers between lower and upper.

math.random() ==> 0.0012512588885159

math.random() ==> 0.56358531449324

math.random(100) ==> 20

math.random(100) ==> 81

math.random(70, 80) ==> 76

math.random(70, 80) ==> 75

22 minutes ago, NyctoDarkMatter said:

is there a way to increase the volume of the sound?

No.

The PlaySound function has the parameters

SoundEmitter.PlaySound = function(emitter, event, name, volume, ...)

but the volume parameter goes from 0 to 1. Like if you put a 2 there

inst.SoundEmitter:PlaySound("dontstarve/common/fireOut", "hissOut", 2)

the volume multiplier goes to 1.

 

So you can't amplify a sound.

You can make a very loud hissing yourself with FMOD designer though. Maybe find a template with the torch hissing and up the volume a bit?

@DarkXero I see. I appreciate the detailed comment but I can live without the volume amplified. I guess it's the player's fault if they don't notice the rapid hissing and damage, especially if they didn't read the description of the mod to learn that the hissing was caused by you DYING. xD

Alright! @DarkXero, @Squids, @Mobbstar, @Muche, all the people who have commented and helped here, we're almost done. I'm summoning you all for his most important thing now, being the Juice Bar and custom Juices. I'll add the custom texture soon here if you guys want to see and I just need some help coding it as a custom Research Lab. If ANY of you have done this before and have advice for me, please help. He's getting close and I'm ready to publish him. I've edited the main post in order to show the rest of the content and the main issue at hand. Let's do this, guys! You'll all, of course, get credit on the Steam mod when I post it, even if it's just a mention (as you seem to not want to be added, DarkXero. ;3)

@NyctoDarkMatter I suppose you want the following:

  • A custom tech tree
  • A custom research lab for said tech tree
  • Custom recipes for said tech tree
  • A custom tab for said recipes

I advise you to use the EndoxinAPI for its branch adder (there's a similiar file around in mods that add custom tech branches, but it's probably easier this way). The research lab would be a normal prefab with the "prototyper" component (see the existing prototypers for useage). You can do the recipes on your own. The tab can be made like this:

GLOBAL.RECIPETABS['GRILLBYS'] = {str = "GRILLBYS", sort=4, icon = "grillbys.tex", icon_atlas = "images/grillbys.xml"}

The first two names need to be the same, ideally capitalised. The icon works similiarly to inventory icons. "sort" is the position of the tab (from top to bottom).

My mod "soulful alchemy" has a "soul" tech tree, should you need an example.

Edited by Mobbstar
link'd
8 hours ago, Mobbstar said:

I advise you to use the EndoxinAPI for its branch adder

That works for DS, not DST.

Unless you want only hosts to enjoy the benefits of the prototyper, then it's ok.

 

I did this for an example of a new tech with a new prototyper:

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...