Add Things to Inventory - KonradHeinser/EBSGFramework GitHub Wiki
This ability comp allows you to add an item directly to the caster's and/or the target's inventory. Because this allows you to set the stuffing as well, you can make equipment and other items with this. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.CompProperties_AddItemToInventory">
</li>
</comps>
These are the nodes available:
-
targetThing : The ThingDef to add to the target's inventory. If the target is the caster, then both this and casterThing are added
-
targetCount : Default (1) : The amount of said thing to add
-
targetStuffing : What to make the thing out of. Note that this will cause errors if a non-stuffable thing is given this
-
casterThing : The ThingDef to add to the caster's inventory
-
casterCount : Default (1) : The amount of said thing to add
-
casterStuffing : What to make the thing out of. Note that this will cause errors if a non-stuffable thing is given this
-
tryEquip : Default (True) : Makes the caster and target try to have the item equipped when it's given to them. If the item isn't equippable, this is ignored as it isn't relevant. If the item is a ranged weapon, brawlers will never start with it equipped. The same is try for pawns that already have something in the slot, or just wouldn't be able to equip it normally
These examples just add items to the caster's inventory, namely 100 steel with the first one, and a steel long sword with the second one
<AbilityDef>
<defName>GetSteel</defName>
<label>get steel</label>
<description>Do as the name says</description>
<casterMustBeCapableOfViolence>false</casterMustBeCapableOfViolence>
<cooldownTicksRange>60</cooldownTicksRange>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<range>0.9</range>
<warmupTime>0.5</warmupTime>
<requireLineOfSight>False</requireLineOfSight>
<targetParams>
<canTargetSelf>True</canTargetSelf>
</targetParams>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_AddItemToInventory">
<casterThing>Steel</casterThing>
<casterCount>100</casterCount>
</li>
</comps>
</AbilityDef>
<AbilityDef>
<defName>GetSteelSword</defName>
<label>get steel sword</label>
<description>Do as the name says</description>
<targetRequired>False</targetRequired>
<cooldownTicksRange>60</cooldownTicksRange>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<range>0.9</range>
<warmupTime>0.5</warmupTime>
<requireLineOfSight>False</requireLineOfSight>
<targetParams>
<canTargetSelf>True</canTargetSelf>
</targetParams>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_AddItemToInventory">
<casterThing>MeleeWeapon_LongSword</casterThing>
<casterCount>1</casterCount>
<casterStuffing>Steel</casterStuffing>
</li>
</comps>
</AbilityDef>