Coffgirl Posted January 12, 2015 Share Posted January 12, 2015 I tried to make that one.But either I addinst.components.inventory:IsWaterproof(true)orinst: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? ;_; Link to comment Share on other sites More sharing options...
Blueberrys Posted January 12, 2015 Share Posted January 12, 2015 @CoffgirlThe "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 Link to comment Share on other sites More sharing options...
Coffgirl Posted January 12, 2015 Author Share Posted January 12, 2015 @BlueberrysOh... It just makes the wetness stat goes down instead. D:But items in inventory still get wet.. ;_; Link to comment Share on other sites More sharing options...
Blueberrys Posted January 12, 2015 Share Posted January 12, 2015 @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) Link to comment Share on other sites More sharing options...
Coffgirl Posted January 12, 2015 Author Share Posted January 12, 2015 @BlueberrysThe goal is making my inventory keep drying event the wetness is high. ;_;Is it possible to do this? Link to comment Share on other sites More sharing options...
Blueberrys Posted January 12, 2015 Share Posted January 12, 2015 @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 beforeowner.prefab == "your_character_prefab_name" Link to comment Share on other sites More sharing options...
Coffgirl Posted January 12, 2015 Author Share Posted January 12, 2015 @BlueberrysThank you very much! It's working now. Oh.. The reason is my character is a plant so some people using my mod recommend if she doesn't have a debuff from wetness. Link to comment Share on other sites More sharing options...
Blueberrys Posted January 12, 2015 Share Posted January 12, 2015 @Coffgirl, no prob! Ah okay, that sounds cool. It would also be interesting if it had some sort of buffs from wetness instead. Link to comment Share on other sites More sharing options...
Coffgirl Posted January 12, 2015 Author Share Posted January 12, 2015 @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. Orzhttps://drive.google.com/file/d/0B58QJDwa4vq3Z1NQbTNUQm5Ia3M/view?usp=sharing Link to comment Share on other sites More sharing options...
Blueberrys Posted January 12, 2015 Share Posted January 12, 2015 @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 Link to comment Share on other sites More sharing options...
Coffgirl Posted January 13, 2015 Author Share Posted January 13, 2015 That's weird... maybe something is wrong with my world.I renew the world and it's working fine now.Thank you very much Blueberrys Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.