Im attempting to alter the way engines work in relation to hulls. While there are different possibility's.
First i need a working example as a demo test to ensure any of them are even possible.
Here's the parts that i know ill need so far.
Edit:
this is now basically working however there is a bit more to it you need to also add the part 'SH_ENGINE_1' to the items.inf file. I changed many of the names to reflect how its currently being named which i didn't get at first so SE_ is being used to denote the parts (Ship Engine) then SHP as the others are to denote what the Tech Itself (if any) Unlocks.
However the balance premise of this idea as of now is...
You get a engine of the type of hull you unlock when you get the hull. That engine has a power rating that is reduced by the hulls tech or size i.e. its speed is given a negative value (sort of like a drag mass, or lower tech penalty).
The engine itself is given a power rating that is a found value by the following instructions...
- #1) You take the current speed of any hull as it is now, to be the starting value for the engine which corresponds to the same hull.
#2) You then assign a hull a negative value, giving the absolute of that, as a addition to the corresponding engine. You do this in turn for each hull that will unlock a engine.
#3) The result is the engine and hull have different speeds separately, however when combined they are exactly the same as before you started.
The idea is to add a increase of tactical flexibility. This idea allows you to swap engines between hulls to either improve old ones extending there life (maybe you just like the way the older ships look and don't want to toss them yet). Or decrease the cost of newer ones when in a fully defensive situation so they are less capable of offense at a reduced cost. This can also work for offense as backup support or with a mix of both. You can optionally simply not add a star drive and they are then in system ships with a free extra internal slot. So it also adds to the strategic aspect. One additional benefit is that hulls themselves can be balanced in another way besides just hp slots or firepower but by the speed drag penalty on the hull itself.
Code: Select all
//______________________________________________
// attempting to change the way engines behave
//______________________________________________
//______________________________________
// scripting shiphulls basic.focs
//
Hull
name = "SH_STANDARD"
description = "SH_STANDARD_DESC"
speed = -30 // was 60
fuel = 3
stealth = 5
structure = 15
slots = [
Slot type = External position = (0.50, 0.35)
Slot type = External position = (0.50, 0.60)
Slot type = External position = (0.80, 0.45)
Slot type = Internal position = (0.30, 0.40)
Slot type = Internal position = (0.20, 0.40) //added
]
buildCost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
buildTime = 2
location = Contains And [
Building name = "BLD_SHIPYARD_BASE"
OwnedBy empire = Source.Owner
]
effectsgroups = [
[[REGULAR_HULL_DETECTION]]
[[SCAVANGE_FUEL_UNOWNED]]
[[UNOWNED_GOOD_VISION]]
[[UNOWNED_MOVE]]
]
icon = "icons/ship_hulls/basic-large-hull_small.png"
graphic = "hulls_design/basic-large-hull.png"
#include "ship_hulls.macros"
#include "/scripting/common/upkeep.macros"
//______________________________________
// scripting ship_designs sd_large_mark_3
//
ShipDesign
name = "SD_LARGE_MARK_3"
description = "SD_LARGE_MARK3_DESC"
hull = "SH_STANDARD"
parts = [
"SR_WEAPON_2_1"
"SR_WEAPON_2_1"
"AR_STD_PLATE"
"FU_BASIC_TANK"
"SH_ENGINE_1" // added
]
model = "mark1"
//______________________________________
// default scripting ship_parts
//
// there will basically be 5 of these
Part
name = "SH_ENGINE_1"
description = "SH_ENGINE_1_DESC"
class = Speed
capacity = 90
mountableSlotTypes = Internal
buildcost = 10 * [[FLEET_UPKEEP_MULTIPLICATOR]]
buildtime = 3
location = OwnedBy empire = Source.Owner
effectsgroups = [[SPEED_STACKING]] // << added
icon = "icons/ship_parts/engine-1.png"
#include "/scripting/common/upkeep.macros"
//______________________________________
// en.txt
//
SH_ENGINE_1
Standard Engine
SH_ENGINE_1_DESC
'''A standard star drive engien with a 90 BHP ( [[SPEED_INTERFERENCE]] Bazillion Horse Power :) rating. This value is decrease by a ships hull, typically larger or lower tech hulls, reduce the star lane speed a engine can theoretically achieve.'''
//______________________________________
// scripting ship_parts stacking.macros
//
BEST_SPEED_EFFECT
'''
max(max(max(max(
min(1, PartsInShipDesign Name = "SH_ENGINE_1" design = Source.DesignID)
* PartCapacity name = "SH_ENGINE_1",
min(1, PartsInShipDesign Name = "SH_ENGINE_2" design = Source.DesignID)
* PartCapacity name = "SH_ENGINE_2"),
min(1, PartsInShipDesign Name = "SH_ENGINE_3" design = Source.DesignID)
* PartCapacity name = "SH_ENGINE_3"),
min(1, PartsInShipDesign Name = "SH_ENGINE_4" design = Source.DesignID)
* PartCapacity name = "SH_ENGINE_4"),
min(1, PartsInShipDesign Name = "SH_ENGINE_5" design = Source.DesignID)
* PartCapacity name = "SH_ENGINE_5"
)
'''
SUM_SPEED_CAPACITY
'''
((PartCapacity name = "SH_ENGINE_1")* (PartsInShipDesign Name = "SH_ENGINE_1" design = Source.DesignID)
+(PartCapacity name = "SH_ENGINE_2")* (PartsInShipDesign Name = "SH_ENGINE_2" design = Source.DesignID)
+(PartCapacity name = "SH_ENGINE_3")* (PartsInShipDesign Name = "SH_ENGINE_3" design = Source.DesignID)
+(PartCapacity name = "SH_ENGINE_4")* (PartsInShipDesign Name = "SH_ENGINE_4" design = Source.DesignID)
+(PartCapacity name = "SH_ENGINE_5")* (PartsInShipDesign Name = "SH_ENGINE_5" design = Source.DesignID))
'''
SPEED_STACKING
'''
EffectsGroup // Make sure to add new engine parts to the macros SUM_SPEED_CAPACITY and BEST_SPEED_EFFECT
scope = Source
activation = DesignHasPartClass Low=2 High=999 Class=Speed
// im still iffy on this. ?
stackinggroup = "SPEED_PART_STACK"
// from the responses this is essentially en.txt link listing that also outputs the effects value when you hover over it.
accountinglabel = "SPEED_INTERFERENCE"
// now this is correct the wiki is out of date on this.
effects = SetSpeed value = Value - [[SUM_SPEED_CAPACITY]] + [[BEST_SPEED_EFFECT]]
'''
#include "stacking.macros"
#include "/scripting/common/upkeep.macros"