Help with Trait transfer comp.

Started by klun222, January 09, 2020, 05:10:31 AM

Previous topic - Next topic

klun222

So im trying to make a "Psychic Industrius trait giving Lance"

Something doesnt work even when trying to make psychic lance give random traits. Could anyone give a look:

<ThingDef ParentName="ArtifactBase">
    <defName>PsychicIndustriusLance</defName>
    <label>psychic industrius lance</label>
    <description>A one-use psychic effector. It overwhelms the target's mind with terrifying perceptual distortions, driving him into a berserk state. There is a risk of brain damage. It works at long distances, and through walls.</description>
    <graphicData>
      <texPath>Things/Item/Artifact/SMTH</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <resourceReadoutPriority>Middle</resourceReadoutPriority>
    <stackLimit>1</stackLimit>
    <tradeNeverStack>true</tradeNeverStack>
    <useHitPoints>true</useHitPoints>
    <statBases>
      <MarketValue>650</MarketValue>
      <MaxHitPoints>80</MaxHitPoints>
    </statBases>
    <drawGUIOverlay>false</drawGUIOverlay>
    <comps>
      <li Class="CompProperties_Targetable">
        <compClass>CompTargetable_SinglePawn</compClass>
        <psychicSensitiveTargetsOnly>true</psychicSensitiveTargetsOnly>
      </li>
<li Class="CompProperties_Targetable">
   <compClass>TraitTransfer.CompUseEffect_AddTrait</compClass>
      </li>
   </comps>

  </ThingDef>

There is a problem, I dunno if I can have 2 times comp properties_targatable or it compclass should have TraitTransfer.CompTargetEffect instead (tho it doesnt work).

I have trait transfed.dll

Thanks

LWM

I expect you will have to create your own C# child of CompTargetEffect that does the applying traits?  Then add it into <comps> like the vanilla lances do:

<li>
  <compClass>YourMod.CompTargetEffect_ApplyTrait</compClass>
</li>


I don't know what's giving you TraitTransfer.CompUseEffect_AddTrait, but does it work if given in the compClass as above?

klun222

The trait transfer .dll does, but it isnt mine.