.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

The Falklands War - Save $7.00
War Plan Pacific - Save $5.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V > SEV Modders Knowledge Base

Reply
 
Thread Tools Display Modes
  #1  
Old June 23rd, 2007, 05:43 AM
Q's Avatar

Q Q is offline
Colonel
 
Join Date: Jan 2001
Posts: 1,661
Thanks: 0
Thanked 0 Times in 0 Posts
Q is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old June 23rd, 2007, 08:04 AM
Leternel's Avatar

Leternel Leternel is offline
Private
 
Join Date: May 2007
Location: France
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Leternel is on a distinguished road
Default 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)
__________________
What ever can be the question, 42 is the answer!
Reply With Quote
  #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
  #4  
Old June 23rd, 2007, 09:19 AM
Q's Avatar

Q Q is offline
Colonel
 
Join Date: Jan 2001
Posts: 1,661
Thanks: 0
Thanked 0 Times in 0 Posts
Q is on a distinguished road
Default 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!
Reply With Quote
  #5  
Old June 23rd, 2007, 10:51 AM
Q's Avatar

Q Q is offline
Colonel
 
Join Date: Jan 2001
Posts: 1,661
Thanks: 0
Thanked 0 Times in 0 Posts
Q is on a distinguished road
Default 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.
Reply With Quote
  #6  
Old June 23rd, 2007, 02:50 PM
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?

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.

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

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:53 PM.


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