Jump to content

Recommended Posts

tumblr_inline_niv4nkrqB01rvzlnc.png

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 sanity
  • Can restore health by eating Wet goop, but it will also lower his sanity
  • Hurting/Killing a catcoon will lower his sanity

other 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 ^^;

With the perks, you should use the function "AddPrefabPostInit" in your modmain.
 
e.g.
local function StartPlay(inst)
  ...
end

local function FurToy(inst)
  if GetPlayer().prefab = "
wab" then
    inst:AddComponent("useableitem")
    inst.components.useableitem.onusefn = StartPlay

    ...
  end
end

AddPrefabPostInit("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.

With the perks, you should use the function "AddPrefabPostInit" in your modmain.

 

e.g.

local function StartPlay(inst)

  ...

end

local function FurToy(inst)

  if GetPlayer().prefab = "wab" then

    inst:AddComponent("useableitem")

    inst.components.useableitem.onusefn = StartPlay

    ...

  end

end

AddPrefabPostInit("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 :D

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

Can restore health by eating Wet goop, but it will also lower his sanity

Hurting/Killing a catcoon will lower his sanity

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.

Edited by Blueberrys
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?

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)

-

 

@Arlymone

New 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 by Blueberrys

@Arlymone

New 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?)

7b6e94db1f1ac8eacd961651e1b208b6.png

 

@Arlymone, Whooops, sorry.

 

Please change

cooking.recipes.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINY

to

cooking.recipes.cookpot.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.cookpot.wetgoop.sanity = -TUNING.SANITY_TINY

I'll update that in the previous post too.

Edited by Blueberrys

@Arlymone, Whooops, sorry.

 

Please change

cooking.recipes.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.wetgoop.sanity = -TUNING.SANITY_TINY

to

cooking.recipes.cookpot.wetgoop.health = TUNING.HEALING_MEDcooking.recipes.cookpot.wetgoop.sanity = -TUNING.SANITY_TINY

I'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 by Arlymone

@Arlymone, oh no, haha. Log please?

 

First, sorry for the long reply (i had a long day and was busy most of the time

Secondly 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

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