Logo Platform
logo amplifiers simplified

Conditional modifiers in SimulationDescriptors?

Reply
Copied to clipboard!
7 years ago
Jun 15, 2018, 11:32:28 PM

Is there any way to add conditional modifiers to SimulationDescriptors without resorting to adding new properties to the empire or system classes?


I ask because I've made a few effects that are based on the presence or number of other things/improvements in a system/empire.


So far, I have those things add to a new property and then just use the property as a multiplier in a BinaryModifier in SimulationDescriptor. This works, but it requires modyfing ClassEmpire and/or ClassColonizedStarSystem. 


I'd really like to avoid this to not limit compatibility with other mods for what are a small number of effects.


Looking for the mere presence of another improvement or anomaly is enough, but using the actual number of items is even better.


0Send private message
7 years ago
Jun 18, 2018, 7:41:01 AM

Hey Tychonoir!


We're considering adding something to help modify SimulationDescriptors without causing conflicts but this might not come before some time.


In the meantime, maybe you can have a "complex" path in your Modifiers? For example "ClassColonizedStarSystem/PlanetAnomaly28/../ClassColonizedStarSystem".

I'm pretty sure it is dangerous and doing this as a GD would cause all the gameplay programmers to cry, but aside from the potential bugs it could add it would certainly work.

0Send private message
7 years ago
Jun 19, 2018, 10:39:58 AM

So this actually works in reverse. (This might have been what you intended, but not how I initially thought it would.)


Instead of the improvement giving FIDSI if the prerequisite is present, it's the prerequisite that sends the FIDSI to the system(s) with the improvement.

(The downside, is that multiple prerequisites will all send the FIDSI, but in my use case this won't be a problem.)


It's hacky, and a neat effect. And I can disguise the tooltips to look normal with TooltipHidden and TooltipOverride.


Neat.

0Send private message
0Send private message
7 years ago
Jun 19, 2018, 1:01:33 PM

Ok, here's an example.

What it looks like to the player:

Improvement A - (prerequisite improvment) This improvement must be present somewhere in the empire for Improvement B to function.


Improvement B - Gives its system production only if the empire has built and owns Improvement A.

(Never mind, for the moment, that you can prevent construction of B if A is not present)


Essentially, what I was originaly looking for, was a way to inhibit the production granted by B if A is not present. This would normaly require A to increment a property on ClassEmpire and ClassColonisedStarSystem that could be tracked by B.


What your "complex path" can do, is to instead have Improvement A grant production to all the systems that Improvement B is on.

No Improvement B, no production given to that system.

No Improvement A, no production given anywhere.


A (the prerequisite) is effectively sending the production to B. But using TooltipOverride can make it look like B is giving the production like a normal building.

I just never realized you could have an improvement or anomaly give FIDSI to other/all/specific systems. For targeting a specific systems, it's just a matter of using another improvement/anomaly as a filter of sorts.

So instead of an improvement modifying FIDSI on the same system with ./ClassColonizedStarSystem


I've used ../ClassEmpire/ClassColonizedStarSystem/ImprovementB/./ClassColonizedStarSystem


So Improvement A follows the path back out to the empire level, then sends the FIDIS to all systems that satisfy the path to ImprovementB. Then it backs out one level to the system to modify the FIDSI at each of those systems.

There also a number of other neat things this allows, such as granting a multiplicative bonus based on the number of improvements (they all send FIDSI to each other)

Updated 7 years ago.
0Send private message
7 years ago
Jun 19, 2018, 3:05:23 PM

Ah, I understand now! I thought 'the prerequisite' meant PathPrerequisite or InterpreterPrerequisite, not the other improvement.


Unfortunately, the path '../ClassEmpire/ClassColonizedStarSystem/ImprovementB/./ClassColonizedStarSystem' is illegal and will cause minor issues, because it goes up then down and then up again.

There will be cases where the effect will not be applied because the Simulation does not handle this kind of behaviour and will improperly refresh when the descriptor 'ImprovementB' is finally applied.


The legal way to do it is to add a property 'ImprovementACount' on the descriptor ImprovementB, have ImprovementA increase its value (the path would become valid: '../ClassEmpire/ClassColonizedStarSystem/ImprovementB'), and have ImprovementB apply its effects based on the value of 'ImprovementACount'.

Updated 7 years ago.
0Send private message
7 years ago
Jun 19, 2018, 8:56:31 PM

Well it seems to work, but I'll take your word for it that there are situations where it will break things.

I wasn't aware that you could add new properties into the improvement descriptors to be changed from elsewhere, though this makes sense in hindsight. And that seems like a better way to do things anyway.

Updated 7 years ago.
0Send private message
?

Click here to login

Reply
Comment

Characters : 0
No results
0Send private message