Creating new mental breaks

Started by twoski, August 08, 2016, 08:09:33 PM

Previous topic - Next topic

twoski

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?

CallMeDio

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
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

twoski

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?


1000101

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.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Fregrant


1000101

(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

twoski

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.


CallMeDio

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.
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

twoski

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.

twoski

#10
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?