Jump to content

Recommended Posts

Good day everyone.

I just would like to ask you guys for some help with modding my character (Im not real smart in coding, so bare with me please!)

First off, my character freezes slower in the winter, but overheats faster in the summer. Secondly, (if this one part is possible) he doesnt get wet as fast another characters, but he does take a 25% slower time to dry off. Also a passive health regen (5 every 25 seconds)--This section has been helped!

EDIT; I still need the arachnophobia for the character. Other then that, and possible a crafting station w/a book (in a similar fashion to Maxwells Codex in DST). If this isnt possible, then the next best help is to add it to the magic tab, for the character only.

But until then, i thank you for your help!

Edited by MedicOrNot
Link to comment
https://forums.kleientertainment.com/forums/topic/67679-need-some-help/
Share on other sites

For faster overheating in Summer only or not, slower freezing in Winter only or not & health regeneration here's code. I'm certain this code works, hope I helped in some way :D!

-- Cold resistance ONLY for Winter time.
inst:WatchWorldState("startwinter", function()
inst.components.temperature.inherentinsulation = 45
end)

-- Remove cold resistance when Winter end and it becomes Spring.
inst:WatchWorldState("startspring", function()
inst.components.temperature.inherentinsulation = 0
end)

-- Heat weakness ONLY for Summer time.
inst:WatchWorldState("startsummer", function()
inst.components.temperature.inherentsummerinsulation = -45
end)

-- Remove heat weakness when Summer end and it becomes Autumn.
inst:WatchWorldState("startautumn", function()
inst.components.temperature.inherentsummerinsulation = 0
end)

-- Temperature resistances/weakness for all seasons, if you use this then don't use the upper ones unless you want to make him even weaker in Summer and Winter time. 
inst.components.temperature.inherentinsulation = 45
inst.components.temperature.inherentsummerinsulation = -45

-- I regen health every 25 second
inst:DoPeriodicTask(25,
function() 
if inst.components.health then
inst.components.health:DoDelta(5)
end 
end)

 

Edited by SuperDavid
  • Like 1
20 minutes ago, SuperDavid said:

For faster overheating in Summer only or not, slower freezing in Winter only or not & health regeneration here's code. I'm certain this code works, hope I helped in some way :D!


-- Cold resistance ONLY for Winter time.
inst:WatchWorldState("startwinter", function()
inst.components.temperature.inherentinsulation = 45
end)

-- Remove cold resistance when Winter end and it becomes Spring.
inst:WatchWorldState("startspring", function()
inst.components.temperature.inherentinsulation = 0
end)

-- Heat weakness ONLY for Summer time.
inst:WatchWorldState("startsummer", function()
inst.components.temperature.inherentsummerinsulation = -45
end)

-- Remove heat weakness when Summer end and it becomes Autumn.
inst:WatchWorldState("startautumn", function()
inst.components.temperature.inherentsummerinsulation = 0
end)

-- Temperature resistances/weakness for all seasons, if you use this then don't use the upper ones unless you want to make him even weaker in Summer and Winter time. 
inst.components.temperature.inherentinsulation = 45
inst.components.temperature.inherentsummerinsulation = -45

-- I regen health every 25 second
inst:DoPeriodicTask(25,
function() 
if inst.components.health then
inst.components.health:DoDelta(5)
end 
end)

 

Wow thanks man! I appropriate this alot!

Now for my hopes on the wetness stuff.

I'll update this later once i figure out how i want some custom items to function (still planning their functionality out!)

I got code for your wet thing too :)!

inst.components.moisture.baseDryingRate = 0.75 -- Makes it he drys off 25% slower.
inst.components.moisture.maxMoistureRate = 0.75 -- Makes it he gets wet 25% slower.

I can't help with the spider phobia since it's too hard for my current coding level, sorry :(...

Edited by SuperDavid
1 hour ago, SuperDavid said:

I got code for your wet thing too :)!


inst.components.moisture.baseDryingRate = 0.75 -- Makes it he drys off 25% slower.
inst.components.moisture.maxMoistureRate = 0.75 -- Makes it he gets wet 25% slower.

I can't help with the spider phobia since it's too hard for my current coding level, sorry :(...

Hey don't sweat it man, I really appreciate your help!

It means alot :)

6 hours ago, MedicOrNot said:

I still need the arachnophobia for the character.

But what does this mean? Sanity drain near spiders?

6 hours ago, MedicOrNot said:

Other then that, and possible a crafting station w/a book (in a similar fashion to Maxwells Codex in DST). If this isnt possible, then the next best help is to add it to the magic tab, for the character only.

You should add them to the magic tab, and give the recipes a tag that only your character has.

Way easier for you, instead of implementing a new tech tree and all the networking needed.

2 minutes ago, DarkXero said:

But what does this mean? Sanity drain near spiders?

Yes. Its the fear of spiders (which is ironic, because i hate them too)

2 minutes ago, DarkXero said:

Other then that, and possible a crafting station w/a book (in a similar fashion to Maxwells Codex in DST). If this isnt possible, then the next best help is to add it to the magic tab, for the character only.

Then if this is the case, then we shall move on with this. (If its possible, which, i think it may be, make them available at the start for that character, and again, its lock to that character) and to note, theres a few crafting recipes involved too, lol.

3 hours ago, MedicOrNot said:

Yes. Its the fear of spiders (which is ironic, because i hate them too)

 

3 hours ago, MedicOrNot said:

Then if this is the case, then we shall move on with this. (If its possible, which, i think it may be, make them available at the start for that character, and again, its lock to that character) and to note, theres a few crafting recipes involved too, lol.

 

Luckily for you I figured out a very simple way to make a Maxwell book to unlock new recipes.

Basically, your character will have a custom tab, like Maxwell. First recipe crafts the book, the other requires a tag that is given to you by getting close to your book.

I include the mod example. I also put the arachnophobia function there.

TemplateJournal.zip

16 hours ago, DarkXero said:

 

 

Luckily for you I figured out a very simple way to make a Maxwell book to unlock new recipes.

Basically, your character will have a custom tab, like Maxwell. First recipe crafts the book, the other requires a tag that is given to you by getting close to your book.

I include the mod example. I also put the arachnophobia function there.

TemplateJournal.zip

Thanks man! I guess i'll look into it and all, and figure some of it out on my own too.
Im also going to vaguly guess that, i may be putting this in the "scripts" folder? Or does it just go inside the mod folder (where all the other folders existence)

2 hours ago, MedicOrNot said:

i may be putting this in the "scripts" folder? Or does it just go inside the mod folder (where all the other folders existence)

You put the modmain contents in your character's modmain contents.

You put the function inside the Wilson file in the template in your character's prefab file in scripts/prefabs.

Basically you merge the stuff keeping the same mod structure.

10 hours ago, DarkXero said:

You put the function inside the Wilson file in the template in your character's prefab file in scripts/prefabs.

Basically you merge the stuff keeping the same mod structure.

For the templatejournal.lua do i merge that into the prefabs or do i copy/pate it into another file?

7 hours ago, MedicOrNot said:

For the templatejournal.lua do i merge that into the prefabs or do i copy/pate it into another file?

You can copy paste it into the prefabs folder as it is.

You can edit it as you see fit.

 

A single prefab file can hold many prefab definitions, like hats.lua, so you can also copy and paste the templatejournal into an existing prefab file of yours.

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