Logo Platform
logo amplifiers simplified

How to get the value for the amount of planets/trade routes/luxuries in a system?

Reply
Copied to clipboard!
12 years ago
Oct 5, 2012, 3:32:41 AM
As the title says, is there any to know any of those values when you so you can add bonuses to improvements depending on those values?



For exemple i could create a system improvement that adds 1 food per planet in system (not 1 food per person on planet in system), or 1 dust per trade route in system, or 1 approval per luxury in system.



So far based on observation something like that is not used yet so i fear it might not be possible, but if anyone knows something please let me know.
0Send private message
12 years ago
Oct 5, 2012, 3:39:11 AM
Luxury per system should be easily doable, idk about planets or trade routes. You could try some dirty work using MaxPopulation to calc number of planets.
0Send private message
12 years ago
Oct 5, 2012, 8:17:57 AM
Number of Trade-Routes should be accessible. See the AIPathPrerequisites of the Trade (search "trade2") buildings in StarSystemImprovement.xml for that. I think they use this value to prevent building more trade-route-buildings when the currently available routes are not used up.



For Luxuries I think there is either an improvement or a global tech that uses this. Try searching StarSystemDescriptor.xml or StarSystemImprovement.xml for the word "luxury" and see if you find something usefull.



For the planets... I really don't know I think I had tried to get their number myself once but eventually gave up as I didn't see a way to get them. Also MaxPopulation somehow did not do what I expected.
0Send private message
12 years ago
Oct 5, 2012, 10:12:37 AM
for the planet, the easy way will be to create a new set of Property.



Add on the "ClassStarSystem" descriptor a property like that:





Next add on the "ClassPlanet" descriptor a property like that:





After that you should be able to ask the system how many planet it has...



I hope it helps^^



Cheers,

Flo
0Send private message
12 years ago
Oct 5, 2012, 2:37:15 PM
ThorTillas wrote:
for After that you should be able to ask the system how many planet it has...
Another excellent example of a "tease". How do you ask the system to sum up a list of unknown length?
0Send private message
12 years ago
Oct 5, 2012, 3:10:38 PM
ThorTillas wrote:
for the planet, the easy way will be to create a new set of Property.



Add on the "ClassStarSystem" descriptor a property like that:





Next add on the "ClassPlanet" descriptor a property like that:





After that you should be able to ask the system how many planet it has...



I hope it helps^^



Cheers,

Flo


Thank you very much, thanks to that i didn't only managed to get the amount of planets within the system, but also how many colonized and with same idea should be able to count the luxury, working on it right now. The trade routes was easier then i though.



I will post the solution i found to all those issues later on today after i solve the luxury issue.
0Send private message
12 years ago
Oct 5, 2012, 3:13:27 PM
if you are editing "AIPrerequisites" or "PathPrerequisite", you can try this to count the colonized planet of a system.



count(ClassStarSystem/PlanetStatusColonized)
0Send private message
12 years ago
Oct 5, 2012, 5:44:03 PM
First thing first, if you want pretty tooltips you will need to make custom ones in Localization\English\Localization_Locales.xml, for that purpose you will see operations tagged with TooltipVisibility="false" which hides it from the attached tooltip, this is already done in some cases in the original game, check Adaptive Industrial Systems (100% Food Surplus to Industry Conversion System Improvement) to get the idea how it's done.



Finding out the number of trade routes in a system was the easiest problem since the value needed was already defined as MaxTradeRoutes.

Exemple for giving 100 dust per Trade Route in system:

[code]
BinaryOperationType="Multiplication" Right="100" Left="$(MaxTradeRoutes)"

Path="../ClassStarSystem" BindOnSource="false" TooltipVisibility="false"/>[/code]



For things that are not already defined and counted you need to do it yourself like ThorTillas mentioned.

I will use:

PlanetCount - Counts the number of planets in a system.

ColonizedPlanetCount - Counts the number of colonized planets in a system.

LuxuryCount - Counts the number of luxury resources on colonized planets in a system, if the luxury is unlocked.

LuxuryDepositCount - Counts the number of luxury deposits on colonized planets in a system, if the luxury is unlocked.



First in StarSystemDescriptor.xml in add:

[code]









[/code]



Then in PlanetDescriptor.xml again in add:

[code]









[/code]

With this done the counting of planets in a system is done since it adds 1 for each planet.



For Colonized one in same PlanetDescriptor.xml in ModifierDescriptors> you will need to add:

[code]$(ColonizedModifier)"

OperationType="Addition" Path="ClassPlanet"/>[/code]

ColonizedModifier is 1 for colonized planets and 0 otherwise (from observation it's used as a multiplier when summing up planet resources), as such it ends up adding 1 for every colonized planet.



Now for Luxury you need to go to the bottom of PlanetDescriptor.xml and search for all 16, it's a group of 4 for each tech that gets them unlocked. This allow you to decide if you want to count them all 16, only specific ones or in same way you can count strategic resources too.

You need to add the bolded lines for each Luxury you want counted like in this exemple:

[code]





















[/code]

As in previous exemples, this will add up 1 for each luxury and at the same time sum up all deposit sizes to count the total number.



All four new values can be used in same way MaxTradeRoutes was used previously, for exemple for adding 50 food for each colonized planet in a system:

[code]
BinaryOperationType="Multiplication" Right="50" Left="$(ColonizedPlanetCount)"

Path="../ClassStarSystem" BindOnSource="false" TooltipVisibility="false"/>[/code]



That's about all, there are probably other ways of doing it but this is what i came up. Thank you for giving me the hint that you can define your own stuff, after that you just need to find cleaver ways of combining the info already available.



Edit:

Writing this post end up taking me more time then it took to figure it all out.
0Send private message
12 years ago
Jan 1, 2013, 8:37:58 AM
Using this old thread since it's a related question and i wanted to keep it all in one thread for future references.



I'm trying to add domestic trade as a form of low income, when a trade route is unused to trade with other empires, it would get used for internal trade, providing some dust income but no science.



To do that i would need to know the number of used or unused trade routes, sadly in the current xml files the only things related to trade are MaxTradeRoutes and different bonuses linked to trade.



If anyone has any ideas i would appreciate the help.
0Send private message
12 years ago
Jan 1, 2013, 5:05:50 PM
Potential dumbness incoming.



Whether a trade route is used or unused there is a certain amount in infrastructure and domestic economic activity involved in maintaining the infrastructure for the trade route.



While this is looking at it strictly from a realistic point of view and not really considering balance issues at all, wouldn't a trade route generate that same or or even more side stream activity when active?



Therefore I would think it would be reasonable to add a small dust income based on max trade routes, though I would make it based on a new faction trait like Highly Efficient Taxation.
0Send private message
12 years ago
Jan 2, 2013, 2:12:23 AM
Yea, i understand what you mean and that is easy to add, problem is that i wanted it to be a income buff only to unused trade routes without increasing the income of already used trade routes.



For now this is probably the only option i got since there is really nothing in the xml files to tie to how many trade routes are actually active at one time.
0Send private message
?

Click here to login

Reply
Comment