Jump to content

Recommended Posts

Hey everyone!

 

Thanks to a tutorial available from these forums, we've sucessfully got a couple of custom characters working in the beta, you can check 'em out here:

 

http://steamcommunit...s/?id=368228088

http://steamcommunit...s/?id=368230903

 

We aren't savvy with the games code. If someone would be able to get any of the following perks working, we can pay you with what you deem is fair!

 

• Speed increases a small amount when distant from other players (Since it would be annoying when trying to work together)

• 50% faster harvesting speed

• Hunger drains slower during winter

• Small sanity increase when eating meat/small decrease when eating plants.

• Isn't afraid of ghosts (Gives a server a better chance of recovering from a sanity drop snowball effect)

• Doesn't aggro tentacles (But can still be hit by them when they attack something else)

• Damage enemies on touch a small amount (or just general damage return when hurt)

• Sanity slowy gains when nearby players.

 

Thanks for your time!

@Jasonafexx, Dynamic speed increases are a bit tricky. They will work fine for the host player, but clients will experience action prediction bugs unless you find some convenient way to propagate the movement speed change to the client.

 

Hunger drain slower in winter... Put this after the "if not TheWorld.ismastersim then return inst end" part of your prefab:

local function UpdateHunger(inst)    local multiplier = TheWorld.state.iswinter and 0.5 or 1    inst.components.hunger:SetRate(multiplier*TUNING.WILSON_HUNGER_RATE)endinst:WatchWorldState("startwinter", UpdateHunger)inst:WatchWorldState("startsummer", UpdateHunger)UpdateHunger(inst)

You might need to change UpdateHunger to function() UpdateHunger(inst) end, but I think inst is the first argument passed to it (if so, then you can leave it as I wrote it).

 

Small sanity increase/decrease for meat/veggie... Same place in the prefab file:

local oldoneatfn = inst.components.eater.oneatfninst.components.eater.oneatfn = function(inst, food)    local delta = nil    if food.components.edible.foodtype == FOODTYPE.VEGGIE then        delta = -5    elseif food.components.edible.foodtype == FOODTYPE.MEAT then        delta = 5    end    if delta then inst.components.sanity:DoDelta(delta) end    if oldoneatfn then return oldoneatfn(inst, food) endend

It looks like "isn't afraid of ghosts" would be pretty messy to implement...

 

Tentacles only hit one thing at a time, so if he doesn't aggro tentacles, he will not be hit by tentacles.

 

Damage return... hmm... something like this (same place in prefab). Although didn't that cactus character have that perk in single-player? The implementation should be the same for DST, since it only needs to run server-side.

local oldonhitfn = inst.components.combat.onhitfninst.components.combat.onhitfn = function(inst, attacker, damage)    if oldonhitfn then oldonhitfn(inst, attacker, damage) end    if attacker.components.combat then attacker.components.combat:GetAttacked(inst, 0.2*damage) endend

Sanity gain from nearby players... same place in prefab file (I adapted this from Willow):

local function sanityfn(inst)	local x,y,z = inst.Transform:GetWorldPosition()		local delta = 0	local rad = 10	local rad_sq = rad*rad	for k,v in pairs(AllPlayers) do 		if v ~= inst then			local distsq = inst:GetDistanceSqToInst(v)			if distsq < max_rad_sq then				local sz = TUNING.SANITYAURA_TINY * rad				delta = delta + sz/math.max(1, distsq)			end		end	end	return deltaendinst.components.sanity.custom_rate_fn = sanityfn
Edited by rezecib

Thanks for the reply!

 

Unfortunatley we couldn't find "if not TheWorld.ismastersim then return inst end" in their prefab. I've attached it to the post so you can have a gander. We tried placing it in same section as the other 'local' scripts are (Such as setting the voice to Wickerbottom) but to no avail.

 

Those four really should be plenty to have satisfying characters (Once we get 'em working), no worries about the other ones!

vergence.lua

Unfortunatley we couldn't find "if not TheWorld.ismastersim then return inst end" in their prefab
 Oh, sorry, I totally derped there. That's what's used in most prefabs, but for characters that's actually located in player_common, with the common_postinit function being called before, and the master_postinit function being called after. So put 'em in the master_postinit :)

put 'em in the master_postinit :-)

 

That did the trick! We can easily adjust the values as well should we need to. Thanks for making our characters more fun to play!

 

Edit: Almost! The Sanity near other players thing crashes when a player using said perk joins a server. We're just gonna disable that particular perk for now.

Edited by Jasonafexx

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