View Single Post
  #3  
Old June 23rd, 2007, 08:15 AM
Fyron's Avatar

Fyron Fyron is offline
Shrapnel Fanatic
 
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
Fyron is an unknown quantity at this point
Default Re: Is this possible?

Assuming that you only ever want one component with the "Combat To Hit Offense" ability, the simplest solution is to add a new requirement to every ship hull.

Lets take the frigate as an example. Assume that the two components you want to make mutually exclusive are named CompA and CompB, and they both have the "Combat To Hit Offense" ability. You should replace the Description with whatever message is appropriate to display for your mod, when a player tries to add both CompA and CompB.

Name := Frigate
...
Number Of Requirements := 6
Requirements Evaluation Availability := 1
Requirements Evaluation Allows Placement := 2, 3, 4, 5, 6
Requirements Evaluation Allows Usage := TRUE
...
Requirement 6 Description := Ship cannot have both CompA and CompB.
Requirement 6 Formula := Get_Design_Ability_Total("Combat To Hit Offense", 1) <= 1

If a requirement is not satisfied, then a message is displayed in the reqs box and you cannot complete the design. This new requirement is preventing the player from adding more than one of any type of component with the "Combat To Hit Offense" ability. You can add 1 Combat Sensor (CompA), or one CompB, but not both. You can also not add two Combat Sensors.

If this satisfies your needs, the rest of this post need not be applied.

==0==

If, on the other hand, you have a more complex situation, you might need more complex logic. Lets assume you have two types of combat sensor componets, CompA and CompB, with whatever balance tradeoffs you need. Further, assume that you have added a small to hit bonus to Tachyon Sensors, as a little bonus to ships devoting the space, but you don't want it to prevent you from adding a normal Combat Sensor to the design. Obviously, the previous solution does not work, because you want to allow 2 components with the same ability, but only if one of them is a Tachyon Sensor.

For reference, the goal with requirements is to have a FALSE condition. If a requirement evaluates to "true", the design is invalid.

Since the tachyon sensor is not a mutually exclusive component, it does not need to be factored into our logic. Let us call the variable A true when the ship has a copy of CompA added to it, and B true if the ship has a copy of CompB added to it. If we add neither component, the design is valid. If we add both, it is invalid. If we add only one or the other, it is valid. We want to trigger the req message when we have both A AND B being true, but not when A OR B is true, or neither is true. Thus, we can conclude that the requirement needs to be A AND B.

Hopefully that made sense... 4am is not the best time for logic.

Name := Frigate
...
Number Of Requirements := 6
Requirements Evaluation Availability := 1
Requirements Evaluation Allows Placement := 2, 3, 4, 5, 6
Requirements Evaluation Allows Usage := TRUE
...
Requirement 6 Description := Ship cannot have both CompA and CompB.
Requirement 6 Formula := Design_Has_Component_Type("CompA") AND Design_Has_Component_Type("CompB")
__________________
It's not whether you win or lose that counts: it's how much pain you inflict along the way.
--- SpaceEmpires.net --- RSS --- SEnet ModWorks --- SEIV Modding 101 Tutorial
--- Join us in the #SpaceEmpires IRC channel on the Freenode IRC network.
--- Due to restrictively low sig limits, you must visit this link to view the rest of my signature.
Reply With Quote