The Outcome System

Is it possible to have an outcome not valid if a building is present? If so is it in the unit or on the outcome infos or on the mission?
 
Is it possible to have an outcome not valid if a building is present? If so is it in the unit or on the outcome infos or on the mission?
You could use the plot condition on the outcome (in the unit or combat type info) by querying with the Has tag (and inverting it with Not).
 
edit
Could be because I moved the captive missions into the captives mod and out of core while I work on them. Same for subdued animals missions.

Found the problem, I am testing a fix now.
 
@AIAndy: I'm thinking that evaluating iCost with the unit gameobject as context is not right, as I'm getting memory access exceptions when calling

Code:
getCost()->evaluate(pUnit->getGameObject())

What other context would make sense here, I'm not too familiar with how OutcomeMissions work with the Outcome system.
 
@AIAndy: I'm thinking that evaluating iCost with the unit gameobject as context is not right, as I'm getting memory access exceptions when calling

Code:
getCost()->evaluate(pUnit->getGameObject())

What other context would make sense here, I'm not too familiar with how OutcomeMissions work with the Outcome system.
No, pUnit->getGameObject() is the right context and you will notice that it is already used in several places in that code.
Make sure you deal properly with the integer expression being NULL when there is no iCost in the XML.
 
No, pUnit->getGameObject() is the right context and you will notice that it is already used in several places in that code.
Make sure you deal properly with the integer expression being NULL when there is no iCost in the XML.

OK, I found some other errors which probably caused the problem, but this is good learning for me, thanks for the help.
 
I need a bit of help with the Human Sacrifice outcomes. Basically I only want the best option to show up as available. Currently there are the three HS buildings in order, Human Sacrifice active -> Alter for Human Sacrifice -> Sacrificial Alter. The better one doubles the return of the lesser.

Now I want to

1) add in increased return for Druid of Naghualism present in the city and even more if one is the state religion. If state religion them more and a small golden age if you have the cathedral of that religion.

