OR condition, info, effects to non-unique entities

Tips and Tricks on Events, Economy, etc.
User avatar
RulerofRails
CEO
Posts: 2061
Joined: Sun Dec 08, 2013 1:26 am

OR condition, info, effects to non-unique entities Unread post

I don't have a fancy presentation with illustrations and all that. But thought I should put something down about how I understand it while it's fresh.

One of the basics is that an OR condition will put all preceding conditions (including any combined by AND) within brackets. This means that you can test if either A+B+C... or X is true. The take-away here is to put them at the top of your conditions list.



Generally the game only lets us apply an effect to a set of unique entities. For example the human company, on-screen player, and/or USA territory.

Something interesting happens if we combine tests for IDs with OR conditions. This will test ALL entities IDed for the whether all conditions located after AND are true. The tricky part is that the effect can also be applied to ALL entites for which the condition is true. So in a way the event will apply MULTIPLE times in a controlled manner.


Basic use case stabilize track costs (by territory) over different economic states:
IMPORTANT: All territories must use the same Territory Varaible. You can't use TV1 for the first, and TV3 for the next.

Conditions:
(Territory ID = 2 OR
Territory ID = 13 ) AND
Economy State > Territory Variable 2

Effects: APPLIED "to the territory for which the condition is TRUE"
Territory Variable 2 +1
Overall track cost -6%

Note: This will handle the situation if the economy improves, a twin of this event is used for when the economy worsens to reverse the effect. Also, at game start I set TV2 for both territories to 2, because starting economy state is Normal (2).



One of my main goals here is to *only apply the Effects to territories. I don't want to apply it to companies or players. This usage hinges on the function: Apply "to the territory for which the condition is TRUE." If there is a test for any Condition related to a Player or Company, this function will try to apply to players/companies. There are two problems with this: (1.) in hierachy it's Company>Player>Territory, the game will pick the highest one when applying affects, and (2.) that will then become a multiple application to a unique entity eliminating all advantage available with this method.

*If you need to apply the effect to a different class of entity, suggested is to set aside a Game Variable. In SCBC JSS has used GV2. Use events in sequence (same frequency), first will set GV2 = 1, second will test simply if GV2 = 1 apply the effects as you wish and also reset GV2 = 0. Can do anything with this setup and use GV2 dozens of times. For safety and bug-tracking, it's better to test GV2 = 0 with first event and use a unique value. But that's optional.



I used this method for other things also, for example when reseting variables before a monthly "Company Exists?" test. I used this method. This can be done with one event. SCBC has 10 tracked companies. The reset before each monthly check is done via one event. This illustrates effort to reduce total event count.

Ok hopefully this is useful for someone else. Lately I just feel like I have no time, so it's the best I can do. Feel free to point out errors so no one gets led astray.