Arlymone Posted February 1, 2015 Share Posted February 1, 2015 Im currently making a mod of my Fan Character Wab Wacoon. He working quite well so far with an entire speech file for his lines and everything. I still have two things to finish, the most important one being the perks. I have almost no idea how to add those. here are his desired perks:"Playing" with/using beefalo wool and/or bunny puff increase his sanityCan restore health by eating Wet goop, but it will also lower his sanityHurting/Killing a catcoon will lower his sanityother thing im trying to 'fix' is his textures , the current textures and animation Wab is using in game are standard ones and not the RoG ones. They are both based on willow’s atlas from the respective game mode, but since they are different they of course need different bin files to work and I tried using willows’s RoG bin file with my Wab's Rog textures but it just crashes the game, tbh i kinda was expecting that to happen. I then tried using the “Extended Character Template” ‘s atlas and the bin that goes with it but it came out as a total mess of textures.Some help would be greatly appreciated. I'm even willing to give a lil drawing/doodle as a reward for the person that help me get the perks done and working.also I'm kind of a newbie around here so sorry if I'm doing anything wrong ^^; Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/ Share on other sites More sharing options...
Mobbstar Posted February 1, 2015 Share Posted February 1, 2015 With the perks, you should use the function "AddPrefabPostInit" in your modmain. e.g.local function StartPlay(inst) ...endlocal function FurToy(inst) if GetPlayer().prefab = "wab" then inst:AddComponent("useableitem") inst.components.useableitem.onusefn = StartPlay ... endendAddPrefabPostInit("beefalowool",FurToy)If you don't find anybody else to collaborate with, I'll try. But I am not really interested in wishing a doodle, not even one of your niveau. Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-608586 Share on other sites More sharing options...
Arlymone Posted February 1, 2015 Author Share Posted February 1, 2015 With the perks, you should use the function "AddPrefabPostInit" in your modmain. e.g.local function StartPlay(inst) ...endlocal function FurToy(inst) if GetPlayer().prefab = "wab" then inst:AddComponent("useableitem") inst.components.useableitem.onusefn = StartPlay ... endendAddPrefabPostInit("beefalowool",FurToy)If you don't find anybody else to collaborate with, I'll try. But I am not really interested in wishing a doodle, not even one of your niveau. Well at least that's a start thanks for e lil help there. I'll see how things go from there/if anyone else hand me some help. Ill try to figure some stuff on my own out of what you gave me. Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-608599 Share on other sites More sharing options...
Blueberrys Posted February 2, 2015 Share Posted February 2, 2015 (edited) Can restore health by eating Wet goop, but it will also lower his sanityHurting/Killing a catcoon will lower his sanitylocal function apply_perks(inst) -- Wet goop local cooking = require("cooking") cooking.recipes.wetgoop.health = TUNING.HEALING_MED cooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINY -- catcoon attacked local function cat_postinit(cat_inst) cat_inst:ListenForEvent("attacked", function(data) if data.attacker == "your_character_prefab" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end) end AddPrefabPostInit("catcoon", cat_postinit) -- catcook killed inst:ListenForEvent("killed", function(data) if data.victim == "catcoon" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end)endlocal function sim_postinit(inst) if inst.prefab == "your_character_prefab" then apply_perks(inst) endendAddSimPostInit(sim_postinit)Remember to change your_character_prefab accordingly. Edited February 2, 2015 by Blueberrys Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-608744 Share on other sites More sharing options...
Arlymone Posted February 2, 2015 Author Share Posted February 2, 2015 local function apply_perks(inst) -- Wet goop local cooking = require("cooking") cooking.recipes.wetgoop.health = TUNING.HEALING_MED cooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINY -- catcoon attacked local function cat_postinit(cat_inst) cat_inst:ListenForEvent("attacked", function(data) if data.attacker == "your_character_prefab" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end) end AddPrefabPostInit("catcoon", cat_postinit) -- catcook killed inst:ListenForEvent("killed", function(data) if data.victim == "catcoon" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end)endlocal function sim_postinit(inst) if inst.prefab == "your_character_prefab" then apply_perks(inst) endendAddSimPostInit(sim_postinit)Remember to change your_character_prefab accordingly. Whoa! Thanks a lot! Is there anything I can draw you to pay back for that help? Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-608931 Share on other sites More sharing options...
seronis Posted February 2, 2015 Share Posted February 2, 2015 Since those postinits on the catcoons are only running AFTER the simpostinit, doesnt that mean that catcoons currently on the map wont be affected but all ones that spawn later will be ? Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609055 Share on other sites More sharing options...
Blueberrys Posted February 3, 2015 Share Posted February 3, 2015 (edited) Whoa! Thanks a lot! Is there anything I can draw you to pay back for that help?Oh. Thank you for the offer, but no, a thank you is enough. x) Since those postinits on the catcoons are only running AFTER the simpostinit, doesnt that mean that catcoons currently on the map wont be affected but all ones that spawn later will be ?Hmm. From what I understand, I think the post inits add that function call for every prefab initialization. And since prefabs need to initialize upon world load, it should work as intended. I'm not certain about this though, so I'll have to look into it. I'll test it in a little bit and report back. Edit: The prefab post init does not execute at all if it's inside the simpostinit. I'm going to assume they all work similarly and won't execute correctly if called in each other.Thank you for pointing that out, Seronis. @Arlymone, the code I provided probably won't work, considering the above. I'll post a new one in the next edit. Edit 2: For reference, this is the code I used to test it.Note, I tested this on spiders that were spawned before loading the world, and with spiders spawned using the c_spawn console command. Both are consistent, meaning the prefabs need to run through initialization either way.print("SPIDER INIT STARTED") -- Always printslocal function spider_postinit(inst) print("Post init worked", inst)end-- Un-commented this line on the first attempt, printed successfully.-- AddPrefabPostInit("spider", spider_postinit)local function sim_postinit(inst) -- Un-commented this line on the second attempt, does not print anything. -- AddPrefabPostInit("spider", spider_postinit)endAddSimPostInit(sim_postinit)- @ArlymoneNew code. Let me know if it works._G = GLOBALrequire = _G.requireTUNING = _G.TUNINGGetPlayer = _G.GetPlayerlocal function apply_perks(inst) -- Wet goop local cooking = require("cooking") cooking.recipes.cookpot.wetgoop.health = TUNING.HEALING_MED cooking.recipes.cookpot.wetgoop.sanity = -TUNING.SANITY_TINY -- catcook killed inst:ListenForEvent("killed", function(data) if data.victim == "catcoon" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end)endlocal function sim_postinit(inst) if inst.prefab == "your_character_prefab" then apply_perks(inst) endendAddSimPostInit(sim_postinit)-- catcoon attackedlocal function cat_postinit(cat_inst) if (GetPlayer().prefab == "your_character_prefab") then cat_inst:ListenForEvent("attacked", function(data) if data.attacker.prefab == "your_character_prefab" then data.attacker.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end) endendAddPrefabPostInit("catcoon", cat_postinit)Edit: Fixed cooking.recipes.cookpot.wetgoop Edited February 3, 2015 by Blueberrys Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609105 Share on other sites More sharing options...
Arlymone Posted February 3, 2015 Author Share Posted February 3, 2015 @ArlymoneNew code. Let me know if it works._G = GLOBALrequire = _G.requireTUNING = _G.TUNINGGetPlayer = _G.GetPlayerlocal function apply_perks(inst) -- Wet goop local cooking = require("cooking") cooking.recipes.wetgoop.health = TUNING.HEALING_MED cooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINY -- catcook killed inst:ListenForEvent("killed", function(data) if data.victim == "catcoon" then inst.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end)endlocal function sim_postinit(inst) if inst.prefab == "your_character_prefab" then apply_perks(inst) endendAddSimPostInit(sim_postinit)-- catcoon attackedlocal function cat_postinit(cat_inst) if (GetPlayer().prefab == "your_character_prefab") then cat_inst:ListenForEvent("attacked", function(data) if data.attacker.prefab == "your_character_prefab" then data.attacker.components.sanity:DoDelta(-TUNING.SANITY_TINY) end end) endendAddPrefabPostInit("catcoon", cat_postinit)I put the code in and tested it but it gave me this error screen (while it was showing it was however playing the sound and showing the quotes for maxwell introduction?) Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609136 Share on other sites More sharing options...
Blueberrys Posted February 3, 2015 Share Posted February 3, 2015 (edited) @Arlymone, Whooops, sorry. Please changecooking.recipes.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINYtocooking.recipes.cookpot.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.cookpot.wetgoop.sanity = -TUNING.SANITY_TINYI'll update that in the previous post too. Edited February 3, 2015 by Blueberrys Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609139 Share on other sites More sharing options...
Arlymone Posted February 3, 2015 Author Share Posted February 3, 2015 (edited) @Arlymone, Whooops, sorry. Please changecooking.recipes.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINYtocooking.recipes.cookpot.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.cookpot.wetgoop.sanity = -TUNING.SANITY_TINYI'll update that in the previous post too.thanks. while that part wasnt working i decided to try the mod whith only that catcoon part of your code, i seemed to work normally until i attacked a catcoon, which caused the game to crash @o@ EDIT: I tried the new code with and without the hurting catcoon part and it freeze then crash the game when I enable the mod Edited February 3, 2015 by Arlymone Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609144 Share on other sites More sharing options...
Blueberrys Posted February 3, 2015 Share Posted February 3, 2015 @Arlymone, oh no, haha. Log please? Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609155 Share on other sites More sharing options...
Arlymone Posted February 3, 2015 Author Share Posted February 3, 2015 @Arlymone, oh no, haha. Log please? First, sorry for the long reply (i had a long day and was busy most of the timeSecondly i figured what was making the game crash, it wasn't your code but me accidentaly pasting a like of it oin the wrong place, i got rid of said mis-pasting and the game was opening just fine. I didn't had the time play much yet but I will update as soon as i do and see if anything's wrong or right. thanks again for your time and help Link to comment https://forums.kleientertainment.com/forums/topic/50183-adding-perks-to-a-character-mod-need-help/#findComment-609571 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