Thunderbrd
C2C War Dog
I have always wanted to mod the game so that Great Prophets initiate the first circumstance of a religion's spread. There are multiple reasons why, not the least of which that I feel this would put more control in the hands of the players (and even the AI) rather than luck and some small bit of strategy defining where Holy Cities are defined.
I haven't wanted to proxy out a building for this purpose because it doesn't feel like the 'right' way to go about this.
So, on this quest, I'd of course like to make this a player selectable 'option' and how THAT element will be added is another matter down the road.
So far, I've managed to find that I can add a spread function through the XML to the prophet for each religion. In combination with a successful SDK merge with a neat little programming routine I found in the FFH2 source files, I have been successful in modding the prophet to spread AND found religions by so doing (any religion may now be spread by any prophet and the first instance of such defines the Holy City.)
Now I'm working on the AI as there are no appropriate parallels in any other unit's programming. Using it like a missionary is possible... but a waste.
So I have studied the UnitAI file and have figured out how it works to some degree and would like a bit of assistance from those who really know what they're doing with programming to help guide me to a minor 'finish' here. This step will make the mod playable, if not hardwired and dedicated into the way the game plays by the .dll.
So, for all you SDK guys out there, perhaps you could help me to develop the code for this:
This is the basic structure I'm looking to program. I could probably piece much of it together from other SDK examples, but any assistance could accelerate that process along nicely (and hopefully avoid problematic bugs along the way).
Make any sense?
I haven't wanted to proxy out a building for this purpose because it doesn't feel like the 'right' way to go about this.
So, on this quest, I'd of course like to make this a player selectable 'option' and how THAT element will be added is another matter down the road.
So far, I've managed to find that I can add a spread function through the XML to the prophet for each religion. In combination with a successful SDK merge with a neat little programming routine I found in the FFH2 source files, I have been successful in modding the prophet to spread AND found religions by so doing (any religion may now be spread by any prophet and the first instance of such defines the Holy City.)
Now I'm working on the AI as there are no appropriate parallels in any other unit's programming. Using it like a missionary is possible... but a waste.
So I have studied the UnitAI file and have figured out how it works to some degree and would like a bit of assistance from those who really know what they're doing with programming to help guide me to a minor 'finish' here. This step will make the mod playable, if not hardwired and dedicated into the way the game plays by the .dll.
So, for all you SDK guys out there, perhaps you could help me to develop the code for this:
Spoiler :
my basic structure for my subroutine:
* are there any religions left to be founded?
* if so, is our favorite religion left to be founded?
* if so, set that religion to be spread
* (Otherwise, we must deterimine which of the religions that can be founded are best to found... perhaps this could be established with a new XML identifier on each religion to give them a tag to the flavors preferred by the various leaderheads. (this would be using a schema but I would have to figure out how to fix up a schema for religions that includes iFlavor))
Thus would begin by making flavorcheck (for a given available religion)= sum of all results from(Current Leader's flavor (default 1) x Available Religion's flavor (default 0) where Current Leader's Flavor is the same type as Religion's flavor)
Then would establish a hierarchy of religion choices, where equivalent values we don't care how it aligns up. Thus we set best religion = flavorcheck (highest valued religion)
Then establish that religion to be spread unless the result is 0 (the leader doesn't care about that religion at all) in which case we return false to the module as a whole.
* Then we simply push the spread mission for the selected religion, wherever the prophet has been placed and return true to return back to the subroutine for the prophet (where it simply returns and stops moving the unit that has been devoured by the 'mission' subroutine.)
* are there any religions left to be founded?
* if so, is our favorite religion left to be founded?
* if so, set that religion to be spread
* (Otherwise, we must deterimine which of the religions that can be founded are best to found... perhaps this could be established with a new XML identifier on each religion to give them a tag to the flavors preferred by the various leaderheads. (this would be using a schema but I would have to figure out how to fix up a schema for religions that includes iFlavor))
Thus would begin by making flavorcheck (for a given available religion)= sum of all results from(Current Leader's flavor (default 1) x Available Religion's flavor (default 0) where Current Leader's Flavor is the same type as Religion's flavor)
Then would establish a hierarchy of religion choices, where equivalent values we don't care how it aligns up. Thus we set best religion = flavorcheck (highest valued religion)
Then establish that religion to be spread unless the result is 0 (the leader doesn't care about that religion at all) in which case we return false to the module as a whole.
* Then we simply push the spread mission for the selected religion, wherever the prophet has been placed and return true to return back to the subroutine for the prophet (where it simply returns and stops moving the unit that has been devoured by the 'mission' subroutine.)
This is the basic structure I'm looking to program. I could probably piece much of it together from other SDK examples, but any assistance could accelerate that process along nicely (and hopefully avoid problematic bugs along the way).
Make any sense?