[Help] Adding ThoughtDefs

Started by Crimsonknight3, May 23, 2014, 05:11:44 PM

Previous topic - Next topic

Crimsonknight3

Okay I am trying to add thoughts to my own items that I have added. In ThoughtDefs I have

<?xml version="1.0" encoding="UTF-8"?>

-<ThoughtDefs>


-<ThoughtDef>

<defName>ObservedCutePodBed</defName>

<label>Observed Horrifically Pink Bed</label>

<description>This is pink enough to make anyone feel ill!</description>

<baseHappinessEffect>-2</baseHappinessEffect>

<baseFearEffect>5</baseFearEffect>

<duration>10000</duration>

<stackedEffectMultiplier>0.5</stackedEffectMultiplier>

<stackLimit>5</stackLimit>

</ThoughtDef>


-<ThoughtDef>

<defName>ObservedCuteCouchA</defName>

<label>Observed a flamingo looking couch</label>

<description>I saw a bright pink couch. Can this place get any worse?</description>

<baseHappinessEffect>-3</baseHappinessEffect>

<baseFearEffect>10</baseFearEffect>

<duration>10000</duration>

<stackedEffectMultiplier>0.5</stackedEffectMultiplier>

<stackLimit>5</stackLimit>

</ThoughtDef>


-<ThoughtDef>

<defName>ObservedKitty</defName>

<label>Observed an evil cat!</label>

<description>I saw a cute cat.... This place is terrifying!</description>

<baseHappinessEffect>-12</baseHappinessEffect>

<baseFearEffect>15</baseFearEffect>

<duration>10000</duration>

<stackedEffectMultiplier>0.5</stackedEffectMultiplier>

<stackLimit>5</stackLimit>

</ThoughtDef>

</ThoughtDefs>


After "Observed" I have placed the defname of those 3 items. What am I missing?

Crimsonknight3

I'm guessing that they need <thingClass> but does that need me to create an assembly? Or if I do <thingClass>ModCute.CutePodBed</thingClass>  will that be it?

Crimsonknight3

Quote from: Crimsonknight3 on May 23, 2014, 05:22:37 PM
I'm guessing that they need <thingClass> but does that need me to create an assembly? Or if I do <thingClass>ModCute.CutePodBed</thingClass>  will that be it?

That didn't work.... So in thought defs do I need to use the items label instead? E.g The Hello Kitty statue thingdef is Kitty, but its label is Cute Statue... Do I use the label without a space? .....

Cala13er

#3
<?xml version="1.0" encoding="utf-8" ?>
<ThoughtDefs>
<ThoughtDef>
<defName>ObservedCutePodBed</defName>
<label>Observed horrifically pink bed</label>
<description>This is pink enough to make anyone feel ill!</description>
<baseHappinessEffect>-2</baseHappinessEffect>
<baseFearEffect>5</baseFearEffect>
<duration>10000</duration>
<stackLimit>3</stackLimit>
</ThoughtDef>
</ThoughtDefs>


Are you making something trigger it?

Cala13er

This one worked when I triggered it by changing the simple food thought def to this.

Crimsonknight3

Quote from: Cala13er on May 23, 2014, 05:31:20 PM
StackLimit is obviously how many of the same thoughts a pawn can have at the same time.

Are you making something trigger it?

I assumed that in ThoughDefs the "Observed" in Def name was the trigger. I've looked at the cores defs for the gibbet cages and cremation inc's coffins/body bags for hints as to what is triggering it, or what is linking the thought to the item but I am just stumped lol I have tried everything I can think of by looking at other peoples xml's.

I guess the thought def is correct, I need to look elsewhere to find what exactly is triggering the thought...

Crimsonknight3

My only guess is that the trigger is a custom assembly. I have looked through all of cremation inc's files and there is nothing I can see to trigger a thought in the thingdefs nor thoughtdefs so my only conclusion is that it's in the .dll.

Either that, or maybe a modder may tell me if there is a tag for putting Fear instead of <Beauty>

Cala13er

No, the ThoughtDef is just the effects of the thought.

The trigger is in the building classes theirself.

For example, in gibbet cages there is.
public Thought GiveObservedThought()
{
if (base.Position.FirstContainedStorableOrNull() == null)
{
return new Thought_Observation(ThoughtDef.Named("ObservedGibbetCageEmpty"), this);
}
return null;
}


And in Corpse there is this.

public Thought GiveObservedThought()
{
if (!this.sourcePawn.RaceDef.humanoid)
{
return null;
}
Thing thing = this.StoringBuilding();
if (thing == null)
{
return new Thought_Observation(ThoughtDef.Named("ObservedLayingCorpse"), this);
}
if (!(thing.def.defName == "GibbetCage"))
{
return null;
}
if (this.sourcePawn.Faction == Faction.OfColony)
{
return new Thought_Observation(ThoughtDef.Named("ObservedGibbetCageFullColonist"), this);
}
return new Thought_Observation(ThoughtDef.Named("ObservedGibbetCageFullStranger"), this);
}

Crimsonknight3

So I need to add in a custom assembly to define the trigger? I have microsoft visual studio is that a good program to use? It's kinda confusing me at the minute.... I am trying to browse the cremation inc .dll just to familiarise myself but I can't really see anything other than for example Body bag -> BodyBag() GiveObservedThought().


Either that or I am over- complicating things and where can I find the building classes to simply edit with Notepad++ (Which I Usually use) if they aren't .dll :)

Cala13er

You are really over-complicating things :P

I'll make the dll for you if you want?

Crimsonknight3

Quote from: Cala13er on May 23, 2014, 07:16:24 PM
You are really over-complicating things :P

I'll make the dll for you if you want?

I would appreciate that, but also if you could explain very simply how I can view the code in the .dll then I can see what you have done and work my way back from there so I know for next time I may need the knowledge :)

Cala13er

Download ILSPY, allows you to read assemblies code.

Cala13er

Here's the DLL

Download it, put it in your mods Assemblies folder, then in your CutePodBed's ThingDef change the <thingClass>Building_Bed</thingClass> to <thingClass>Building_CutePodBed</thingClass>

And it should work :)

[attachment deleted by admin: too old]

Crimsonknight3

Okay did that and now I have read the code for cremation inc and I can see how you trigger the thoughtdef :) Going to have to look at a few tutorials explaining how to create .dll files for future reference aswell :)

Also thanks a lot for your help :)

Cala13er

No problem, also, if you use that dll in your mod. I would appreciate credit. :)

If you need any further help with dll's for your mod or whatever, just message me, I'm pretty decent with C# and I'm only improving. So just message us if you want help. I use Visual Studio Ultimate which costs $11,000 :P.