FurryEskimo Posted March 26, 2021 Share Posted March 26, 2021 (edited) So I can make the player wet, but I'm having trouble making the player's inventory wet, and getting the wetness arrow to point up. if inst.components.moisture:GetMoisturePercent() ~= nil then if inst.components.moisture:GetMoisturePercent() < 0.9 then inst.components.moisture:SetPercent(inst.components.moisture:GetMoisturePercent() + 0.30) else inst.components.moisture:SetPercent(1) end end I've tried making their drying rate negative, and a few other things, but I'm haven't figured it out yet. I think I need to control or effect 'MoistureRate' and 'EquippedMoistureRate'. Any suggestions? Edited March 26, 2021 by FurryEskimo Link to comment Share on other sites More sharing options...
penguin0616 Posted March 27, 2021 Share Posted March 27, 2021 Inventory item moisture is controlled by the "inventoryitemmoisture" component. The component slowly increases/decreases item wetness until it is equal to a certain value determined by the component's GetTargetMoisture function. 1 Link to comment Share on other sites More sharing options...
FurryEskimo Posted March 27, 2021 Author Share Posted March 27, 2021 @penguin0616 Cool! I noticed my items becoming wet/dry seemingly randomly, but I guess they’re mimicking the player’s wetness. I still haven’t figured out how the game normally makes the player gain wetness, but I’ll try poking around in the rain code I guess. There’s also a ‘wet’ true/false attribute, and I’m not totally sure I what this is used for, but I set it to true; didn’t notice any changes though so I’ll probably remove it. Link to comment Share on other sites More sharing options...
FurryEskimo Posted March 27, 2021 Author Share Posted March 27, 2021 (edited) Update: I think I found it, but it's not too helpful.. function Moisture:GetMoistureRate() if not TheWorld.state.israining then return 0 end local waterproofmult = ( self.inst.components.sheltered ~= nil and self.inst.components.sheltered.sheltered and self.inst.components.sheltered.waterproofness or 0 ) + ( self.inst.components.inventory ~= nil and self.inst.components.inventory:GetWaterproofness() or 0 ) + ( self.inherentWaterproofness or 0 ) + ( self.waterproofnessmodifiers:Get() or 0 ) if waterproofmult >= 1 then return 0 end local rate = easing.inSine(TheWorld.state.precipitationrate, self.minMoistureRate, self.maxMoistureRate, 1) return rate * (1 - waterproofmult) end This seems to be the rate at which the player becomes wet, but I haven't had any luck changing the 'rate' yet, since it's basically the player's waterproof values subtracted from the precipitation rate. I tried making 'inherentWaterproofness' negative but since the first check is against the weather it to does nothing.. Edited March 27, 2021 by FurryEskimo Link to comment Share on other sites More sharing options...
FurryEskimo Posted March 27, 2021 Author Share Posted March 27, 2021 Update 2: I basically figured out how to do it, but it won't display a wetness increasing arrow; on the bright side, it won't display a drying arrow. inst.components.moisture.maxDryingRate = 0.0 --Prevents drying. inst.components.moisture.maxPlayerTempDrying = 0.0 inst.components.moisture.maxDryingRate = 0.1 --Allows drying. inst.components.moisture.maxPlayerTempDrying = 5 if inst.components.moisture:GetMoisturePercent() ~= nil then if inst.components.moisture:GetMoisturePercent() < 0.9 then --14% of the remaining 'dryness' plus 5% (when entering the water.) inst.components.moisture:SetPercent(inst.components.moisture:GetMoisturePercent() + (0.14 * (1 - inst.components.moisture:GetMoisturePercent())) + 0.05) else inst.components.moisture:SetPercent(1) end end if inst.components.moisture:GetMoisturePercent() ~= nil then --Become more wet while swimming. if inst.components.moisture:GetMoisturePercent() < 0.95 then inst.components.moisture:SetPercent(inst.components.moisture:GetMoisturePercent() + 0.01) else inst.components.moisture:SetPercent(1) end end Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now