Jump to content

Recommended Posts

Ok, so I am working on a second character, this one for me. I have a perk in mind plus a danger on low sanity, I read an older post on modifying willow's firebug to for insanity functions. 

 

My question is two part.

1) How would you go about writing a sanity script to check the worldstates to gain sanity at night and loose during the day? As well as a different multiplier for dusk/night so maybe 1.25/1.5 gain.

 

2)Is there any possible way to spawn in entity's on low sanity. So on low sanity have a chance at spawning in a group of hounds? 

 

Any help is greatly appreciated, and if spawning is not possible I have a in progress code for a larger radius fire, based on firehound death.

 

-arashi

@ArashiOtter, 1) Probably writing a custom sanity rate function like Willow's would be the way to go. You could have the character listen to the world states and set the current sanity gain/drain-- e.g. inst.sanityrate-- (there are some other threads about WatchWorldState), and then the custom_rate_fn would just return the current sanity gain/drain.

 

2) Hm... Modify the sanity component's OnUpdate like this:

local OldOnUpdate = inst.components.sanity.OnUpdateinst.components.sanity.OnUpdate = function(self, dt)    OldOnUpdate(self, dt)    if self.current < 30 and math.random() < 0.01 then        local pos = self.inst:GetPosition()        SpawnPrefab("hound").Physics:Teleport(pos.x + 5*math.random(), pos.y, pos.z + 5*math.random())    endend

You probably want a different system for determining when to spawn hounds, though, maybe a time-based one like Willow's firebug component uses.

Looked at willows sanity functions can not figure out how to make it check the world state and return sanity value's I have looked through several other character all with ways to change stats on worldstate changes. Any help? Hound script works find can not see the timer element in willow's firebug though.

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