Jump to content

Recommended Posts

I tried to make that one.
But either I add

inst.components.inventory:IsWaterproof(true)

or

inst:AddComponent("waterproofer")inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE)

It's just not working... Items in my character's inventory still get wet.

What should I do? ;_;

Edited by Coffgirl

@Coffgirl

The "IsWaterproof()" function is just to check the waterproofness of the inventory. You can't pass in a variable and expect it to change anything.

 

I'm not sure what the second one is doing. What is "inst" referring to? An instance of the inventory? Of your character?

 

 

Try this. It overrides the function that checks each inventory slot for waterproofness. "inst" should be referring to your character, so this would go in your character's create fn.

Though I'm not sure if this kind of overriding works the same through prefab files, so you may encounter an error.

local function new_GetWaterproofness(slot)    return TUNING.WATERPROOFNESS_ABSOLUTEendinst.components.inventory.GetWaterproofness = new_GetWaterproofness

@Coffgirl, according to a wiki page.. "The wetness of an item depends on the wetness of the player when it's in their inventory". Wait for the wetness to go down to 0 and see if it stays that way even when it's raining?

 

Edit: Add this in too. It should instantly make your character dry again.

inst.components.moisture:SetMoistureLevel(0)
Edited by Blueberrys

@Coffgirl, ah okay. There should be a way to do it. But I'm not sure why you would want that. Isn't the whole point of being wet that the items you're carrying become wet too?

 

 

Put this in your modmain.lua. See if it works.

local function post_moisturelistener(self, inst)	-- Find owner of item, if possible	local owner	if self.inst.components.inventoryitem then		owner =  self.inst.components.inventoryitem.owner		if owner and owner.prefab == "your_character_prefab_name" then			-- Check if the owner is a valid player with inventory and moisture			if owner.components.inventory and owner.components.moisture then				-- Change function to return a 0				self.GetTargetMoisture = function() return 0 end			end -- owner has invt/moisture		end -- prefab name	end -- is invt itemendAddComponentPostInit("moisturelistener", post_moisturelistener)

Remember to change "your_character_prefab_name" accordingly.

 

 

Edit: Changed code above. Added a check for "owner" being nil before

owner.prefab == "your_character_prefab_name"
Edited by Blueberrys

@Blueberrys I'm sorry!

I'm trying to scripting a bit more but end up your code is not working anymore. D:
(What I was trying to do is stop her sanity drains from high wetness)

Now I don't know what's wrong and where... So I upload my mod here.
I'm sorry, please help me again. Orz

https://drive.google.com/file/d/0B58QJDwa4vq3Z1NQbTNUQm5Ia3M/view?usp=sharing

@Coffgirl, the code I provided earlier was only changing the items. Changing something for your character, such as sanity, would probably use quite a different kind of approach.

 

I'll have a look at it.

 

Edit: I tested the mod, and the inventory items are in fact not getting wet for me. Although, I think there is some sort of issue with the sanity.. What was the problem, exactly?

 

Edit 2: To simply remove the penalty for wetness, add this in your character's create fn:

inst.components.sanity.GetMoistureDelta = function() return 0 end
Edited by Blueberrys

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...