Jump to content

requesting help for character perks


Tiggyloo

Recommended Posts

I have a character mod that's pretty much all done save for her perks and balancing. I've finished everything I can do, which is pretty much everything but custom perks, because I have absolutely no idea how to do that. Tutorials wouldn't help either, I don't think there's anything specific enough for the perks I need. And I'd rather have someone who knows what they're doing implement her perks anyway, I'm afraid I'd mess something up.

 

My mod is located here

 

As you can see on her page, her perks are as follows;

 

*Glows in the dark

*Claws for fighting

*Doesn't lose sanity at night

 

Her glow would be twice the radius of Willow's lighter.

 

Claws would increase fist damage by 1.5%

 

As she doesn't lose sanity at night, sanity loss from monsters and spoiled food and the like would be increased by 1.3%. When she's damp it's increased by 1.3% and when she's soaked it's 1.5%

 

I would attach a ZIP file of her mod folder but I don't have winZIP, only winRAR, and I apparently can't attach .rar files.

 

I do however have a .rar file of her mod at the ready which I could send over skype or something

Link to comment
Share on other sites

For the glowing, look at the code that makes other prefabs glow, and do that. ('inst:AddLight()', etc.)

 

For fist damage, take a look at Wolfgang (I think).

 

For sanity, use 'inst.components.sanity.custom_rate_fn'. Set this function, and it's return value will be added to the default sanity change (Measured in sanity per second). The function takes the prefab instance as its argument (the same 'inst' as the rest of the character prefab). Take a look at Sanity:Recalc() in 'scripts/components/sanity.lua' to see how the normal rate is calculated. You should be able to figure out the rest from there.

 

Do you lose sanity from food in the first place? Anyway, put this in your character prefab's code to lose sanity when you eat things:

inst:ListenForEvent("oneatsomething", function(global, data)    if data.food.components.perishable then        if data.food.components.perishable:IsStale() then            inst.food.components.sanity:DoDelta(-amount_to_decrease_if_stale)        elseif data.food.components.perishable:IsSpoiled() then            inst.components.sanity:DoDelta(-amount_to_decrease_if_spoiled)        end    endend)
Link to comment
Share on other sites

for the sanity drain booster when it rains, I've looked through the game files and I know the function I need is going to be made up of if/then statements from the looks of it, but I'm not entirely sure how to actually write the code.

 

I believe it would be, to put it simply and the only way I really know how at the moment, something along the lines of

 

inst.components.sanity.custom_rate_fn

if it is raining, then sanity loss increases by <my boost + default game drain>

 

at least I think that's how it would go from what I've seen of other functions similar to what I'm looking for. But that's kind of all I got, I'm definitely not great with codes and while I have a general idea I have no knowledge as to how this actually needs to be written out for it to work properly

Link to comment
Share on other sites

Okay so in wx78's file he's got a function that does all that damage/sparks and stuff when he's wet. You can take his and edit it to just lower sanity instead. so put this in your character's main fn function or whatever its called

inst:DoPeriodicTask(1/10, function() dorainsparks(inst, 1/10) end)

 

 

And then you can take wx's function and take out all that complicated stuff in there and just replace it with the these few lines that lowers sanity. so like this. 

local function dorainsparks(inst, dt)    if (inst.components.moisture and inst.components.moisture:GetMoisture() > 0) then    	inst.components.sanity.dapperness = -(1/4)  --CAN CHANGE THIS TO WHATEVER YOU VALUE WANT    else        inst.components.sanity.dapperness = -(0)    endend

all I added was 3 lines (and took out all the other stuff that used to be in there)

This ones pretty basic and just lowers sanity if theres any wetness at all but this can get you going. if you wanted to add more sanity drain for more wetness, you could just add another layer of "elseif" that checks for a value higher than 0

Link to comment
Share on other sites

Okay so in wx78's file he's got a function that does all that damage/sparks and stuff when he's wet. You can take his and edit it to just lower sanity instead. so put this in your character's main fn function or whatever its called

inst:DoPeriodicTask(1/10, function() dorainsparks(inst, 1/10) end)

 

 

And then you can take wx's function and take out all that complicated stuff in there and just replace it with the these few lines that lowers sanity. so like this. 

local function dorainsparks(inst, dt)    if (inst.components.moisture and inst.components.moisture:GetMoisture() > 0) then    	inst.components.sanity.dapperness = -(1/4)  --CAN CHANGE THIS TO WHATEVER YOU VALUE WANT    else        inst.components.sanity.dapperness = -(0)    endend

all I added was 3 lines (and took out all the other stuff that used to be in there)

This ones pretty basic and just lowers sanity if theres any wetness at all but this can get you going. if you wanted to add more sanity drain for more wetness, you could just add another layer of "elseif" that checks for a value higher than 0

Cool! Thanks a bunch!  :grin:

Link to comment
Share on other sites

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.

×
×
  • Create New...