Jump to content

I fail to make a character carnivore. Help?


Recommended Posts

I used these commands (which worked pre-Together)

"inst.components.eater:SetCarnivore()

inst.components.eater.strongstomach = true"
Doesn't seem to do anything now though. Anyone know where to look for a solution to this?
 
Here is the rest of my primary lua file:
local MakePlayerCharacter = require "prefabs/player_common"local assets = {        Asset( "ANIM", "anim/player_basic.zip" ),        Asset( "ANIM", "anim/player_idles_shiver.zip" ),        Asset( "ANIM", "anim/player_actions.zip" ),        Asset( "ANIM", "anim/player_actions_axe.zip" ),        Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),        Asset( "ANIM", "anim/player_actions_shovel.zip" ),        Asset( "ANIM", "anim/player_actions_blowdart.zip" ),        Asset( "ANIM", "anim/player_actions_eat.zip" ),        Asset( "ANIM", "anim/player_actions_item.zip" ),        Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),        Asset( "ANIM", "anim/player_actions_bugnet.zip" ),        Asset( "ANIM", "anim/player_actions_fishing.zip" ),        Asset( "ANIM", "anim/player_actions_boomerang.zip" ),        Asset( "ANIM", "anim/player_bush_hat.zip" ),        Asset( "ANIM", "anim/player_attacks.zip" ),        Asset( "ANIM", "anim/player_idles.zip" ),        Asset( "ANIM", "anim/player_rebirth.zip" ),        Asset( "ANIM", "anim/player_jump.zip" ),        Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),        Asset( "ANIM", "anim/player_teleport.zip" ),        Asset( "ANIM", "anim/wilson_fx.zip" ),        Asset( "ANIM", "anim/player_one_man_band.zip" ),        Asset( "ANIM", "anim/shadow_hands.zip" ),        Asset( "SOUND", "sound/sfx.fsb" ),        Asset( "SOUND", "sound/wilson.fsb" ),        Asset( "ANIM", "anim/beard.zip" ),        Asset( "ANIM", "anim/seras.zip" ),    		Asset( "ANIM", "anim/seras_fed.zip" ),    		Asset( "ANIM", "anim/seras_starved.zip" ),    		Asset( "ANIM", "anim/seras_sunlight.zip" ),    		Asset( "ANIM", "anim/seras_nightmare.zip" ),}local prefabs = {}local commentMoonlight = 1--startregen parameters: first parameter = tick size. second parameter = tick frequency-- stat/apperance differences night/day hungry/starvedlocal function updatestats(inst)	local health_percent = inst.components.health:GetPercent()    if GetClock():IsDay() then		if inst.strength == "mighty" then						inst.components.health.maxhealth = 160			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 1			inst.components.hunger:SetRate(2*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_SMALL			inst.components.temperature.inherentinsulation = 30*6			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)			inst.AnimState:SetBuild("seras")			commentMoonlight = 1		elseif inst.strength == "normal" then			inst.components.health.maxhealth = 120			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 0.8			inst.components.hunger:SetRate(0.8*TUNING.WILSON_HUNGER_RATE)				inst.components.sanity.dapperness = 0			inst.components.temperature.inherentinsulation = 30*4			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.0)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.0)			inst.AnimState:SetBuild("seras_sunlight")			commentMoonlight = 1		elseif inst.strength == "wimpy" then			inst.components.health.maxhealth = 60			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 0.4			inst.components.hunger:SetRate(0.7*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_SMALL*-1			inst.components.temperature.inherentinsulation = 30*2			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.0)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.0)			inst.AnimState:SetBuild("seras_starved")			commentMoonlight = 1					end				inst.components.health:SetPercent(health_percent)		inst.Light:Enable(false)			elseif GetClock():IsDusk() then		if inst.strength == "mighty" then			inst.components.health.maxhealth = 250 			inst.components.health:StartRegen(1, 5) 			--regeneration speed 1hp/ 3sec			inst.components.combat.damagemultiplier = 1.5			inst.components.hunger:SetRate(1.5*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_SMALL			inst.components.temperature.inherentinsulation = 30*6			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.2)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2)			inst.AnimState:SetBuild("seras_fed")		elseif inst.strength == "normal" then			inst.components.health.maxhealth = 	200			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 1.2			inst.components.hunger:SetRate(0.8*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = 0			inst.components.temperature.inherentinsulation = 30*4			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.1)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.1)			inst.AnimState:SetBuild("seras")		elseif inst.strength == "wimpy" then			inst.components.health.maxhealth = 70			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 0.7			inst.components.hunger:SetRate(0.7*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*-1			inst.components.temperature.inherentinsulation = 30*2			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.0)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.0)			inst.AnimState:SetBuild("seras_starved")					end		inst.components.health:SetPercent(health_percent)		inst.Light:Enable(false)			elseif GetClock():IsNight() then		if GetClock():GetMoonPhase() == "full" then			inst.components.health.maxhealth = 500			inst.components.health:StartRegen(2, 0.5) 			--regeneration speed 2hp/ 1sec			inst.components.combat.damagemultiplier = 1.5			inst.components.hunger:SetRate(-5*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_HUGE*-5			inst.components.temperature.inherentinsulation = 30*20			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.8)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.8)			inst.AnimState:SetBuild("seras_nightmare")						if commentMoonlight == 1 then				inst.components.talker:Say("It's full moon. I don't feel right...")				commentMoonlight = 0			end					elseif inst.strength == "mighty" then			inst.components.health.maxhealth = 260			inst.components.health:StartRegen(1, 2) 			--regeneration speed 1hp/ 2sec			inst.components.combat.damagemultiplier = 2.0			inst.components.hunger:SetRate(1*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_SMALL			inst.components.temperature.inherentinsulation = 30*6			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.3)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.3)			inst.AnimState:SetBuild("seras_fed")		elseif inst.strength == "normal" then			inst.components.health.maxhealth = 250					inst.components.health:StartRegen(1, 3) 			--regeneration speed 1hp/ 3sec			inst.components.combat.damagemultiplier = 1.5			inst.components.hunger:SetRate(0.8*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = 0			inst.components.temperature.inherentinsulation = 30*4			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.2)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.2)			inst.AnimState:SetBuild("seras_fed")		elseif inst.strength == "wimpy" then			inst.components.health.maxhealth = 80			inst.components.health:StopRegen()			inst.components.combat.damagemultiplier = 1.1			inst.components.hunger:SetRate(0.7*TUNING.WILSON_HUNGER_RATE)			inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE*-1			inst.components.temperature.inherentinsulation = 30*2			inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.0)			inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.0)			inst.AnimState:SetBuild("seras_starved")					end		inst.components.health:SetPercent(health_percent)		inst.Light:Enable(true)    end	end-- hunger speechlocal function onhungerchange(inst, data)	if inst.strength == "mighty" then		if inst.components.hunger.current < 130 then						inst.strength = "normal"			inst.components.talker:Say("The hunger has returned...")		end	elseif inst.strength == "wimpy" then		if inst.components.hunger.current > 60 then			inst.strength = "normal"			inst.components.talker:Say("I need more!")		end	else		if inst.components.hunger.current > 145 then			inst.strength = "mighty"			inst.components.talker:Say("I feel alive!")		elseif inst.components.hunger.current < 55 then			inst.strength = "wimpy"			inst.components.talker:Say("Bloody hell... feels like I'm slowly fading away.")		end	end			updatestats(inst)endlocal starting_inventory ={	-- Put vampire attack 'item' here}local fn = function(inst)	-- choose which sounds this character will play	inst.soundsname = "willow"	-- a minimap icon must be specified	inst.MiniMapEntity:SetIcon( "wendy.png" )	-- default hunger level	inst.strength = "normal"	inst.components.hunger.current = 125		-- Emit light at night / Night vision	local light = inst.entity:AddLight()	inst.Light:Enable(false)	inst.Light:SetRadius(10)	inst.Light:SetFalloff(0.75)	inst.Light:SetIntensity(.6)	inst.Light:SetColour(235/255,12/255,12/255)		-- Stats varies day/night	inst:ListenForEvent( "dusktime", function() updatestats(inst) end , GetWorld())	inst:ListenForEvent( "daytime", function() updatestats(inst) end , GetWorld())	inst:ListenForEvent( "nighttime", function() updatestats(inst) end , GetWorld())	updatestats(inst)		-- Sanity Changes	inst.components.sanity.night_drain_mult = 0.5	inst.components.sanity.neg_aura_mult = 1.1	inst.components.sanity:SetMax(TUNING.WILLOW_SANITY)		--Update hunger status	inst:ListenForEvent("hungerdelta", onhungerchange)		--Carnivore, can only eat meat. Can Eat Monster Meat.	inst.components.eater:SetCarnivore()	inst.components.eater.strongstomach = true	    return inst	endreturn MakePlayerCharacter("seras", prefabs, assets, nil, nil, starting_inventory)

The code for the Wolfgang-like hunger (along with day/night power changes) isn't working at the moment either, but I figure it might be the same problem at the core.

 

Thanks!

Edited by RedMattis
Link to comment
Share on other sites

@RedMattis, You need to actually be passing the function fn() to MakePlayerCharacter. To keep the naming convention with DST, I'd call it master_postinit now as well.

 

These are the arguments to MakePlayerCharacter now:

MakePlayerCharacter(name, customprefabs, customassets, common_postinit, master_postinit, starting_inventory)

As you can see, you're providing nil to both common_postinit and master_postinit, so you should be getting a totally generic character. You shouldn't need a common_postinit, so just make sure you're providing the master.

Link to comment
Share on other sites

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
 Share

×
  • Create New...