2) If the city has the second Druid Cathedral (a special type of wonder only Druid and Shaman have since they don't have any other wonders) or one or more of the Pyramid of the Sun, Moon or Magician a small golden age is added.

Also captive type sacrificed affects the length of the golden age
  • Neanderthals no change
  • Military doubles
  • Civilian 3 times the length.

The biggest problem is how to display this in the action hover over and thus make the affect known outside the python.

I had hoped that by writing this I would come up with a clear solution but I can't. I can make a set of distinct outcomes for the buildings which will upgrade each other to give the base outcome but when it comes to the actual outcome on the unit I think there will be a number of choices being displayed.

I am going to merge the happiness/cultural versions into one action, I don't think we need two.
 
In the Outcome infos file is bHostileTerritory =1 mean not (your nation or any nation of your team or any vassal of you or any team member)
 
In the Outcome infos file is bHostileTerritory =1 mean not (your nation or any nation of your team or any vassal of you or any team member)
bHostileTerritory=1 means this outcome is possible on the territory of a state with which you are at war with.
 
OK, Platyping's bad people can only settle in cities that are not yours or your team mates or any vassal of those. So i will need to put that test in the Python and do a can do call of some kind.
 
@AIAndy I am currently working on some Python that will cause a building to be build in the capital after any combat (win, loose or withdraw) with an animal. I assume I will need to do something special so that we don't get OOS errors and will use the code we already have for how the Colonist and Pioneer add buildings.

Each animal combat will build a hierarchy of myth buildings eg Dart Frog could build "Earth Myth", "Amphibian Myth" and "Poison Myth". If the "Earth Myth" has been built then the "Amphibian Myth" would be built and so on until all the buildings have been built after which combat with Dart Frogs wont have any extra affect. This is in addition to the Kill Outcomes.

I was wondering if this were possible to do in the dll quicker.

If it is done in Python then the list of buildings would be held in Python but they would be in the XML otherwise.
 
@AIAndy I am currently working on some Python that will cause a building to be build in the capital after any combat (win, loose or withdraw) with an animal. I assume I will need to do something special so that we don't get OOS errors and will use the code we already have for how the Colonist and Pioneer add buildings.

Each animal combat will build a hierarchy of myth buildings eg Dart Frog could build "Earth Myth", "Amphibian Myth" and "Poison Myth". If the "Earth Myth" has been built then the "Amphibian Myth" would be built and so on until all the buildings have been built after which combat with Dart Frogs wont have any extra affect. This is in addition to the Kill Outcomes.

I was wondering if this were possible to do in the dll quicker.

If it is done in Python then the list of buildings would be held in Python but they would be in the XML otherwise.

I have very immediate plans in the works to implement that Great Hunter btw... just in case you're getting tired of waiting for me and that's what this project is about. I've figured out I can probably manage the UI side of it too since I should be able to control the display from the dll alone. Pretty much have plotted the project out and should be able to implement it quickly, perhaps even over this weekend.
 
I have very immediate plans in the works to implement that Great Hunter btw... just in case you're getting tired of waiting for me and that's what this project is about. I've figured out I can probably manage the UI side of it too since I should be able to control the display from the dll alone. Pretty much have plotted the project out and should be able to implement it quickly, perhaps even over this weekend.

No this is nothing to do with the Great Hunter. Also there will be interface work since we will need to display the number of points needed to get the next GH like we do for GGs.
 
It is actually a response to the fact that animals are withdrawing which means that the Myths are not being built early enough to be worthwhile.
 
@AIAndy I am currently working on some Python that will cause a building to be build in the capital after any combat (win, loose or withdraw) with an animal. I assume I will need to do something special so that we don't get OOS errors and will use the code we already have for how the Colonist and Pioneer add buildings.

Each animal combat will build a hierarchy of myth buildings eg Dart Frog could build "Earth Myth", "Amphibian Myth" and "Poison Myth". If the "Earth Myth" has been built then the "Amphibian Myth" would be built and so on until all the buildings have been built after which combat with Dart Frogs wont have any extra affect. This is in addition to the Kill Outcomes.

I was wondering if this were possible to do in the dll quicker.

If it is done in Python then the list of buildings would be held in Python but they would be in the XML otherwise.
The combat result Python events should be synced so it should be fine making game state changes in reaction to them.
The only advantage of doing that in the DLL would be speed and having the data in XML.
Of course adding an extra outcome list that includes retreats and increasing the power of outcomes might help with other stuff later.
 
I experimented a bit with direct interactions with the Python DLL.
As a result it is now possible to code outcome effects in Python and include that code right in the XML for the outcome (now means when someone next checks in the compiled DLL).

An example:
Code:
<Outcome>
	<OutcomeType>OUTCOME_BEAR_POWER</OutcomeType>
	<iChance>5</iChance>
	<PythonName>BearWithMeModule</PythonName>
	<Python>						
		def isPossible(unit, plot):
			return unit.isHuman()

		def doOutcome(unit, plot, eDefPlayer, eDefUnitType):
			unit.changeExperience100(1000, -1, False, False, False)
							
		def getDisplay(unit, plot):
			return u"Bear POWER"
							
		def getAIValue(unit, plot):
			return 1
	</Python>
</Outcome>
Anything that you could do in a Python module is allowed within that tag (so you could import other modules and similar). PythonName can be anything. It is only used for code error messages in PythonErr. Ignore any "traceback" it claims if your PythonName appears there.
The four functions need exactly that signature but you can leave any of them out (so if you leave out isPossible, because you don't want to alter when the outcome is possible, then that is ok).

If isPossible(unit, plot) returns false, then this outcome is not possible for the given unit on the given plot.

doOutcome(unit, plot, eDefPlayer, eDefUnitType) is executed when the outcome is triggered with a given unit. If it is a kill outcome, then eDefPlayer is the player to whom the killed unit belonged and eDefUnitType is the type of the killed unit. The plot is given so the function signature is similar to the others but is currently always the plot of the given unit.

getDisplay(unit, plot) can return a string that is displayed in the result brackets of the help text for that outcome (like when you mouse over an action outcome).

getAIValue(unit, plot) allows you to give an estimate of the value of the Python effect to the AI (like when it tries to decide what to do with a subdued animal).
 
I experimented a bit with direct interactions with the Python DLL.
As a result it is now possible to code outcome effects in Python and include that code right in the XML for the outcome (now means when someone next checks in the compiled DLL).

Nice:goodjob:

A DLL Update is on the way to the SVN right now.
 
Top Bottom