Jump to content

I need some help for custom character's traits


Recommended Posts

So I've decided to give modding a try for me and a few friends. I'll be using the Extended Sample Character Template and it looks like that covers a lot of it, but I'd still really love some pointers since this is my first time doing something like this. Even if you can point me to where I can find it in the existing code it would appreciated.

*EDIT* It's just down to the custom items now, and I have a vague idea of where to start thankfully

Character A
- WX's trait of no negative effect for eating spoiled food
- Lower max health

- Immune to overheating
- Immune to wetness effects

Character B
- Sanity regen / slightly weaker version of Maxwel's dapper effect
- Won't eat meat -- I have a vague idea of how to do this one, help would still be appreciated
- Immune to cold

- A very weak positive sanity aura on nearby players

Character C
- Wickerbottom's knowledge trait
- Lower Max Sanity
- Custom item that slowly regenerates sanity when equipped. Craftable/useable by this character only

Character D
- Certain mobs are/become passive towards character: Pigs, hounds, frogs, tallbirds, mctusks, rabbits don't flee -- possibly the rabbit bit, it may be fun
- Custom item that restores some sanity when crafted. Craftable by this character only
- Hunger decreases slower, sanity decreases faster

Edited by Mayli-Song
Link to comment
Share on other sites

Immune to overheating

inst.components.temperature.maxtemp = 25

Immune to wetness

inst.components.moisture.maxmoisture = 0

Immune to cold

inst.components.temperature.mintemp = 25

Vegetarian

inst.components.eater:SetDiet({ FOODTYPE.VEGGIE, FOODTYPE.INSECT, FOODTYPE.SEEDS, FOODTYPE.GENERIC, FOODTYPE.GOODIES })

Passive mods

ThePlayer:AddTag("houndfriend") -- hound
ThePlayer:AddTag("merm") -- merm
----------------------------------------------------
ThePlayer:AddTag("guard") 
ThePlayer:AddTag("werepig")    -- werepig and pig guard.
----------------------------------------------------
ThePlayer:AddTag("tallbird") -- tallbird
ThePlayer:AddTag("walrus") --walrus
ThePlayer:RemoveTag("scarytoprey")  -- rabbit
----------------------------------------------------
ThePlayer:AddTag("frog") 
AddPrefabPostInit("frog", function (inst) --frog
	if not GLOBAL.TheWorld.ismastersim then 
		return inst
	end	
	local _targetfn = inst.components.combat.targetfn
	inst.components.combat.targetfn = function (target)
		if target:HasTag("frog") then return end
		_targetfn(target)
	end
end)
----------------------------------------------------

 

Edited by zUsername
Link to comment
Share on other sites

Spoiler
11 hours ago, zUsername said:

Immune to overheating



inst.components.temperature.maxtemp = 25

Immune to wetness



inst.components.moisture.maxmoisture = 0

Immune to cold



inst.components.temperature.mintemp = 25

Vegetarian



inst.components.eater:SetDiet({ FOODTYPE.VEGGIE, FOODTYPE.INSECT, FOODTYPE.SEEDS, FOODTYPE.GENERIC, FOODTYPE.GOODIES })

Passive mods



ThePlayer:AddTag("houndfriend") -- hound
ThePlayer:AddTag("merm") -- merm
----------------------------------------------------
ThePlayer:AddTag("guard") 
ThePlayer:AddTag("werepig")    -- werepig and pig guard.
----------------------------------------------------
ThePlayer:AddTag("tallbird") -- tallbird
ThePlayer:AddTag("walrus") --walrus
ThePlayer:RemoveTag("scarytoprey")  -- rabbit
----------------------------------------------------
ThePlayer:AddTag("frog") 
AddPrefabPostInit("frog", function (inst) --frog
	if not GLOBAL.TheWorld.ismastersim then 
		return inst
	end	
	local _targetfn = inst.components.combat.targetfn
	inst.components.combat.targetfn = function (target)
		if target:HasTag("frog") then return end
		_targetfn(target)
	end
end)
----------------------------------------------------

 

 

Thank you so much, this is perfect and way more concise than anything I was working out.

 

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