Luduaver Posted April 9 Share Posted April 9 (edited) Is there any way to use 'else' for triggered_effects? For example: <triggered_effect trigger="onSelfSecondaryActionRayHit" action="SetItemMetaFloat" change="2" relative="true" key="charge"> <requirement name="IsAlive" target="other"/> <requirement name="CompareItemMetaFloat" operation="LTE" value="2" key="charge"/> </triggered_effect> In this XML when I trigger secondary action, it adds two charges if the current charge is equal to or less than 2. But if it is greater than 2, it does nothing! I was wondering if I could make it do another action in the same triggered_effect! Or, I'd like to know if it's possible to use 1 triggered_effect inside another, as in this example: <triggered_effect trigger="onSelfSecondaryActionRayHit"> <requirement name="RandomRoll" seed_type="Random" min_max="1,50" operation="LTE" value="100"/><!-- This RandomRoll --> <triggered_effect trigger="onSelfSecondaryActionRayHit" action="SetItemMetaFloat" change="2" relative="false" key="charge"> <requirement name="IsAlive" target="other"/> <requirement name="CompareItemMetaFloat" operation="Equals" value="2" key="charge"/> </triggered_effect> <triggered_effect trigger="onSelfSecondaryActionRayHit" action="AddPart" part="Sparks" prefab="ParticleEffects/p_electric_shock_small" parentTransform="Handle" localPos="0,0,0" localRot="0,0,0"> <requirement name="CompareItemMetaFloat" operation="Equals" value="4" key="charge"/></triggered_effect> </triggered_effect> And if this really works, for example, what I wanted in this one is that if RandomRoll gives true, then the other trigger_effects would be triggered. Edited April 9 by Luduaver (see edit history) Link to comment Share on other sites More sharing options...
Telric Posted April 10 Share Posted April 10 Wrapping triggers inside a requirement should work for this. <requirement LTE 2> <trigger> </trigger> </requirement> <requirement GT 2> <trigger> </trigger> </requirement> that would wrap anything within the requirement tag to require LTE 2. if not, it skips all of that code and goes to the next requirement check for GT 2. if so, triggers anything within that block of code. 1 Link to comment Share on other sites More sharing options...
Luduaver Posted April 11 Author Share Posted April 11 That's what I needed! You are a God! Can I also put multiple requirements? For example, a requirement inside another requirement and then the trigger inside the 2? <requirement name="RandomRoll" seed_type="Random" min_max="1,50" operation="LTE" value="100"> <requirement name="CompareItemMetaFloat" operation="Equals" value="4" key="charge"> <triggered_effect trigger="onSelfPrimaryActionRayHit" action="SetItemMetaFloat" change="2" relative="false" key="charge"> <requirement name="IsAlive" target="other"/> </triggered_effect> <triggered_effect trigger="onSelfSecondaryActionRayHit" action="SetItemMetaFloat" change="2" relative="false" key="charge"> <requirement name="IsAlive" target="other"/> </triggered_effect> </requirement> </requirement> Here I first wanted to check the RandomRoll, then check the charge value and only then execute the 2 triggers. Link to comment Share on other sites More sharing options...
Telric Posted April 11 Share Posted April 11 I've never tried a double like that. There is a requirements tag that can do OR. I would assume it would do AND as well. <requirements compare_type="or"> <requirement name="PlayerItemCount" item_name="resourceTalkToCommoner" operation="GTE" value="1"/> <requirement name="PlayerItemCount" item_name="resourceTalkToEnnen" operation="GTE" value="1"/> </requirements> That's something I've used a good deal, but never with an AND compare type. Might be worth a try doing your way first. Link to comment Share on other sites More sharing options...
Luduaver Posted April 11 Author Share Posted April 11 I checked, and yes, it can be used AND! Thank you, you helped me a lot! I have another question in another post! If you could answer me, I'd be happy to! Minimum Current Stat - Discussion and Requests - 7 Days to Die 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now