.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   SEV Modders Knowledge Base (http://forum.shrapnelgames.com/forumdisplay.php?f=154)
-   -   Is this possible? (http://forum.shrapnelgames.com/showthread.php?t=35165)

Q June 23rd, 2007 05:43 AM

Is this possible?
 
If you have two different components A and B.
Is it possible to allow a vehicle only to have component A or B but not both?
I would like to make different classes of sensors, but if you combine these sensors on a ship it would mess up my intention.

Leternel June 23rd, 2007 08:04 AM

Re: Is this possible?
 
In SE4, giving them "one per family" tag and the same family did so but upgrading was bad.

In SE5, I think you can use something like "group id" and restriction on the whole group (probably in the hulls)

Fyron June 23rd, 2007 08:15 AM

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. http://forum.shrapnelgames.com/image...ies/stupid.gif

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")

Q June 23rd, 2007 09:19 AM

Re: Is this possible?
 
Wow, thank you very much Fyron. This was exactly what I needed. As far as I see it will be the easier solution as I want to modify the basic and tachyon sensors. So there will be effectivly only one sensor allowed: either a long range but low sight level basic sensor or a low range but high sight level tachyon sensor.
Anyway you reply covered every possibility.
Really not bad for 4am!

Q June 23rd, 2007 10:51 AM

Re: Is this possible?
 
Well I found even a more elegant solution:
Instead of going to each vehicle I changed the component itself according to your suggestion Fyron:

Name := Basic Sensors
Description := Basic sensor package which allows detection of ships and space bodies at range.
Picture Number := 28
Maximum Level := 21
Tonnage Space Taken Formula := 10
Tonnage Structure Formula := 10 + (([%Level%] - 1) * 10)
Cost Minerals Formula := 200 + (([%Level%] - 1) * 2)
Cost Organics Formula := 0
Cost Radioactives Formula := 50 + (([%Level%] - 1) * 1)
Supply Amount Used Formula := 0
Ordnance Amount Used Formula := 0
Can Be Placed On Vehicle Types := Ship, Base, Satellite, Drone
Can Be Placed In Ship Sections := Inner Hull, Outer Hull
Component Type List := Technological
General Group := Sensors
Custom Group := 0
Number Of Requirements := 2
Requirements Evaluation Availability := 1
Requirements Evaluation Allows Placement := 2
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have at least tech level 1 in Sensors.
Requirement 1 Formula := Get_Empire_Tech_Level("Sensors") >= (1 + ([%Level%] - 1))
Requirement 2 Description := Ship cannot have both basic and tachyon sensors.
Requirement 2 Formula := Get_Design_Ability_Total("Sight Level", 1) <= 1
Number Of Abilities := 2
Ability 1 Type := Sight Level
Ability 1 Description := Allows scanning at level [%Amount1%].
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := 1 + ([%Level%] / 5)
Ability 1 Amount 2 Formula := 0
Ability 2 Type := Sight Range
Ability 2 Description := Allows scanning out to a range of [%Amount1%] sectors.
Ability 2 Scope := Space Object
Ability 2 Range Formula := 0
Ability 2 Amount 1 Formula := 3 + (([%Level%] - 1) * 1)
Ability 2 Amount 2 Formula := 0
Weapon Type := None

and

Name := Tachyon Sensors
Description := Modulating tachyon sensor grid which can detect cloaked ships in a system.
Picture Number := 36
Maximum Level := 26
Tonnage Space Taken Formula := 40
Tonnage Structure Formula := 40 + (([%Level%] - 1) * 10)
Cost Minerals Formula := 1500 + (([%Level%] - 1) * 15)
Cost Organics Formula := 0
Cost Radioactives Formula := 500 + (([%Level%] - 1) * 5)
Supply Amount Used Formula := 0
Ordnance Amount Used Formula := 0
Can Be Placed On Vehicle Types := Ship, Base, Satellite, Drone
Can Be Placed In Ship Sections := Inner Hull, Outer Hull
Component Type List := Technological
General Group := Sensors
Custom Group := 0
Number Of Requirements := 2
Requirements Evaluation Availability := 1
Requirements Evaluation Allows Placement := 2
Requirements Evaluation Allows Usage := TRUE
Requirement 1 Description := Empire must have at least tech level 4 in Sensors.
Requirement 1 Formula := Get_Empire_Tech_Level("Sensors") >= (4 + ([%Level%] - 1))
Requirement 2 Description := Ship cannot have both basic and tachyon sensors.
Requirement 2 Formula := Get_Design_Ability_Total("Sight Level", 1) <= 1
Number Of Abilities := 2
Ability 1 Type := Sight Level
Ability 1 Description := Allows scanning at level [%Amount1%].
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := 2 + (([%Level%] - 1) * 1)
Ability 1 Amount 2 Formula := 0
Ability 2 Type := Sight Range
Ability 2 Description := Allows scanning out to a range of [%Amount1%] sectors.
Ability 2 Scope := Space Object
Ability 2 Range Formula := 0
Ability 2 Amount 1 Formula := 1
Ability 2 Amount 2 Formula := 0
Weapon Type := None

And it seems to work. As soon as you added one sensor to your design you cannot place a second sensor anymore in the design.

Fyron June 23rd, 2007 02:50 PM

Re: Is this possible?
 
Really? I thought that the design component and ability count functions didn't work when used in component requirement fields. Hmm... wonder if Aaron changed something recently and didn't tell us. Awesome. http://forum.shrapnelgames.com/images/smilies/laugh.gif

That method has a slight drawback, in that if a player doesn't know about the mutual exclusivity, and doesn't pay too close attention to the reqs list in the component descriptions, they won't know what is going on when they try to add the second component. This might not matter so much, but is worth consideration.


All times are GMT -4. The time now is 11:20 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.