Empire size information in facility ability formula |
I'm trying to get a facility ability amount to depend roughly on the size of the owner's empire, and I was wondering if anyone had any ideas about how to insert any of the following quantities into the ability amount formula field:
1. The number of planets the owner controls.
2. The number of star systems the owner controls.
3. Any other quantity that corresponds to the size of the owner's empire.
4. How far the planet the facility is on is from the owner's homeworld, in lightyears or warp jumps - this last one would be really awesome, though probably the hardest and least possible.
Re: Empire size information in facility ability formula
No, you can't define new functions for use in the Data files*. You can create whatever you want within the AI/event/intel scripts, but the regular data files have no capacity to create arbitrary functions.
There are a few exceptions, but they pretty much all apply to planet values (temperature, radiation, gravity). You can create new formulas for them in Formulas.txt, and reference them in some of the planet types.
Re: Empire size information in facility ability formula
#1) I have no idea if it will work in this context but there is a function that will find the # of colonies that a player owns. As stated in the scripting manual:
This function returns the number of colonies that this player owns. The plr_index is the ID of the player.
#2) Here is another fun one with multiple uses
This function returns specific statistics about a player’s colonies. The plr_index is the ID of the player. The all_planets_stats_filter determines which
statistic to return. These constants can be used:
COLONIES_STATS_FILTER_NUM_SYSTEMS_WITH_COLONIES,
COLONIES_STATS_FILTER_NUM_COLONIES,
COLONIES_STATS_FILTER_NUM_BLOCKADED_PLANETS,
COLONIES_STATS_FILTER_NUM_RACES,
COLONIES_STATS_FILTER_TOTAL_POPULATION,
COLONIES_STATS_FILTER_NUM_FACILITIES,
COLONIES_STATS_FILTER_TOTAL_FACILITY_TONNAGE.
#3) Many more of the above listed in the scripting document (under empire or empire stats...beginning page 33 or so)
#4)This is the closest I could find for the last one...looks like it should work quite well if I understand correctly. That is assuming that you can call a function from this file at all of course.
The lack of enthusiastic response from the REAL experts on modding this game makes me worry that none of these will work in this circumstance...but who knows...maybe they're just off duty today. 

Re: Empire size information in facility ability formula
He was looking for a function that would work in the data files, in which case there is no function to return the size of the empire.
-----




Re: Empire size information in facility ability formula
Alternatively, does anyone know if it is possible to call into a custom scripted function from an ability formula?
I'm actually pretty new to SE V modding, and the scripting reference appears to be just a list of functions and doesn't really explain the mechanics very well...