Jump to content

Need alittle help with some perks


Recommended Posts

-can eat stale food without repercussions
-levels up with wet goop
-has a Huge stomach (600 when at max lvl)
-can craft books like wickerbottom
-is resistant to overheating
-is completely resistant to rain and cannot drown if it rains too much
-is week to cold weather (will lose health And sanity twice as fast when freezing)
-is slower than average (0.8x speed)
-all items in his inventory instantly become wet and slippery

Link to comment
Share on other sites

I just wrote a mod that handels the wetness and iswet from items and structures.
 

If you really want them to become wet instantly, I think you could give them the Tag "wet" if they enter the inventary of your char (and remove it as soon as they leave)

Another better way I think would it be, if all items get slowly wet in the inventar of your char, and dry slowly if they leave it:

AddComponentPostInit("inventoryitemmoisture", function(self)
    local _GetTargetMoisture = self.GetTargetMoisture 
    self.GetTargetMoisture = function(self) 
        if self.inst:HasTag("YourCharacterTag") then -- every item that has this tag, will get wetness 100 slowly
            return 100
        end     
        return _GetTargetMoisture(self) -- return old stuff
    end
end)

in addition give every item in inventory that Tag "YourCharacterTag" and remove it when it leaves the inventory.

Edited by Serpens
Link to comment
Share on other sites

22 minutes ago, Spoderthewhiteknight said:

Cant find any with any of those. Maybe the leveling, i could replace whatever they put and replace it with wet goop. But thats what i can think up

-can eat stale food without repercussions

WX76 perk


-levels up with wet goop
-has a Huge stomach (600 when at max lvl)

that needs extra impementation in the wet goop prefab or in one of its components. I suppose eating it to reap the benefits would be a grand idea. I suggest looking at how other foods are implemented.


-can craft books like wickerbottom

well.. wickerbottom


-is resistant to overheating
-is completely resistant to rain and cannot drown if it rains too much
-is week to cold weather (will lose health And sanity twice as fast when freezing)

probably look at player common - removing OnWet OnHeat functions or whatever their names would be for your character woudl do the trick as well for the freezing. All would only need intercepting exiting code


-is slower than average (0.8x speed)

no idea where that is written, but


-all items in his inventory instantly become wet and slippery

yep serpens is your man for that =D

Edited by Andmann
Link to comment
Share on other sites

you put my code in the modmain.lua. (where else could it be?)
But I don't know where to add the needed Tag, since I'm not familar with items entering and leaving inventory.
 

And about being resistent to rain:

AddComponentPostInit("moisture", function(self) 
    local _GetMoistureRate = self.GetMoistureRate -- max is 0.75
    self.GetMoistureRate = function(self)
        if self.inst:HasTag("YourCharacterTag") then -- self.inst is your character this time
            return(0) -- moisurerate always zero, so no wetness will be added
        else
            return _GetMoistureRate(self)
        end
    end
end)

 

Edited by Serpens
Link to comment
Share on other sites

well serpends code sets moisture to 0  so yeah your inventory never gets wet that way o.O

Do I take it correctly that you actually want the items to be absolutely drenched with all its negative effects as a tradeoff for the othre benefits? - good and fun choice =D

well in that case i think you want to

return(0.75) -- moisurerate always zero, so no wetness will be added

about heat and cold. check out how WX takes reduced damage from cold maybe you should be able to cause the reverse effect and do something similar for heat

btw I know that there are player:PushEvent("hungerdelta") events for health, hunger, sanity, beaverness.... I'm almost positive that there is also a temperature delta. You could trace that and write your own function connected to the player PostInit with inst:ListenForEvent("", yourfunction)

Edited by Andmann
Link to comment
Share on other sites

the inventory wetness function will set the "goal value" to 100. That means the item wetness should get 100 slowly (I don't know exactly how long it takes, could be some minutes)

The moistureRate or the wetness of the character does not matter , because the original GetTargetMoisture asks for the character wetness, but with my code we don't use this.
If you return(0.75) your character will get wet with the highest rate possible (so will get wet very fast, but you don't want your character to get wet)

So my code should be correct, but you could try speed up the process with
self.inst.components.inventoryitemmoisture.wetnessSpeed

AddComponentPostInit("inventoryitemmoisture", function(self)
    local _GetTargetMoisture = self.GetTargetMoisture 
    local OldwetnessSpeed = self.inst.components.inventoryitemmoisture.wetnessSpeed
    local OlddryingSpeed = self.inst.components.inventoryitemmoisture.dryingSpeed
    self.GetTargetMoisture = function(self) 
        if self.inst:HasTag("YourCharacterTag") then -- every item that has this tag, will get wetness 100 slowly
            self.inst.components.inventoryitemmoisture.wetnessSpeed = OldwetnessSpeed * 100 -- default value is 1. the higher this value the faster an item will reach the TargetMoisture, if this is more wet
            self.inst.components.inventoryitemmoisture.dryingSpeed = OlddryingSpeed * 100 -- default value is 0.5 , the higher this value the faster an item will reach the TargetMoisture, if this is less wet
            return 100
        end     
        return _GetTargetMoisture(self) -- return old stuff
    end
end)

Decide wheter you also want to change the dryingSpeed or not and how much.
But since the targetmoisture is 100 and as soon as the item leaves the inventory this function do not work anymore, it should not matter how you change the dryingSpeed.

But... I think if it leaves the invontory we should set the value back to default... let me think about that...

I think try out the code and see if it dries very fast after it leaves the inventory.

 

Edited by Serpens
Link to comment
Share on other sites

you could try if the wetness modification itself works, if you remove the Tag restriction. So you always change wetnessspeed and return 100, regardless of the tag.  Then every item on the map shoud,be instant wet. (this works here)

If that works, it is the Tag that is wrong. If it does not work, it is the function.

Edited by Serpens
Link to comment
Share on other sites

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
 Share

×
  • Create New...