The first problems is obvious and easy to solve:
Good influence should never be bad, but at the moment it creates negative values for small planets, because the upkeep costs applied before GI multiplies the value with 1.5 (home world independence movement is applied before as well).
Either Good Influence should be applied before the costs or it should be limited like to 0 like:
Code: Select all
effects = SetTargetInfluence value = max(Value*[[GOOD_MULTIPLIER]], Value)
The second did cost some more effort, but I learnt a lot about FO-scripting.
The Regional Administration is not working:
Code: Select all
(JumpsBetween
object = Source.ID
object = Statistic Min //...
value = LocalCandidate.ID
condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
< 5
)
More important, choosing one object arbitrarily does not work correctly when a planet is connected to the capital and one or more regional admins.
The following looks better:
Code: Select all
EffectsGroup // close supply connected to capital planet is more stable
scope = Source
activation = And [
Planet
Not Unowned
ResourceSupplyConnected empire = Source.Owner condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
] // this should ensure that there is a capital / admin centre object owned by this empire for the later Statistic calculation
Not Capital
(Statistic Min
value = JumpsBetween
object = Target.SystemID
object = LocalCandidate.SystemID
condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
< 5
)
]
accountinglabel = "CAPITAL_CONNECTION_LABEL"
effects = SetTargetHappiness value = Value + min(5, 5 - Statistic Min
value = JumpsBetween
object = Target.SystemID
object = LocalCandidate.SystemID
condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
)
EffectsGroup // far supply connected to capital planet is less
scope = Source
activation = And [
Planet
Not Unowned
ResourceSupplyConnected empire = Source.Owner condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
Not Capital
(Statistic Min
value = JumpsBetween
object = Target.SystemID
object = LocalCandidate.SystemID
condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
> 5
)
]
accountinglabel = "CAPITAL_POOR_CONNECTION_LABEL"
effects = SetTargetHappiness value = Value + max(-5, 5 - Statistic Min
value = JumpsBetween
object = Target.SystemID
object = LocalCandidate.SystemID
condition = And [
Or [Capital Building name = "BLD_REGIONAL_ADMIN"]
OwnedBy empire = Source.Owner
]
)
JumpsBetween returns -1 for no connection. This should never be the case, unless somebody puts a Regional Administration on the Experimentor Outpost
When JumpsBetweenByEmpireSupplyConnections is implemented, it better returns INT_MAX, or the scripting will be broken again.
Is there a good reason why these functions return -1?
Also I wonder whether we could assign that distance to a NamedInteger instead of calculating it up to three times.
And whether I should switch to trunk and start pushing suggested fixes via git.
Regards,
Anvil