Ludeon Forums

RimWorld => Mods => Help => Topic started by: Bolgfred on February 21, 2017, 09:27:44 AM

Title: Need help with an Idea: injury chance on low consciousness or darkness
Post by: Bolgfred on February 21, 2017, 09:27:44 AM
Hello peopeles,

I want to make pawns to stumble and hurt themselves when they have low consciousness or are in complete darkness. Any suggestions where I could script that in?
E.g. Is there any check or sth by every tile moving that i could use on this?

Thanks in advance
Title: Re: Need help with an Idea: injury chance on low consciousness or darkness
Post by: RawCode on February 22, 2017, 03:34:32 AM
have you done any work soo far, have you checked code of similar random events?
Title: Re: Need help with an Idea: injury chance on low consciousness or darkness
Post by: Bolgfred on February 22, 2017, 07:34:37 AM
Nope, I just started yesterday looking into folder structure. Actually I don't understand it completely. E.g. I found floor tiles, but I dunno where snow on tiles is defined :-)

I will lookup how diseases events work tonight and try to make my stumble check similar to it. Actually that's the only event that's comparable I think. Only other idea I had was making every floor tile an easy trap that will be triggered on low consciousness.
Title: Re: Need help with an Idea: injury chance on low consciousness or darkness
Post by: zeidrich on February 22, 2017, 03:17:33 PM
I'm just starting to dig in to modding myself the last couple of days.

I would look at ThinkNode, JobGiver and JobDriver classes.

I'd look at how vomiting is controlled. I think it's a Chance Per Hour. 

I would probably next try to create a chance per hour to fall down in the think tree of every pawn.  The fall down job would then first check to see if the pawn was in darkness and low consciousness. If so, then it would give a bruise and a very short duration sickness that multiplies movement by 0% for a few seconds,  which should make them fall down.  I might instead choose to use the stun mechanic instead of the sickness, because I would be worried about people with doctor priority trying to rescue them when they've fallen for a few seconds.  The movement to 0% I'd expect would look better because it would knock them down like they lost a leg, but it would trigger the "colonist needs rescue" alert, and then a "colonist is no longer unable to walk" alert later.

I'd certainly look at the source of other mods that add new jobs or behaviors.  Toils appear to be a bit more challenging to add than other things.