<effect_group tiered="false">
<passive_effect name="ModSlots" operation="base_set" value="0"/>
<passive_effect name="AttributeLevel" tags="attStrength" operation="base_add" value="1"/>
<passive_effect name="BarteringBuying" operation="base_add" value=".1"/>
<passive_effect name="BarteringSelling" operation="base_add" value=".1"/>
</effect_group>
<passive_effect name="EntityDamage" operation="perc_add" value="-.15,.15"/> <!-- random EntityDmg -->
<item name="apparelShades"> <!-- item name directly referenced in the code -->
<property name="Tags" value="head,clothing,canHaveCosmetic"/>
<property name="DisplayType" value="clothingShades"/>
<property name="Stacknumber" value="1"/>
<property name="Material" value="Mmetal"/>
<property name="DegradationBreaksAfter" value="false"/>
<property name="Encumbrance" value="0"/>
<property name="Weight" value="5"/>
<property name="EconomicValue" value="500"/>
<property name="HoldType" value="45"/>
<property name="Meshfile" value="#Other/Items?Misc/sackPrefab.prefab"/>
<property name="DropMeshfile" value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
<property name="EquipSlot" value="Eyes"/>
<property name="Group" value="Clothing"/>
<property class="UMA">
<property name="Mesh" value="gear_shades"/>
<property name="Overlay0" value="gear_shades"/>
<property name="Layer" value="1"/>
<property name="UISlot" value="Eyewear"/>
</property>
<effect_group tiered="false">
<passive_effect name="ModSlots" operation="base_set" value="0"/>
<!--
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="1">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="LTE" value="88"/>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$VarTest" operation="setvalue" value="randomfloat(12,13)"/>
</passive_effect>
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="2">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="GT" value="88"/>
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="LTE" value="99"/>
</passive_effect>
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="3">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="GT" value="99"/>
</passive_effect>
-->
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="1"/>
</effect_group>
</item>
<!--
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="1">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="LTE" value="88"/>
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyCVar" cvar="$VarTest" operation="setvalue" value="randomfloat(12,13)"/>
</passive_effect>
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="2">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="GT" value="88"/>
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="LTE" value="99"/>
</passive_effect>
<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="3">
<requirement name="RandomRoll" seed_type="Item" min_max="1,100" operation="GT" value="99"/>
</passive_effect>
-->
"<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="0.1,1.9"/>"
Nice, will the passive show up under the item's stat list or would you need to make a minor modification to one of the UI xml files?The advantage of the passive is that it's easy to display on the item stats.
For complex mechanics like a weapon having a unique but random proc buff you should create an item mod for each such effect with type="mod".
Then edit loot so that your item always spawns with this mod preinstalled.
This way you can have multiple variants of your mod with completely different setups complete with item descriptions and stats pages.
What item did you test this on?The method used with the shades surely is a possibility, but is a little overkill. Just use the method posted by Mr.Devolver:
I made sure it works by testing it just now. This would give perception+1 in 50% of the weapons you find. BUT the buff only works if you have the weapon equipped i.e. in your hand.Code:"<passive_effect name="AttributeLevel" tags="attPerception" operation="base_add" value="0.1,1.9"/>"
<display_entry name="AttributeLevel" tags="attPerception" title_key="statShowPerception" display_leading_plus="true"/>
I tested it first on leather armor, then, because I remembered that OP asked about a weapon, on a pistol.What item did you test this on?
I found that I couldnt get the stats to work unless the "DisplayType" property defined in ui_Display.xml was pointing at a display type that showed that value.
I.E
Code:<display_entry name="AttributeLevel" tags="attPerception" title_key="statShowPerception" display_leading_plus="true"/>
I kept bombing them with requests for something similar for ages, but I don't expect them to implement this any time soon. What I had in mind was a system for random mods already pre-installed on the items you find in the loot or in trader's inventory. Maybe such system could also be extended to give certain random attributes too, like special baseball bat that has some heavy weight mod installed on it, plus gives you strength +1 bonus. And if you could find such items with random mods installed and random stats, that would be pretty cool.As far as I know something similar is already planned by TFP: legendary weapons. Among the random boni I would expect attribute buffs as well.