Ludeon Forums

RimWorld => Mods => Help => Topic started by: twoski on August 08, 2016, 08:09:33 PM

Title: Creating new mental breaks
Post by: twoski on August 08, 2016, 08:09:33 PM
Hey all, i'm trying to mod new mental breaks into the game. Not entirely sure where to start though. The source folder in my game directory seems to be lacking stuff, is it just snippets for reference?
Title: Re: Creating new mental breaks
Post by: CallMeDio on August 08, 2016, 08:30:00 PM
Yea, The source folder in the game folder isn't complete, you will need to get a decompiler like ILSpy and open the Assembly-CSharp.dll to see the rest. It is inside the rimworld(build number here) folder>manager. That will allow you to see everything you need, when you are ready to put your code on the tracks there are tutorials on the rimworld wiki on how to set up a project to make a dll mod
Title: Re: Creating new mental breaks
Post by: twoski on August 09, 2016, 10:37:09 PM
Okay i figured this out finally.

I had to override the thought tree xml that pawns use for mental breaks and such in order to add my new mental break to the tree, however. Is this the only way to do it or am i blind?

(http://imgur.com/BfR4rLj.png)
Title: Re: Creating new mental breaks
Post by: 1000101 on August 10, 2016, 02:31:56 AM
Quote from: twoski on August 09, 2016, 10:37:09 PMOkay i figured this out finally.

I had to override the thought tree xml that pawns use for mental breaks and such in order to add my new mental break to the tree, however. Is this the only way to do it or am i blind?

Would be better to show us the xml you are using rather than a meaningless screenshot.  You told us it works so a screenshot isn't needed.  What is needed is the xml so we can guide you.

btw, overriding the think tree is BAD.  There are insertion hooks so you can pre-empt the sub-trees at certain points.  Unless this is what you meant.
Title: Re: Creating new mental breaks
Post by: Fregrant on August 10, 2016, 06:11:34 AM
https://ludeon.com/forums/index.php?topic=22096.msg239100#msg239100
There is a similar mod
Title: Re: Creating new mental breaks
Post by: 1000101 on August 10, 2016, 07:05:19 AM
A similar mod is not your mod.
Title: Re: Creating new mental breaks
Post by: twoski on August 10, 2016, 07:56:59 AM
Quote from: Fregrant on August 10, 2016, 06:11:34 AM
https://ludeon.com/forums/index.php?topic=22096.msg239100#msg239100
There is a similar mod

This mod does not add new breakdowns though. 

I noticed that the human ThoughtTreeDefs had insertion hooks but there were none in the mental break trees.
Title: Re: Creating new mental breaks
Post by: twoski on August 10, 2016, 11:04:19 PM
I posted an early build of my mod here: https://ludeon.com/forums/index.php?topic=23275.0
Title: Re: Creating new mental breaks
Post by: CallMeDio on August 10, 2016, 11:18:42 PM
If you want to do a absolutely new breakdown like for example a tree chopping berserk you will have to go to the C# coding and dll modding side of the force.
Title: Re: Creating new mental breaks
Post by: twoski on August 11, 2016, 10:50:55 AM
Yep, i've been starting on the easier ones first. The damaging buildings mental break was actually pretty easy to do once i understood how mental breaks are written.
Title: Re: Creating new mental breaks
Post by: twoski on August 11, 2016, 09:09:12 PM
Ok i noticed an insertion hook comment:

  <ThinkTreeDef>
    <defName>InsertHookTest</defName>
    <insertTag>Humanlike_PostMentalState</insertTag>
    <insertPriority>100</insertPriority>
    <thinkRoot Class="JobGiver_Berserk" />
  </ThinkTreeDef>


However there are no insert tags in the mental breaks tree. I guess i can insert my mental breaks AFTER the mental break trees are reached, but will this work?