StatPart_Mood in B18?

Started by gateboy6, July 26, 2018, 04:14:34 PM

Previous topic - Next topic

gateboy6

So, I'm trying to reintroduce StatPart_Mood into B18, it was in A17 as an up to 20% global work speed bonus depending on your mood. I'm trying to do something similar. When I use it in B18, every stat below and including global work speed disappear and the game is basically unplayable. Anybody know why it's broken, or how to fix it, or maybe even a workaround? I'd really like to use this thing again. Thanks.

Mehni

You'd get better help if you'd post detailed errors and relevant code.

gateboy6

Sorry, good idea, thanks



  <StatDef>
    <defName>WorkSpeedGlobal</defName>
    <label>global work speed</label>
    <description>A multiplier on someone's speed at doing any work.</description>
    <category>PawnWork</category>
    <displayPriorityInCategory>100</displayPriorityInCategory>
    <defaultBaseValue>1</defaultBaseValue>
    <toStringStyle>PercentZero</toStringStyle>
    <parts>
      <li Class="StatPart_Mood">
        <curve>
          <points>
            <li>(0.60,1.00)</li>
            <li>(1.00,1.20)</li>
          </points>
        </curve>
      </li>
    </parts>
  </StatDef>

is the default code for Global Workspeed in A17



  <StatDef>
    <defName>WorkSpeedGlobal</defName>
    <label>global work speed</label>
    <description>A multiplier on someone's speed at doing any work.</description>
    <category>PawnWork</category>
    <displayPriorityInCategory>100</displayPriorityInCategory>
    <defaultBaseValue>1</defaultBaseValue>
    <toStringStyle>PercentZero</toStringStyle>
    <parts>
         <li Class="StatPart_Glow">
            <factorFromGlowCurve>
               <points>
                  <li>(0,0.80)</li>
                  <li>(0.30,1.00)</li>
               </points>
            </factorFromGlowCurve>
         </li>
        <li Class="StatPart_Mood">
          <curve>
            <points>
              <li>(0.60,1.00)</li>
              <li>(1.00,1.20)</li>
            </points>
          </curve>
        </li>
    </parts>
      <scenarioRandomizable>true</scenarioRandomizable>
   </StatDef>

is a basic copy-paste implementation of StatPart_Mood in B18


XML error: <curve><points><li>(0.60,1.00)</li><li>(1.00,1.20)</li></points></curve> doesn't correspond to any field in type StatPart_Mood.
Verse.Log:Error(String)
Verse.DirectXmlToObject:ObjectFromXml(XmlNode, Boolean)
Verse.DirectXmlToObject:ListFromXml(XmlNode)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.DirectXmlToObject:ObjectFromXml(XmlNode, Boolean)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.DirectXmlToObject:ObjectFromXml(XmlNode, Boolean)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
Verse.<AllDefsFromAsset>c__Iterator2:MoveNext()
Verse.ModContentPack:LoadDefs(IEnumerable`1)
Verse.LoadedModManager:LoadAllActiveMods()
Verse.PlayDataLoader:DoPlayLoad()
Verse.PlayDataLoader:LoadAllPlayData(Boolean)
Verse.Root:<Start>m__1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.LongEventHandler:<UpdateCurrentAsynchronousEvent>m__1()


is the error that appears
the attachment is an image of the missing stats

[attachment deleted due to age]

Mehni

The part where it says curve indeed doesn't respond to any field in StatPart_Mood. That field has since be renamed to factorFromMoodCurve.

Change that part and it'll work.

        <li Class="StatPart_Mood">
          <factorFromMoodCurve>
            <points>
              <li>(0.60,1.00)</li>
              <li>(1.00,1.20)</li>
            </points>
          </factorFromMoodCurve>
        </li>

gateboy6

Thanks. This works perfectly. I wonder why the field was changed.

Mehni

The current working theory amongst modders is "to cause pain and suffering" but it's likely the real reason is more mundane. ;)