Tiggyloo Posted November 19, 2015 Share Posted November 19, 2015 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 https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/ Share on other sites More sharing options...
Arkathorn Posted November 19, 2015 Share Posted November 19, 2015 (edited) 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) Edited November 19, 2015 by Arkathorn Link to comment https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687042 Share on other sites More sharing options...
Tiggyloo Posted November 19, 2015 Author Share Posted November 19, 2015 if the food is spoiled (i.e. in the red) you lose ten sanity I think I get what you're saying here, I'll try it and see how it goes. Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687095 Share on other sites More sharing options...
pickleplayer Posted November 19, 2015 Share Posted November 19, 2015 Dont forget that wx-78 glows for a while when he's struck by lightning! Looking into his code might help there Link to comment https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687100 Share on other sites More sharing options...
Tiggyloo Posted November 20, 2015 Author Share Posted November 20, 2015 (edited) 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_fnif 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 Edited November 20, 2015 by Tiggyloo Link to comment https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687288 Share on other sites More sharing options...
pickleplayer Posted November 20, 2015 Share Posted November 20, 2015 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 calledinst: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) endendall 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 https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687310 Share on other sites More sharing options...
Tiggyloo Posted November 20, 2015 Author Share Posted November 20, 2015 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 calledinst: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) endendall 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 0Cool! Thanks a bunch! Link to comment https://forums.kleientertainment.com/forums/topic/59205-requesting-help-for-character-perks/#findComment-687324 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