Jump to content

Usage of the "requirement" element


Recommended Posts

Just a post checking if my usage of the "requirement" element is correct:

 

Here is the example code:

<!-- Method #1 - Requirements are before the trigger_effect -->
<passive_group>
   <requirement name="EntityTagCompare" target="other" tags="zombie,animal"/>
   <requirement name="IsAlive" target="other"/>
   <requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="10"/>
      <triggered_effect trigger="onSelfKilledOther" action="ModifyStats" stat="Stamina" operation="add" value="10"/>
</passive_group>

<!-- Method #2 - Requirements are within the trigger_effect -->
<passive_group>
   <triggered_effect trigger="onSelfKilledOther" action="ModifyStats" stat="Stamina" operation="add" value="10">
      <requirement name="EntityTagCompare" target="other" tags="zombie,animal"/>
      <requirement name="IsAlive" target="other"/>
      <requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="10"/>
   </triggered_effect>
</passive_group>

 

I understand that in Method #2, the requirements must be met for that specific triggered_effect to occur.

 

Question #1) In Method #1, those requirements must be met for the triggered_effect to occur, but that means anything AFTER the triggered_effect will also need to have met the requirements?
So If I wanted to do something like:

"On hitting an enemy, Recover 10 Stamina and a 25% chance to recover 5 life"

<passive_group>
   <requirement name="EntityTagCompare" target="other" tags="zombie,animal"/>
   <requirement name="IsAlive" target="other"/>
      <!-- Needs to pass the EntityTagCompare, and IsAlive requirements -->
      <triggered_effect trigger="onSelfAttackedOther" action="ModifyStats" stat="Stamina" operation="add" value="10"/>
   <requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="25"/>
      <!-- The first 2 requirements still apply to this triggered_effect, correct?? -->
      <triggered_effect trigger="onSelfAttackedOther" action="ModifyStats" stat="Health" operation="add" value="5"/>
</passive_group>

 

 

 

Question #2) Kind of a side question, is this the way to do a value range? Say I wanted to do something like this:

"When you kill an enemy to recover 5 to 15 Stamina"

<triggered_effect trigger="onSelfKilledOther" action="ModifyStats" stat="Health" operation="add" value="randomint(5,15)"/>

 

Edited by Bladestorm Games (see edit history)
Link to comment
Share on other sites

In the first example, those requirements must be met by anything within the effect group in order for that to trigger. So 3 triggered effects, all 3 would need to meet all those requirements. If 1 of them meets the req and the other two don't, only that one trigger will fire. the other two will return null.

In your example, both of those triggers would need to hit an enemy with those tags, and the enemy alive. If that returns true, the 2nd will fire off immediately, but the first will then check the 2nd set of requirements (the randomroll)... If that turns true, then it fires. You do have some syntax errors in that example, with closing the trigger effects though.

As for your 2nd question, yeah you can do that, but you first must make the randomint into a cvar, then use that as the value. So i guess the easiest way would be onselfatackother > set cvar > randomint, then onselfkilledother > modifystats > value="@cvar"

Link to comment
Share on other sites

13 minutes ago, Telric said:

You do have some syntax errors in that example, with closing the trigger effects though.

Fixed the syntax error.

 

 

15 minutes ago, Telric said:

In your example, both of those triggers would need to hit an enemy with those tags, and the enemy alive. If that returns true, the 2nd will fire off immediately, but the first will then check the 2nd set of requirements (the randomroll)... If that turns true, then it fires.

Sorry, just double checking: you're saying that if "EntityTagCompare" and "IsAlive" returns true, the SECOND triggered_effect fires off? Wouldn't it be the first triggered_effect?
 

 

17 minutes ago, Telric said:

As for your 2nd question, yeah you can do that, but you first must make the randomint into a cvar, then use that as the value. So i guess the easiest way would be onselfatackother > set cvar > randomint, then onselfkilledother > modifystats > value="@cvar"

Thanks for this info! Here is the edit:

<effect_group>
   <triggered_effect trigger="onSelfKilledOther" action="ModifyCVar" cvar="roll_range" operation="set" value="randomint(5,15)"/>
   <triggered_effect trigger="onSelfKilledOther" action="ModifyStats" stat="Health" operation="add" value="@roll_range"/>
</effect_group>

 

Link to comment
Share on other sites

<passive_group>
   <requirement name="EntityTagCompare" target="other" tags="zombie,animal"/>
   <requirement name="IsAlive" target="other"/>
      <!-- Needs to pass the EntityTagCompare, and IsAlive requirements -->
      <triggered_effect trigger="onSelfAttackedOther" action="ModifyStats" stat="Stamina" operation="add" value="10"/>
   <requirement name="RandomRoll" seed_type="Random" min_max="0,100" operation="LTE" value="25"/>
      <!-- The first 2 requirements still apply to this triggered_effect, correct?? -->
      <triggered_effect trigger="onSelfAttackedOther" action="ModifyStats" stat="Health" operation="add" value="5"/>
</passive_group>

 

 

 

Now that you've fixed the syntax errors, I see why you're confused. I thought the randomroll requirement was supposed to be in the first triggered effect.

So now, if all 3 of those requirement checks return true, both will fire off. If any of those req's aren't met, none will fire. If you are wanting the random roll to only effect the second trigger, you need to put it inside of that trigger: like this.

<triggered_effect>

     <requirement />

</triggered_effect>

 

Link to comment
Share on other sites

8 minutes ago, Telric said:

Now that you've fixed the syntax errors, I see why you're confused. I thought the randomroll requirement was supposed to be in the first triggered effect.

So now, if all 3 of those requirement checks return true, both will fire off. If any of those req's aren't met, none will fire. If you are wanting the random roll to only effect the second trigger, you need to put it inside of that trigger: like this.

<triggered_effect>

     <requirement />

</triggered_effect>


Ok I understand now. Thank you very much!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...