TheWolfssegen
Refugee
TL;DR: How to pass cvar/make cvar global?
Hello all, I'm trying to implement a stacking buff based on the amount of armor shredded, here's what I had written.
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedMult" operation="set" value="1"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedMult" operation="subtract" value="@shredPercentage"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedAmount" operation="set" value="@currentArmor"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedAmount" operation="multiply" value="@armorShreddedMult"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShredded" target="selfAOE" range="10" operation="add" value="@armorShreddedAmount"/>
shredPercentage and currentArmor are already part of the entity already, and work fine. My problem is when trying to pass back armorShreddedAmount. What I would like it to do is calculate the amount of shredded armor (which it does) then add that back to the player entity (this buff is on an enemy). However, it seems the way this works is that when performing this line
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShredded" target="selfAOE" range="10" operation="add" value="@armorShreddedAmount"/>
it looks for the value armorShreddedAmount on the player entity, which isn't initialized so it ignored/treated as 0 and nothing changes, rather than passing the amount that was calculated above. Is there a way to declare global scope to fix this, or some other trick by which I can pass the cvar? Thanks.
Hello all, I'm trying to implement a stacking buff based on the amount of armor shredded, here's what I had written.
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedMult" operation="set" value="1"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedMult" operation="subtract" value="@shredPercentage"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedAmount" operation="set" value="@currentArmor"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShreddedAmount" operation="multiply" value="@armorShreddedMult"/>
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShredded" target="selfAOE" range="10" operation="add" value="@armorShreddedAmount"/>
shredPercentage and currentArmor are already part of the entity already, and work fine. My problem is when trying to pass back armorShreddedAmount. What I would like it to do is calculate the amount of shredded armor (which it does) then add that back to the player entity (this buff is on an enemy). However, it seems the way this works is that when performing this line
<triggered_effect trigger="onSelfBuffStart" action="ModifyCVar" cvar="armorShredded" target="selfAOE" range="10" operation="add" value="@armorShreddedAmount"/>
it looks for the value armorShreddedAmount on the player entity, which isn't initialized so it ignored/treated as 0 and nothing changes, rather than passing the amount that was calculated above. Is there a way to declare global scope to fix this, or some other trick by which I can pass the cvar? Thanks.