Jump to content

Question about requirement tag


Recommended Posts

While working on a new mod I ran across an issue.

I wanted to have a "+X per Y Player Level" and achieved that like so:

<effect_group>
   <!-- Carry Capacity based on Player Level -->
   <requirement name="PlayerLevel" operation="GT" value="9"/>
      <passive_effect name="CarryCapacity" operation="base_add" value="1">
</effect_group>

 

 

I wanted to have multiple breakpoints, so I tried this:

<effect_group>
   <!-- Carry Capacity based on Player Level -->
   <!-- Player Level 10+ -->
   <requirement name="PlayerLevel" operation="GT" value="9"/>
      <passive_effect name="CarryCapacity" operation="base_add" value="1">
   <!-- Player Level 20+ -->
   <requirement name="PlayerLevel" operation="GT" value="19"/>
      <passive_effect name="CarryCapacity" operation="base_add" value="1">
   <!-- Player Level 30+ -->
   <requirement name="PlayerLevel" operation="GT" value="29"/>
      <passive_effect name="CarryCapacity" operation="base_add" value="1">
</effect_group>

 

I thought the code above would be similar to this:

if (PlayerLevel > 9) {
   CarryCapacity += 1;
}
if (PlayerLevel > 19) {
   CarryCapacity += 1;
}
if (PlayerLevel > 29) {
   CarryCapacity += 1;
}

 

 

But it seems take all requirements within the effect_group, THEN apply the passive_effect IF the requirements are met.

So as a solution I did this:

<effect_group>
   <!-- Player Level 10+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
   <!-- Player Level 20+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="19"/>
   </passive_effect>
   <!-- Player Level 30+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="29"/>
   </passive_effect>
</effect_group>

 

 

But what If i want CarryCapacity, RunSpeed, and Health? Do I structure the code like this?:

<effect_group>
   <!-- Player Level 10+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
  <passive_effect name="RunSpeed" operation="perc_add" value=".05">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
   <passive_effect name="HealthMax" operation="base_add" value="2">
      <requirement name="PlayerLevel" operation="GT" value="19"/>
   </passive_effect>
   <!-- Player Level 20+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
  <passive_effect name="RunSpeed" operation="perc_add" value=".05">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
   <passive_effect name="HealthMax" operation="base_add" value="2">
      <requirement name="PlayerLevel" operation="GT" value="19"/>
   </passive_effect>
   <!-- Player Level 30+ -->
   <passive_effect name="CarryCapacity" operation="base_add" value="1">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
  <passive_effect name="RunSpeed" operation="perc_add" value=".05">
      <requirement name="PlayerLevel" operation="GT" value="9"/>
   </passive_effect>
   <passive_effect name="HealthMax" operation="base_add" value="2">
      <requirement name="PlayerLevel" operation="GT" value="19"/>
   </passive_effect>
</effect_group>

 

The above does work, Im just wondering if that is the correct way to go about it.

Link to comment
Share on other sites

That's correct. There's a couple ways to do it, but your 2nd method is right. Another way, that I personally would do, is to make multiple effect groups with names of "Player Level 10+" and then use one blanket requirement check for the whole effect group.

 

<effect_group name="Player Level 10+">
    <requirement name="PlayerLevel" operation="GT" value="9"/>
		<passive_effect name="CarryCapacity" operation="base_add" value="1"/>
		<passive_effect name="RunSpeed" operation="perc_add" value=".05"/>
		<passive_effect name="HealthMax" operation="base_add" value="1"/>
</effect_group>
<effect_group name="Player Level 20+">
    <requirement name="PlayerLevel" operation="GT" value="19"/>
		<passive_effect name="CarryCapacity" operation="base_add" value="3"/>
		<passive_effect name="RunSpeed" operation="perc_add" value=".15"/>
		<passive_effect name="HealthMax" operation="base_add" value="3"/>
</effect_group>


This would help keep more easily organized instead of having to scroll through so many commented organizers to find what you want. That's just me though.

Buffs read top down. So the very first thing it reads would be the requirement. Since that is not within something else, it's a blanket requirement for the entire effect group. If you want it to only apply to a specific node, either passive or triggered, it has to be how you've done it in the 2nd method. The 2nd one will read your passive first, THEN find your requirement check for it. Hope that explains how buffs and requirements work a bit.

Link to comment
Share on other sites

11 hours ago, Telric said:

That's correct. There's a couple ways to do it, but your 2nd method is right. Another way, that I personally would do, is to make multiple effect groups with names of "Player Level 10+" and then use one blanket requirement check for the whole effect group.

 

This is the method I ended up going with!

 

Quote

Buffs read top down. 

Quote

it's a blanket requirement for the entire effect group.

 

That is why i was confused, I figured it (buffs) would read top down, but didnt understand why requirements would seem to apply regardless of positioning.

Requirements applying to the entire effect group clears things up.

 

 

Thanks!

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...