• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(175287)

Swordless Knight
3 Badges
Oct 25, 2009
253
1
  • Cities in Motion
  • Crusader Kings II
  • Deus Vult
...Yeah, its that time of the year again :eek:o

Ehem, this is not really a question per se, but a way to make sure this would actually work before starting to script what could be just an incredible way to waste time...


So... if I made an event that began like:

condition = { type = gold value 500 }
condition = { type = or condition = { type gold value 450 } }
condition = { type = or condition = { type gold value 400 } }
condition = { type = or condition = { type gold value 300 } }
condition = { type = or condition = { type gold value 250 } }


but each with a save_target, so that the event would apply to the richest, would the engine takes into consideration all the or block that are true,
and choose one at random, or take the first one that matches and jump the rest?
 
If you have multiple save_target conditions, it will take the last valid target which is set in all cases.

Your event is malformed in any case, you forgot the equals sign, and all ORred conditions must be in a single block. You intended something like this I guess:

Code:
condition = { type = or
  condition = { type = gold value [b]=[/b] 500 }
  condition = { type = gold value  [b]=[/b] 450 }
  condition = { type = gold value [b]=[/b]  400 }
  condition = { type = gold value  [b]=[/b] 300 }
  condition = { type = gold value  [b]=[/b] 250 }
[b]}[/b]
But this is useless, as a character with 500 gold will match ALL of these, so you might as well just check for gold = 250.

If you rewrite it as follows:
Code:
condition = { type = or
  condition = { type = gold value = 500 }
  condition = { type = and
    condition = { type = gold value = 400 }
    condition = { type = not value = { type gold value = 500 } }
  } (etc.)
then it will be able to check for either 500, or 400-500 (etc.), but this still doesn't make sense as you can only save one target per event.


An example of checking for multiple possible targets follows:
Code:
condition = { type = and
  condition = { type = or
    condition = { type = and
      condition = { type = age value = 16 }
      condition = { type = not value = { type = age value = 20 }}
      condition = { type = gold value = 100 }
    }
    condition = { type = and
      condition = { type = age value = 20 }
      condition = { type = not value = { type = age value = 24 }}
      condition = { type = gold value = 200 }
    }
    condition = { type = and
      condition = { type = age value = 24 }
      condition = { type = gold value = 300 }
    }
  }
  condition = { type = save_target }
}
condition = { type = has_target }
This would check for a 16-20 year old with at least 100 gold, OR a 20-24 year old with at least 200 gold, or a 24+ old with at least 300 gold, and save a target.
But even here you only need to save a target once, not for every single OR.
 
Last edited: