View Full Version : The Outcome System


AIAndy
Jan 09, 2012, 04:55 AM
Some time in the next days I will have completed the code for the Outcome system so I wanted to give some information of how it will work (details about the XML will be added when the code is finished).

What it is used for:

It replaces the current Python code for the result of killing animals like getting a subdued animal or some hammers or a bonus
It will be used for new actions for subdued animals in a second step
It can be used for other results from killing a unit like getting some espionage against an enemy if you kill one of his units


You define a list of possible outcomes for each unit type in the XML that each have a relative chance, requirements and a result.
Depending on promotions the chances can also change.
When a unit is killed, one possible outcome is chosen from the list depending on the relative chances of all currently possible outcomes.

Some examples:
To get the same effect as now you would define three possible outcomes for each animal. One to get the subdued animal, one to get the respective bonus on the plot and one to get the food/hammers.
The hunter promotions increase the chances of the subdue outcome type (you only define that once in the outcome info XML including the message when that outcome happens).

You could also have some animal outcomes that give you great people points or beakers (meaning you got some new insights from killing the animal).

There could be an inquisition promotion that enables that unit to sometimes get an outcome that gives espionage points from certain units or an engineer promotion that enables you to get some tech from killed high tech units.

Hydromancerx
Jan 09, 2012, 05:25 AM
Is this in addition to the :gold:, :science: and/or :espionage: a unit can get in the have the right promotions upon combat victory?

AIAndy
Jan 09, 2012, 06:14 AM
Is this in addition to the :gold:, :science: and/or :espionage: a unit can get in the have the right promotions upon combat victory?
It is independent of all previous systems.

Dancing Hoskuld
Jan 09, 2012, 06:16 AM
There are 6 promotions that affect the chance of subduing animals. This will still work? Currently I define it once will I now need to define it once for each animal? Or is it on the promotion?

AIAndy
Jan 09, 2012, 06:30 AM
There are 6 promotions that affect the chance of subduing animals. This will still work? Currently I define it once will I now need to define it once for each animal? Or is it on the promotion?
You define it once in the outcome type. Then you refer to that outcome type in the outcome list of each animal.
Check CIV4OutcomeInfos.xml that is already on the XML.

Dancing Hoskuld
Jan 09, 2012, 01:52 PM
Currently the algorithm is:-

If animal unit is not subdued
give hammers and food
else
if the unit may provide a resource and there is no resource on the plot and there are not x resources next to this plot (where x=0 for land and 1 for sea) and team has tech and not bad plot (ie not snow or salt flats terrain)
if change >= 80
place resource
else
place subdued animal on plot with subduing unit (not always working because the incorrect info is passed to python)



See the problem.;)

Edit I suppose since this is in the dll it could use the valid terrains for the bonus rather than having the bad terrain list. Probably be better that way.

AIAndy
Jan 09, 2012, 04:31 PM
Currently the algorithm is:-

If animal unit is not subdued
give hammers and food
else
if the unit may provide a resource and there is no resource on the plot and there are not x resources next to this plot (where x=0 for land and 1 for sea) and team has tech and not bad plot (ie not snow or salt flats terrain)
if change >= 80
place resource
else
place subdued animal on plot with subduing unit (not always working because the incorrect info is passed to python)



See the problem.;)

Edit I suppose since this is in the dll it could use the valid terrains for the bonus rather than having the bad terrain list. Probably be better that way.
No, I don't see the problem as the code already checks that. Like if you say you want a bonus placement as a possible outcome then it will check if that is a valid spot and that you have the tech to reveal it and not the tech that obsoletes it. Otherwise that outcome is not possible and it is not considered at that time.

AIAndy
Jan 10, 2012, 05:04 PM
I have added the first version of the system to the SVN.
UNIT_BEAR has exemplary outcome entries.
There are no messages yet but the functionality should work.

Note: The chances are relative so if you sometimes want nothing to happen add an outcome entry with only type and chance (probably add an outcome type with an empty message as well for when messages will work). If one outcome has a chance of 20 and the other a chance of 10, then the first outcome will happen 2/3 (= 20 / (10+20) ) of the time and the second 1/3 (= 10 / (10+20) ) of the time.

Currently an outcome can consist of giving the killing unit a promotion, placing a bonus, getting a unit (subdued unit), getting yields (food and hammer to next city, commerce is split according to the sliders) or commerce (culture to next city, beakers to currently researched tech, espionage towards team of the killed unit) or getting great people points (either generic or towards a specific great person).

robomani
Jan 10, 2012, 08:31 PM
Will the outcome system be used to capture slave and convert enemies (can enemies be converted in C2C?)

Dancing Hoskuld
Jan 10, 2012, 08:51 PM
Will the outcome system be used to capture slave and convert enemies (can enemies be converted in C2C?)

It can be used to replace the current slavery mechanic.

Dancing Hoskuld
Jan 11, 2012, 12:43 AM
I have update the outcome file and the bear information to get it as near as I can to the subdue animals code.

The current way it works is to test if the subdue was successful and if not apply the kill. However the example in the bear appears to say that you get food and hammers only 25% of the time and a subdued animal 10% (+ promotion modifiers) of the time. What happens the other 65% of the time? Or is it 10 out of 35 you subdue and 25 out of 35 you kill?

If I want the outcome to happen if the other outcomes don't happen how do I specify that. Assuming percentages?

BlueGenie
Jan 11, 2012, 01:16 AM
The latter. 10 out of 35 and 25 of 35.

Assuming percentages you'd have to set a sum equal to 100.
30 for Subdue and 70 for kill yields, for instance.

Cheers

AIAndy
Jan 11, 2012, 01:22 AM
Or is it 10 out of 35 you subdue and 25 out of 35 you kill?
This is the way it works. Of course that is not an exact replication of the previous chances for subdueing/bonus placement, but you can model it close enough I think and that way you get a lot less problems when you use it for some different purposes.

In detail:
A unit dies as the result of a combat.
If the dieing unit type has any outcomes defined, they are all checked if they are possible at the moment (e.g. their tech prereqs are met and you don't have the obsoleting tech for the promotion that that outcome would provide to the winning unit).
A relative chance value is calculated for all currently possible outcomes. Those chance values are then summed up and the actual chance for each outcome is own chance value divided by the sum.
If there is only one possible outcome, then the chance is 100% (but you can have outcomes that do nothing).
A random roll determines one of the outcomes and only that outcome is executed then.

BlueGenie
Jan 11, 2012, 01:32 AM
What about promotions/civics that change an outcome possibility? Mainly thinking about Hunter promotions and slavery civic.
Do they work with the new system if the outcome is determined by the killed unit instead of the killing unit?

Cheers

AIAndy
Jan 11, 2012, 02:07 AM
What about promotions/civics that change an outcome possibility? Mainly thinking about Hunter promotions and slavery civic.
Do they work with the new system if the outcome is determined by the killed unit instead of the killing unit?

Cheers
Both killed and killing unit influence the outcome and outcome chances.
Each outcome has an outcome type and the outcome type has a list of promotions defined that increase the chance of this outcome (CIV4OutcomeInfos.xml).
But you are right, civic prereqs or chance changes have to be added at the same point (I guess mainly for slavery at the moment). I'll start by adding a single civic prereq similar to the tech prereq that is already in there unless more is requested.

Dancing Hoskuld
Jan 11, 2012, 02:30 AM
This is the way it works. Of course that is not an exact replication of the previous chances for subdueing/bonus placement, but you can model it close enough I think and that way you get a lot less problems when you use it for some different purposes.

In detail:
A unit dies as the result of a combat.
If the dieing unit type has any outcomes defined, they are all checked if they are possible at the moment (e.g. their tech prereqs are met and you don't have the obsoleting tech for the promotion that that outcome would provide to the winning unit).
A relative chance value is calculated for all currently possible outcomes. Those chance values are then summed up and the actual chance for each outcome is own chance value divided by the sum.
If there is only one possible outcome, then the chance is 100% (but you can have outcomes that do nothing).
A random roll determines one of the outcomes and only that outcome is executed then.


So a unit with no promotions has a 10 out of 35 chance of subduing an animal or 28.57% chance. Rather than 10%.

While a unit with all promotions gets 55 out of 90 has 61% chance of subduing.

Both killed and killing unit influence the outcome and outcome chances.
Each outcome has an outcome type and the outcome type has a list of promotions defined that increase the chance of this outcome (CIV4OutcomeInfos.xml).
But you are right, civic prereqs or chance changes have to be added at the same point (I guess mainly for slavery at the moment). I'll start by adding a single civic prereq similar to the tech prereq that is already in there unless more is requested.

Currently, slavery only comes into play if the attacking unit wins when attacking a city. If an attacking unit wins and the team has slavery (or x) civic then 40% of the time a slave will be generated.

BtW I keep meaning to adjust all these by difficulty level.

AIAndy
Jan 11, 2012, 04:00 AM
So a unit with no promotions has a 10 out of 35 chance of subduing an animal or 28.57% chance. Rather than 10%.

While a unit with all promotions gets 55 out of 90 has 61% chance of subduing.
Yes, indeed, I have not done any balancing of the numbers.

Currently, slavery only comes into play if the attacking unit wins when attacking a city. If an attacking unit wins and the team has slavery (or x) civic then 40% of the time a slave will be generated.
I think that part I will leave like it is now but maybe we want some units to be enslavable sometimes when defeated.

BtW I keep meaning to adjust all these by difficulty level.
Chance changes similar to the promotions for each outcome type?

Dancing Hoskuld
Jan 11, 2012, 12:50 PM
Absolute percentages are better since that is what people are used to. If they don't add up to 100% the left over is what normally happens. If it adds up to over 100 then treat it as relative percentages.

AIAndy
Jan 11, 2012, 01:16 PM
Absolute percentages are better since that is what people are used to. If they don't add up to 100% the left over is what normally happens. If it adds up to over 100 then treat it as relative percentages.
Changed it now to work like that.

Dancing Hoskuld
Jan 11, 2012, 02:50 PM
How will we we do the "butcher" outcome. I have the data and button but I am not sure how to activate it. The idea was for three types
- butcher in wild (ie not inside your cultural borders) where the result is the same as kill in combat
- butcher inside cultural boarders result = twice kill in combat plus money
- butcher in city result = twice kill in combat plus twice money.

AIAndy
Jan 11, 2012, 03:17 PM
How will we we do the "butcher" outcome. I have the data and button but I am not sure how to activate it. The idea was for three types
- butcher in wild (ie not inside your cultural borders) where the result is the same as kill in combat
- butcher inside cultural boarders result = twice kill in combat plus money
- butcher in city result = twice kill in combat plus twice money.
The actions are not yet in. That part I still need to code.
But once they are in you will define actions and then link the action to an outcome list in the unit info. That means the outcomes define what the action will do on that unit.
To model the behavior you describe I also need to add the ability to restrict outcomes to inside/outside cultural borders and inside/outside of cities. That will be in the outcome types.

Dancing Hoskuld
Jan 11, 2012, 03:47 PM
Good.

I have just done all the animals but not subdued animals then I realised that I had not done the resource replacement. :(

Dancing Hoskuld
Jan 11, 2012, 11:23 PM
@AIAndy I think I have all the XML done. Is the outcome system on? If so I shall turn off the Subdue Animal python.

Edit Well that answers that, I just subdued 2 badgers. You need to get the messaging working.

AIAndy
Jan 12, 2012, 01:26 AM
@AIAndy I think I have all the XML done. Is the outcome system on? If so I shall turn off the Subdue Animal python.

Edit Well that answers that, I just subdued 2 badgers. You need to get the messaging working.
That is the next item on my list.

AIAndy
Jan 18, 2012, 04:28 AM
Most of the code for the subdued animal actions is written but not the AI and the XML for it will be needed as well.
So I assume it is best to move that to the next version with the feature freeze starting today.

Dancing Hoskuld
Jan 26, 2012, 02:24 PM
@AIAndy as I have been thinking for quite awhile and as Koshling has suggested it would be preferrable if subdued sea critters were returned to the nearest coastal city. This is because they are stories about those animals not the animals themselves. This changes later in th game where you do indeed need to get an animal home to stock that aquarium. This means that I may need two outcomes. Is this doable? Or to be more correct do you have the time to do it? ;)

AIAndy
Jan 26, 2012, 02:58 PM
@AIAndy as I have been thinking for quite awhile and as Koshling has suggested it would be preferrable if subdued sea critters were returned to the nearest coastal city. This is because they are stories about those animals not the animals themselves. This changes later in th game where you do indeed need to get an animal home to stock that aquarium. This means that I may need two outcomes. Is this doable? Or to be more correct do you have the time to do it? ;)
Certainly doable. I just need to add more conditions to the outcome types. Depending on which condition do you want to switch?

Dancing Hoskuld
Jan 26, 2012, 03:07 PM
Certainly doable. I just need to add more conditions to the outcome types. Depending on which condition do you want to switch?

Oh great did I put the outcome stuff in the subdued animals because they should be the same as wild ones?

What I am thinking is that sea creatures will be "subdueable" as tales up until you have a certain tech after which point they can be captured in the normal way. These tales will still look like animals but will behave differently. When subdued they will immediately be moved to the nearest coastal city. If I can work it right they will then be able to be re-based to other cities otherwise they will be coastal only units.

Units captured as fish will be handled as they now are. It may be useful to do similar with the land animals also but only have them subdued as tales if they are at great distances from the nearest cities.

AIAndy
Jan 26, 2012, 03:33 PM
Oh great did I put the outcome stuff in the subdued animals because they should be the same as wild ones?

What I am thinking is that sea creatures will be "subdueable" as tales up until you have a certain tech after which point they can be captured in the normal way. These tales will still look like animals but will behave differently. When subdued they will immediately be moved to the nearest coastal city. If I can work it right they will then be able to be re-based to other cities otherwise they will be coastal only units.

Units captured as fish will be handled as they now are. It may be useful to do similar with the land animals also but only have them subdued as tales if they are at great distances from the nearest cities.
Ok, I will add the necessary conditions but I am away most of the weekend so it won't be finished until beginning of next week.

Koshling
Jan 26, 2012, 05:40 PM
One issue I have noticed with the outcome system is that the messaging is a bit weird.

I get messages of the form 'Your Tracker (London) has killed a Barbarian elephant' in green text, then sometime later I get a message in whiet text that originates from the outcome code that basically says the same thing, but also gives the yields that resulted.

Two points about this (both are fairly minor but would be nice if it could be tidied somehow):

It would be nice if an outcome message simply replaced the other message somehow. To do that however, you'd need a default outcome that at least generated the base message
If we get both messages it would be nice if they appeared one after the other (currently you seem to get all of one type for the turn, then all of the other)

Neither of these is exactly game breaking, but it just struck me is all

AIAndy
Jan 27, 2012, 02:52 AM
One issue I have noticed with the outcome system is that the messaging is a bit weird.

I get messages of the form 'Your Tracker (London) has killed a Barbarian elephant' in green text, then sometime later I get a message in whiet text that originates from the outcome code that basically says the same thing, but also gives the yields that resulted.

Two points about this (both are fairly minor but would be nice if it could be tidied somehow):

It would be nice if an outcome message simply replaced the other message somehow. To do that however, you'd need a default outcome that at least generated the base message
If we get both messages it would be nice if they appeared one after the other (currently you seem to get all of one type for the turn, then all of the other)

Neither of these is exactly game breaking, but it just struck me is all
The second one is just a different message type setting, easily changed.
While currently the outcome text says something pretty similar as the combat result report I don't think that will be the case later. Like when you use butchering or similar (that I currently implement).

Dancing Hoskuld
Feb 02, 2012, 06:04 PM
There is a mission "Explore Ancient Temple" somewhere. I need to hunt for it.

The icon would be useful for two new missions
- Explorer or Adventurer "Explore City Ruins"
- "Examine Subdued Animal"

Explore City Ruins - similar to events
- requires any city ruins (anywhere)
- small chance of treasure or points towards a tech

Examine Subdued Animal
- by subdued animal in a city
- Scribal school, 1-5 :science:
- Library, 1-10 :science:
- University, 10-20 :science:
- Biology Lab 10-40 :science:
Only one building considered ie the best.
- perhaps Governor's Menagerie, Zoo or Biodome should increase the science gained?

Edit @AIAndy, have you had chance to look at the subdue where the unit gets sent back to the nearest city yet? I am thinking of replacing all early subdued sea creatures with the "stories about" because it seems strange to be able to capture some of them so soon.

AIAndy
Feb 05, 2012, 07:12 AM
Edit @AIAndy, have you had chance to look at the subdue where the unit gets sent back to the nearest city yet? I am thinking of replacing all early subdued sea creatures with the "stories about" because it seems strange to be able to capture some of them so soon.
Just saw this edit. That feature is already in.
Set bUnitToCity in the outcome. That means the subdued unit is sent to the same city that the hammers or food would have been sent.
Also set bToCoastalCity in the outcome type. That way a coastal city is used.

AIAndy
Feb 05, 2012, 07:18 AM
There is a mission "Explore Ancient Temple" somewhere. I need to hunt for it.

The icon would be useful for two new missions
- Explorer or Adventurer "Explore City Ruins"
- "Examine Subdued Animal"

Explore City Ruins - similar to events
- requires any city ruins (anywhere)
- small chance of treasure or points towards a tech
Do you want the explorer unit used up by that or the city ruins removed? Or some outcomes that the explorer is killed?

AIAndy
Feb 05, 2012, 10:44 AM
Examine Subdued Animal
- by subdued animal in a city
- Scribal school, 1-5 :science:
- Library, 1-10 :science:
- University, 10-20 :science:
- Biology Lab 10-40 :science:
Only one building considered ie the best.
I just pushed a change to the SVN that adds the ReplaceOutcomes tag to outcome info XML which should allow you to implement this action.
The PrereqBuildings tag has already been in before (allows you to specify a list of buildings that need to be present for this outcome to be possible).

So you have an outcome type for each of the situations you describe that each require a building and use ReplaceOutcomes to replace the outcomes that are worse.

Dancing Hoskuld
Feb 05, 2012, 12:27 PM
Just saw this edit. That feature is already in.
Set bUnitToCity in the outcome. That means the subdued unit is sent to the same city that the hammers or food would have been sent.
Also set bToCoastalCity in the outcome type. That way a coastal city is used.

I am a bit dim this morning. Is this in the Outcomes file or the Unit file?

Do you want the explorer unit used up by that or the city ruins removed? Or some outcomes that the explorer is killed?

Interesting ideas, I had not thought this one through. ;) I would want the ruins removed but if the adventurer finds something they need to survive to bring it back. If the adventurer dies then the ruins would stay.

I just pushed a change to the SVN that adds the ReplaceOutcomes tag to outcome info XML which should allow you to implement this action.
The PrereqBuildings tag has already been in before (allows you to specify a list of buildings that need to be present for this outcome to be possible).

So you have an outcome type for each of the situations you describe that each require a building and use ReplaceOutcomes to replace the outcomes that are worse.

I would have thought it was a mission like the butcher since it is the unit doing the action. However as I said I am a bit dim this morning, and I haven't even had my coffee yet.

Edit I have found a unit for captives so maybe we should look at moving the slavery mod into outcomes also. Also the new wonder Catacombs.

AIAndy
Feb 05, 2012, 12:40 PM
I am a bit dim this morning. Is this in the Outcomes file or the Unit file?
bUnitToCity is in the unit file (where the specific outcome is described).
bToCoastalCity is in the outcome type file (where outcome types are described).

Interesting ideas, I had not thought this one through. ;) I would want the ruins removed but if the adventurer finds something they need to survive to bring it back. If the adventurer dies then the ruins would stay.
Then I will add a removal tag to the outcome. So you could have outcomes that give something and remove the ruin, some that give nothing and remove the ruin and some that kill the explorer but leave the ruin.

I would have thought it was a mission like the butcher since it is the unit doing the action. However as I said I am a bit dim this morning, and I haven't even had my coffee yet.
It is a mission of course. But the outcome list of that mission needs to have the capability to remove the worse outcomes (e.g. library) from the list when you have a better one available (e.g. university). That is what the new tag does.

Dancing Hoskuld
Feb 05, 2012, 12:53 PM
OK. So

1) I need a new out come for sea creatures only which transports them back to the city on being subdued.

2) I need to make 4 Examine_Animal outcomes for the mission.

Gotchya!

Edit perhaps I should explain my intent so you can tell me if I am using your system correctly. With sea creatures only when they are subdued they will return immediately to the nearest city. Before whaling only tales about the larger animals will be "subdued" not the animal itself so the city will get both the food and the tale unit. The chance of subduing the larger animals will increase with marine biology.

AIAndy
Feb 05, 2012, 02:37 PM
OK. So

1) I need a new out come for sea creatures only which transports them back to the city on being subdued.

2) I need to make 4 Examine_Animal outcomes for the mission.

Gotchya!

Edit perhaps I should explain my intent so you can tell me if I am using your system correctly. With sea creatures only when they are subdued they will return immediately to the nearest city. Before whaling only tales about the larger animals will be "subdued" not the animal itself so the city will get both the food and the tale unit. The chance of subduing the larger animals will increase with marine biology.
Correct, you make different outcome types for subdueing sea animals early (you only get the tale), subdueing sea animals late (after a prereq tech, set it to replace the earlier one or give the earlier one that tech as an obsolete tech) and subdueing sea animals with marine biology (higher chance).

Dancing Hoskuld
Feb 10, 2012, 01:33 PM
@AIAndy My latest attempt with outcomes does not work the way I am expecting. Instead of getting "tales" until I get a tech which replaces them with "subdued" I am getting both! can you tell me what I a doing wrong ;)

AIAndy
Feb 10, 2012, 04:38 PM
@AIAndy My latest attempt with outcomes does not work the way I am expecting. Instead of getting "tales" until I get a tech which replaces them with "subdued" I am getting both! can you tell me what I a doing wrong ;)
First issue was a bug on my side that prevented it from reading the prereq tech correctly. I pushed a fix to the SVN.
Second issue is that you need to have
<ReplaceOutcomes>
<OutcomeType>OUTCOME_TALES_SEA</OutcomeType>
</ReplaceOutcomes>
instead of
<ReplaceOutcomes>
<ReplaceOutcomes>OUTCOME_TALES_SEA</ReplaceOutcomes>
</ReplaceOutcomes>
I pushed that change to the SVN as well.

Dancing Hoskuld
Feb 11, 2012, 06:18 AM
@AIAndy,I have tried to get some missions working but they are not appearing so I have done something wrong. Since I just noticed it is now midnight. I will give up and try tomorrow rather than post to the SVN, just in case. ;)

AIAndy
Feb 11, 2012, 06:50 AM
@AIAndy,I have tried to get some missions working but they are not appearing so I have done something wrong. Since I just noticed it is now midnight. I will give up and try tomorrow rather than post to the SVN, just in case. ;)

A short checklist for adding outcome missions:

Add the new mission at the end of CIV4MissionInfos.xml. IMPORTANT: Any position before MISSION_PRETARGET_NUKE is not allowed and will cause a lot of issues.
An outcome mission button is only displayed if any of the outcomes associated with it is possible there. So check that all the prereqs are met.

Dancing Hoskuld
Feb 22, 2012, 03:46 PM
@AIAndy do we have the ability for an outcome which is +1 Happy for 10 turns scaling?

AIAndy
Feb 22, 2012, 04:30 PM
@AIAndy do we have the ability for an outcome which is +1 Happy for 10 turns scaling?
Not yet.

Dancing Hoskuld
Mar 06, 2012, 01:01 PM
@AIAndy, I am doing something wrong :(. I am trying to add a number of missions to a unit, Subdued Badger, but what I am getting is a random chance of valid missions happening.

In particular I want to be able to choose from Combat (badger baiting), and Study, in the example enclosed. What I get in valid cities is one button saying I have a 50% chance of either occurring.

On another note, if you look at the Subdue_Animals unit infos you will see I have exactly the same action-result for every Tales_Of unit. Which is cumbersome. I will have the same thing for all but one study for Subdued_ units. Combat will be different. Nothing I can think of straight away, besides third normal form and defaults, for "fixing" this.;)

AIAndy
Mar 06, 2012, 03:36 PM
@AIAndy, I am doing something wrong :(. I am trying to add a number of missions to a unit, Subdued Badger, but what I am getting is a random chance of valid missions happening.

In particular I want to be able to choose from Combat (badger baiting), and Study, in the example enclosed. What I get in valid cities is one button saying I have a 50% chance of either occurring.

On another note, if you look at the Subdue_Animals unit infos you will see I have exactly the same action-result for every Tales_Of unit. Which is cumbersome. I will have the same thing for all but one study for Subdued_ units. Combat will be different. Nothing I can think of straight away, besides third normal form and defaults, for "fixing" this.;)
The actions look correct. The issue might be with double MISSION_ANIMAL_COMBAT entries in the mission info. Not sure though. I will have a more detailed look tomorrow evening.

Dancing Hoskuld
Mar 08, 2012, 12:40 PM
I removed the duplicate mission but the problem persists.

AIAndy
Mar 08, 2012, 12:53 PM
I removed the duplicate mission but the problem persists.
I found the bug. It will be uploaded once I have finished the date stuff I am currently working on.

AIAndy
Mar 08, 2012, 06:50 PM
The bugfix is on the SVN now.

Dancing Hoskuld
Mar 08, 2012, 07:09 PM
Thanks. I am now getting both buttons but the results of the study button are not showing up. I know I missed the game text but I should be getting 1:science: from the badger. Whereas it is showing zero.

Edit I should be getting three buttons - butcher, study and combat. I am only getting the butcher and study. No changes fro what I gave you before. The combat one has no prerequsite buildings.

AIAndy
Mar 09, 2012, 05:24 AM
Thanks. I am now getting both buttons but the results of the study button are not showing up. I know I missed the game text but I should be getting 1:science: from the badger. Whereas it is showing zero.

Edit I should be getting three buttons - butcher, study and combat. I am only getting the butcher and study. No changes fro what I gave you before. The combat one has no prerequsite buildings.
I'll investigate some more on Saturday. Maybe add it as a separate module on the SVN so I can easily activate and test it directly.

Dancing Hoskuld
Mar 14, 2012, 02:10 PM
@AIAndy I have given some of the outcomes a culture boost using the tag iGreatWorkCulture. Is the correct tag? It is not showing in the hover text. Have you gotten to the +:) for X turns yet?

In the next day or so I will be updating the SVN with all my new outcomes in place so we can do a full test. I am still missing some text I just found out. ;)

AIAndy
Mar 14, 2012, 03:25 PM
@AIAndy I have given some of the outcomes a culture boost using the tag iGreatWorkCulture. Is the correct tag? It is not showing in the hover text. Have you gotten to the +:) for X turns yet?

In the next day or so I will be updating the SVN with all my new outcomes in place so we can do a full test. I am still missing some text I just found out. ;)
No, that tag does not exist for outcomes. If you want to add culture, use Commerces.
And no, I have not added a +:) for X turns tag yet. The easiest way would be to just the same happiness timer that events use. That will always be +1:) and stacking it on a happy event would just make the timer longer.

Dancing Hoskuld
Mar 14, 2012, 03:35 PM
No, that tag does not exist for outcomes. If you want to add culture, use Commerces.

No problemo - see comment below

And no, I have not added a +:) for X turns tag yet. The easiest way would be to just the same happiness timer that events use. That will always be +1:) and stacking it on a happy event would just make the timer longer.

Sorry, I am having a bad week. Does this mean that I will need to use the event timer some way or does it mean that you will add a tag which I use and you will use the event timer in some way? :confused:

AIAndy
Mar 14, 2012, 03:38 PM
No problemo - see comment below



Sorry, I am having a bad week. Does this mean that I will need to use the event timer some way or does it mean that you will add a tag which I use and you will use the event timer in some way? :confused:
I will add a tag which you use and internally it will use the same timer as events that add +1:) for X turns.

Dancing Hoskuld
Mar 16, 2012, 04:15 PM
OK now for the BIG ask. The outcome system is great for simple missions. Can it be extended for more complex missions?

Currently if you want to add a mission to a unit you need to edit two python files - CvMainInterface.py and GameUtils.py. The latter to put the help text on the button and the former to place the button and the code for the button. Would it be possible to modularise this in some way so that no editing of the files are needed? I know the BUG team would be interested in such a thing.

AIAndy
Mar 17, 2012, 04:21 AM
OK now for the BIG ask. The outcome system is great for simple missions. Can it be extended for more complex missions?

Currently if you want to add a mission to a unit you need to edit two python files - CvMainInterface.py and GameUtils.py. The latter to put the help text on the button and the former to place the button and the code for the button. Would it be possible to modularise this in some way so that no editing of the files are needed? I know the BUG team would be interested in such a thing.
I could add Python callbacks to outcomes.

Dancing Hoskuld
Mar 17, 2012, 05:35 AM
I could add Python callbacks to outcomes.

I don't think any of the ones that exist match. If there was a doMission(MiMissionType, Unit) that probably would give us enough to work with. Anyway it is way past my bed time and the fireworks are over so I should go to bed now. :)

AIAndy
Mar 17, 2012, 06:34 AM
I don't think any of the ones that exist match. If there was a doMission(MiMissionType, Unit) that probably would give us enough to work with. Anyway it is way past my bed time and the fireworks are over so I should go to bed now. :)
I mean a new callback similar to the ones available in events that you would be able to add to outcomes so to make a mission you would make an outcome mission but then add a Python function name to the outcome that would be called when the outcome is executed.

Koshling
Mar 17, 2012, 08:28 AM
I mean a new callback similar to the ones available in events that you would be able to add to outcomes so to make a mission you would make an outcome mission but then add a Python function name to the outcome that would be called when the outcome is executed.

If you do this you also need to add some means for the AI to evaluate the outcome, presum,ably through furtehr XML tagging that decribed what it does in some way that the AI can put a value on.

AIAndy
Mar 17, 2012, 08:36 AM
If you do this you also need to add some means for the AI to evaluate the outcome, presum,ably through furtehr XML tagging that decribed what it does in some way that the AI can put a value on.
Chances are high that Python based outcomes need specific AI anyway.
Currently the auto evaluation is only used in the case of subdued animals.

Koshling
Mar 17, 2012, 09:13 AM
Chances are high that Python based outcomes need specific AI anyway.
Currently the auto evaluation is only used in the case of subdued animals.

Ah ok. I see this as a stopper for v22 then. Can't really have such a major feature utterly unused by the AI in a release.

AIAndy
Mar 17, 2012, 09:46 AM
Ah ok. I see this as a stopper for v22 then. Can't really have such a major feature utterly unused by the AI in a release.
Yes, definitely not something for this release.
I am not entirely sure what exactly DH wants to do with it.

Dancing Hoskuld
Mar 17, 2012, 04:18 PM
Orion Veteran's Immigration and Mine warfare mods add missions to units. The AI for the AI is already there and they do the stuff but the player can't unless a button is added to the screen and calls the same code as the AI uses.

There are a number of interesting mods out there that have this sort of function but it is difficult to merge them at the moment.

BlueGenie
Mar 18, 2012, 11:36 PM
I've noticed something with the outcome when killing an animal, either during combat or when butchering it:
If not building a unit or building in a city, for instance if building Wealth or Research, or if last build item got finished and no new one has been set yet, all hammers from the outcome are simply lost, gone, wasted.

No idea if anything can be done about it but either something should, or something stated about how that happens. Similarly the outcome food going towards city growth rather than worker/settler unit being built should probably also be stated somewhere.

Cheers

Dancing Hoskuld
Mar 28, 2012, 06:16 PM
Is the Outcome XML Woc modular. In particular for animals I would like to allow people the option of escorting their captures back or not.

IE <KillOutcomes>
<Outcome>
<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
<iChance>10</iChance>
<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
<bUnitToCity>1</bUnitToCity>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_HUNTING_KILL</OutcomeType>
<iChance>90</iChance>
<Yields>
<iYield>3</iYield>
<iYield>1</iYield>
<iYield>0</iYield>
</Yields>
</Outcome>
</KillOutcomes>
if they don't and
<KillOutcomes>
<Outcome>
<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
<iChance>10</iChance>
<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
<bUnitToCity>0</bUnitToCity>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_HUNTING_KILL</OutcomeType>
<iChance>90</iChance>
<Yields>
<iYield>3</iYield>
<iYield>1</iYield>
<iYield>0</iYield>
</Yields>
</Outcome>
</KillOutcomes>
if they do.

Normally I would put the do in the main file then have an optional XML file containing just the changes needed for the other option. Normally in WOC it would be

<UnitInfo>
<Class>UNITCLASS_SUBDUED_AARDVARK</Class>
<Type>UNIT_SUBDUED_AARDVARK</Type>
<KillOutcomes>
<Outcome>
<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
<bUnitToCity>1</bUnitToCity>
</Outcome>
</KillOutcomes>
</UnitInfo>

AIAndy
Mar 28, 2012, 06:32 PM
Is the Outcome XML Woc modular. In particular for animals I would like to allow people the option of escorting their captures back or not.
There were three different modularity semantics I had to choose from:

Replace the outcome list if a new one is defined in the module
Merge by position in the list (so first outcome in the module is assumed to correspond to first outcome in the original XML)
Merge by outcome type


1. was the easy solution which is how it currently is. So it assumes that if you specify a KillOutcomes that you want a new outcome list.
The problem with 2. is that merging by number, while easy to implement, is somewhat awkward.
3. has the problem that it is currently allowed to have more than one outcome with the same outcome type in a list.

If we usually have only one outcome with the same type in a list, we can go for 3.

Dancing Hoskuld
Mar 28, 2012, 08:13 PM
What you have is fine. I don't mind copying the whole of kill outcomes for a single variable change. Just so I know is all. I will assume the last loaded is the final values.

I am going to have to do something about sub setting the animals for graphically challenged machines as well.

AIAndy
Mar 31, 2012, 09:48 AM
You can now have temporary happiness (+1 only but you can specify the amount of turns) and property changes in outcomes like this:

<iHappinessTimer>5</iHappinessTimer>
<Properties>
<Property>
<PropertyType>PROPERTY_CRIME</PropertyType>
<iPropertyValue>-10</iPropertyValue>
</Property>
</Properties>

Koshling
Mar 31, 2012, 09:54 AM
You can now have temporary happiness (+1 only but you can specify the amount of turns) and property changes in outcomes like this:

<iHappinessTimer>5</iHappinessTimer>
<Properties>
<Property>
<PropertyType>PROPERTY_CRIME</PropertyType>
<iPropertyValue>-10</iPropertyValue>
</Property>
</Properties>

Did you add the necessary evaluation code to the outcome selection AI you wrote previously?

Also, can outcomes be enabled by civics? If so this could lead to possibilities like 'sacrificing' a military (or worker) unit as an example to the population (one-off-crime reduction) - requires despotism or slavery (say).

AIAndy
Mar 31, 2012, 10:06 AM
Did you add the necessary evaluation code to the outcome selection AI you wrote previously?
For the happiness timer, yes, but not for the property change. Hard to say what value a one time property change has.

Also, can outcomes be enabled by civics? If so this could lead to possibilities like 'sacrificing' a military (or worker) unit as an example to the population (one-off-crime reduction) - requires despotism or slavery (say).
While the code is not yet in for that, it is easy to add.

Koshling
Mar 31, 2012, 10:23 AM
For the happiness timer, yes, but not for the property change. Hard to say what value a one time property change has.

Well, depends on whetehr its applied to a property that is dynamically sourced (like crime), or statically set (like flamability).

In fact that raises the question - does it even WORK for statically sourced properties (think modifier recalc here)? These two types of property are becoming so different that you probably need to add some policign so that its illegal for the XML to mix them on any oparticular property (and the outcome stuff would probably then only be legally applicable to sourced properties??)

As to its value - the AI property evaluator (as used in CvCityAI) gives a number that is intended to be a gold-per-turn equivalent. Therefore the value is:

(CityEval(<equilibrium value> + <outcome value>) - CityEval(<equilibrium value>))*<expected turns to return to equilibrium value>/2

at least assuming the city is near its equilibrium point at the time.

AIAndy
Mar 31, 2012, 10:32 AM
Well, depends on whetehr its applied to a property that is dynamically sourced (like crime), or statically set (like flamability).

In fact that raises the question - does it even WORK for statically sourced properties (think modifier recalc here)? These two types of property are becoming so different that you probably need to add some policign so that its illegal for the XML to mix them on any oparticular property (and the outcome stuff would probably then only be legally applicable to sourced properties??)
Correct, this is only allowed for dynamic properties, not for static. Static, if desired, would require some temporary addition of the value that is recalc safe.

As to its value - the AI property evaluator (as used in CvCityAI) gives a number that is intended to be a gold-per-turn equivalent. Therefore the value is:

(CityEval(<equilibrium value> + <outcome value>) - CityEval(<equilibrium value>))*<expected turns to return to equilibrium value>/2

at least assuming the city is near its equilibrium point at the time.
That sounds good.

AIAndy
Mar 31, 2012, 11:02 AM
I added PrereqCivic to outcome types now.
The AI property evaluator in CvCityAI needs some splitting up before it can be called in that way so that is not yet in.

Koshling
Mar 31, 2012, 11:11 AM
I added PrereqCivic to outcome types now.
The AI property evaluator in CvCityAI needs some splitting up before it can be called in that way so that is not yet in.

I'm going to be bogged down in the pathing engine rewrite for several more days yet - will you do the necessary splitting out, or need me to do that when I get done with the pathing?

AIAndy
Mar 31, 2012, 11:17 AM
I'm going to be bogged down in the pathing engine rewrite for several more days yet - will you do the necessary splitting out, or need me to do that when I get done with the pathing?
I'll do it.

Dancing Hoskuld
Apr 01, 2012, 02:33 PM
From SVN discussion
Updates
Added different costs to outcome missions:

bKill to determine if the unit is consumed (default true)
iCost makes the mission cost gold
PropertyCost adds a cost in properties to the mission (PayerType determines which game object type associated with the unit pays the property cost)

Will you be adding a "turns to accomplish" tag? Acts similar to turns in building improvements? I think that may then be enough to convert some of the WLBO missions as well as one of Katy's mods for explicit city ruin exploration.

AIAndy
Apr 01, 2012, 03:08 PM
From SVN discussion


Will you be adding a "turns to accomplish" tag? Acts similar to turns in building improvements? I think that may then be enough to convert some of the WLBO missions as well as one of Katy's mods for explicit city ruin exploration.
I can do that.
What I added now can also be used to have abilities with a cooldown. Just add a new property like energy or something with a limited constant source on the unit and then add an outcome mission with a cost in that property.

Dancing Hoskuld
Apr 03, 2012, 03:13 PM
It is always when I get around to trying to add something that I find I need something different to what is available.:mischief:

While converting Capt_Blondbeard's Barbarian Envoy mod to outcomes I realised that it

1) can only occur in a barbarian city

2) the probability of the events is modified by the population

3) one result has a number of units joining you as tribute, not just one

4) one result has a random amount of gold paid to you as tribute.

This of course reminded me that the WLBO mod gooddy hut/village also needs its missions limited to a feature as does Kathy's Explore City Ruins.

So can the mission/outcome

1) be limited to only barbarian cities or to a feature such as goody_village (to be added) or city_ruins.

2)call some python code
OR
If city based have a probability (set) based on the population EG
rand value <= 28-2*pop gives outcome 1
28-2*pop < rand value <= 28-2*pop + 20 gives outcome 2
28-2*pop + 20 < rand value <= 28-2*pop + 40 gives outcome 3
else gives outcome 4

Koshling
Apr 03, 2012, 03:15 PM
It is always when I get around to trying to add something that I find I need something different to what is available.:mischief:

While converting Capt_Blondbeard's Barbarian Envoy mod to outcomes I realised that it

1) can only occur in a barbarian city

2) the probability of the events is modified by the population

3) one result has a number of units joining you as tribute, not just one

4) one result has a random amount of gold paid to you as tribute.

This of course reminded me that the WLBO mod gooddy hut/village also needs its missions limited to a feature as does Kathy's Explore City Ruins.

So can the mission/outcome

1) be limited to only barbarian cities or to a feature such as goody_village (to be added) or city_ruins.

2)call some python code
OR
If city based have a probability (set) based on the population EG
rand value <= 28-2*pop gives outcome 1
28-2*pop < rand value <= 28-2*pop + 20 gives outcome 2
28-2*pop + 20 < rand value <= 28-2*pop + 40 gives outcome 3
else gives outcome 4





...or why not have as a posible outcome an EVENTRIGGER. Then use all the (existing) event mechanisms to do what you want...?

Dancing Hoskuld
Apr 03, 2012, 03:22 PM
...or why not have as a posible outcome an EVENTRIGGER. Then use all the (existing) event mechanisms to do what you want...?

Sounds like an excellent solution for the actual outcome. The limit on where it can occur would still need to be in the mission or outcome system still since we are talking about a button on the UI screen for the humans.

Not sure what to do about the AI players. The Barbarian Envoy mod is about getting a barb city to join you or pay tribute (in money or troops) but may backfire. The part of the WLBO mod is about the village left after you explore a goody hut. Incorporating that is much more ambitious and will require the property system as well.;)

I am only working on the Barbarian Envoy in the background.

Edit I am a bit dim this morning, after a late night, and there is no coffee:eek: but I can't see how to achieve what I want with events. As I said I am a bit dim this morning. So I will look at it again later.

AIAndy
Apr 03, 2012, 03:43 PM
Sounds like an excellent solution for the actual outcome. The limit on where it can occur would still need to be in the mission or outcome system still since we are talking about a button on the UI screen for the humans.
Well, the event trigger also defines conditions and the check if an outcome is possible could also include calls to some of the event trigger canTrigger functions.

Koshling
Apr 03, 2012, 03:56 PM
Sounds like an excellent solution for the actual outcome. The limit on where it can occur would still need to be in the mission or outcome system still since we are talking about a button on the UI screen for the humans.

Not sure what to do about the AI players. The Barbarian Envoy mod is about getting a barb city to join you or pay tribute (in money or troops) but may backfire. The part of the WLBO mod is about the village left after you explore a goody hut. Incorporating that is much more ambitious and will require the property system as well.;)

I am only working on the Barbarian Envoy in the background.

Edit I am a bit dim this morning, after a late night, and there is no coffee:eek: but I can't see how to achieve what I want with events. As I said I am a bit dim this morning. So I will look at it again later.

The downside of using an outcome to trigger an event is, as you mention, AI evaluation. Simplest thing (for such complex outcomes that need this much flexibility) is just to resort to an AIWeight on the outcome and hand-tune them. So long as these outcomes are not available on units that have a ton of other different choices of different kinds we'd have to compare against, that shouldn't be too bad.

Dancing Hoskuld
Apr 03, 2012, 03:56 PM
So if I use events the button will appear active for the unit anywhere and pressing it in the wrong place will give the message "You can't do that here." or maybe "I can't do that Dave!". Not very friendly.:mischief:

Oh, well back to the old method of putting it all in CvmainInterface.py which is easier but means the AI doesn't know about it at all, in this case.

Koshling
Apr 03, 2012, 03:59 PM
So if I use events the button will appear active for the unit anywhere and pressing it in the wrong place will give the message "You can't do that here." or maybe "I can't do that Dave!". Not very friendly.:mischief:

Oh, well back to the old method of putting it all in CvmainInterface.py which is easier but means the AI doesn't know about it at all, in this case.

When I suggsted this I hadn't taken in all 4 of your points in the post that it was originally a reply to. This suggestion doesn't help constrain the triggering conditions - it was the other 3 points you made (which were all about the nature of the outcome) I was meaning this as a solution to.

Dancing Hoskuld
Apr 03, 2012, 04:09 PM
When I suggsted this I hadn't taken in all 4 of your points in the post that it was originally a reply to. This suggestion doesn't help constrain the triggering conditions - it was the other 3 points you made (which were all about the nature of the outcome) I was meaning this as a solution to.

As far as I can see I would need one event trigger for each population of the city and a random number to give the actual event. IE I can't see where to adjust the random number to give the event based on the population of the city.

OK I can see where to call the python that does the work. That may work, I give it a try.

EditSo I need1) some way to identify a barbarian city. Would bCity=1 and bNeutralTerritory=1 work?

2) A way to call an event trigger

AIAndy
Apr 03, 2012, 04:45 PM
As far as I can see I would need one event trigger for each population of the city and a random number to give the actual event. IE I can't see where to adjust the random number to give the event based on the population of the city.

OK I can see where to call the python that does the work. That may work, I give it a try.

EditSo I need1) some way to identify a barbarian city. Would bCity=1 and bNeutralTerritory=1 work?

2) A way to call an event trigger
The idea was like this:
An outcome can specify an event trigger (not yet, but I can implement it). The isPossible of the outcome would then in addition to the usual conditions for outcomes call at least some of the canTrigger stuff of the event trigger. The action only appears if there is a possible outcome in the action outcome list and if it specifies and event trigger it will only be possible if the event trigger can trigger.
If the outcome is executed, it will then also trigger the associated event which can among other things also have Python code (although it might be useful to have a separate Python callback for outcomes so you don't always have to go via events).

In regards to population influencing outcome chance, that is something I can add.

EDIT: Btw, Barbarian cities are not neutral territory, they are barbarian territory, which is hostile. I can add a tag there.

Dancing Hoskuld
Apr 16, 2012, 02:07 PM
AIAndy. I created a variable SUBDUE_ANIMAL_AUTO_GOTO_CITY in the A_New_Dawn_GlobalDrfines.XML file to make autobeam an option.

Then tried to use it in the unit infos file outcomes

<KillOutcomes>
<Outcome>
<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
<iChance>10</iChance>
<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
<bUnitToCity>SUBDUE_ANIMAL_AUTO_GOTO_CITY</bUnitToCity>
</Outcome>


but I get the error as shown in the attachment.

AIAndy
Apr 16, 2012, 04:27 PM
AIAndy. I created a variable SUBDUE_ANIMAL_AUTO_GOTO_CITY in the A_New_Dawn_GlobalDrfines.XML file to make autobeam an option.

Then tried to use it in the unit infos file outcomes

<KillOutcomes>
<Outcome>
<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
<iChance>10</iChance>
<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
<bUnitToCity>SUBDUE_ANIMAL_AUTO_GOTO_CITY</bUnitToCity>
</Outcome>


but I get the error as shown in the attachment.
Unfortunately that kind of thing currently only works if it is specifically considered in the XML reading code and the schema.

But thinking about it, since global defines are actually read first, it should be possible to add that behavior to all tags. So if it is the expected int or bool, then use it, otherwise consider it as a global define name and look up the int or bool there.

Dancing Hoskuld
Apr 16, 2012, 06:07 PM
Unfortunately that kind of thing currently only works if it is specifically considered in the XML reading code and the schema.

But thinking about it, since global defines are actually read first, it should be possible to add that behavior to all tags. So if it is the expected int or bool, then use it, otherwise consider it as a global define name and look up the int or bool there.

OK! I just thought I could do a quick option since when I introduced autobeaming back to a city for captured animals I got two responses one at each end of the spectrum. With it optional I could keep both happy.:D

Koshling
Apr 17, 2012, 06:50 AM
OK! I just thought I could do a quick option since when I introduced autobeaming back to a city for captured animals I got two responses one at each end of the spectrum. With it optional I could keep both happy.:D

I'm coming round to it. I sort of feel it's a bit easy-mode, but it's also fantastically useful on certain maps (England on GEM with hunters in Africa and Asia in pre-history lol). This is both a pro and a con argument at the same time (I benefitted HUGELY from it, but it's WAY unrealistic)

Dancing Hoskuld
Apr 17, 2012, 07:15 AM
I'm coming round to it. I sort of feel it's a bit easy-mode, but it's also fantastically useful on certain maps (England on GEM with hunters in Africa and Asia in pre-history lol). This is both a pro and a con argument at the same time (I benefitted HUGELY from it, but it's WAY unrealistic)

I introduced it because the AI was did not seem to take the animals back to cities and use them. They just stayed in stacks with the hunter even when adjcent to their own cultural borders.

I like it for fish but not for land animals.

AIAndy
Apr 17, 2012, 07:19 AM
I introduced it because the AI was did not seem to take the animals back to cities and use them. They just stayed in stacks with the hunter even when adjcent to their own cultural borders.

I like it for fish but not for land animals.
That part is better fixed in the AI code. It stacks up on purpose to protect the animals which I think is only dissolved once they are in cultural territory (and not right next to it).

Dancing Hoskuld
Apr 17, 2012, 07:24 AM
The problem was that I watched a hunter move along their border to get more animals without dropping of the ones it already had. :(

BTW, I have looked further into what I would need in the outcome system to get the Barbarian Envoy to use it. You suggested an event but I keep avoiding understanding them. So that should be my next task, not adding frogs to the animals.

AIAndy
Apr 17, 2012, 07:34 AM
The problem was that I watched a hunter move along their border to get more animals without dropping of the ones it already had. :(

BTW, I have looked further into what I would need in the outcome system to get the Barbarian Envoy to use it. You suggested an event but I keep avoiding understanding them. So that should be my next task, not adding frogs to the animals.
Yes, an event triggered by an outcome but I have not gotten around yet to implement it (I was really low on free time the last two weeks).

Koshling
Apr 17, 2012, 02:54 PM
The problem was that I watched a hunter move along their border to get more animals without dropping of the ones it already had. :(

BTW, I have looked further into what I would need in the outcome system to get the Barbarian Envoy to use it. You suggested an event but I keep avoiding understanding them. So that should be my next task, not adding frogs to the animals.

I think it's set to return to a city and drop off the ones it's protecting when it has 5

Dancing Hoskuld
Apr 21, 2012, 12:01 AM
@AIAndy see outcome problem reported by Joseph_II here (http://forums.civfanatics.com/showpost.php?p=11438590&postcount=934)

AIAndy
Apr 21, 2012, 05:54 PM
Yes, an event triggered by an outcome but I have not gotten around yet to implement it (I was really low on free time the last two weeks).
Event triggering from outcomes is implemented now. You can also have outcome types restricted to barbarian territory and population dependent chance.

Dancing Hoskuld
Apr 21, 2012, 11:40 PM
Thank you.

Dancing Hoskuld
May 04, 2012, 02:00 PM
I have asked before but is it possible to have an outcome tag to identify an improvement or feature that needs to be on the plot for the outcome to happen.

Needed for
Diplomacy with Indigenous Peoples
Exploration of ruins by explorers and adventurers
Exploration of shipwrecks.

AIAndy
May 04, 2012, 03:01 PM
I have asked before but is it possible to have an outcome tag to identify an improvement or feature that needs to be on the plot for the outcome to happen.

Needed for
Diplomacy with Indigenous Peoples
Exploration of ruins by explorers and adventurers
Exploration of shipwrecks.

Yes, but unfortunately my time for modding is very limited at the moment.
I preferably want to get that done with the expression system I am working on.

Dancing Hoskuld
May 04, 2012, 06:25 PM
Yes, but unfortunately my time for modding is very limited at the moment.
I preferably want to get that done with the expression system I am working on.

It is not a problem. I am sure I can find many other things to work on.

Dancing Hoskuld
Jul 05, 2012, 08:33 PM
Hi, I am back working on this:mischief: and need some way to specify the mission can only happen when the unit is on the indigenous people improvement. Any chance? :)

AIAndy
Jul 06, 2012, 01:53 AM
Hi, I am back working on this:mischief: and need some way to specify the mission can only happen when the unit is on the indigenous people improvement. Any chance? :)
Best would be to use the expression system here now to specify when it should be active. I'll add that but I won't get around to it until probably next Tuesday or so (as I am gone for the weekend and my local code version already has all the changes for caches so I need to finish that at the same time).

Dancing Hoskuld
Oct 16, 2012, 02:42 PM
@AIAndy currently I have a number of outcome missions for subdue animals which are the same for almost all subdued animal. Is it possible to have defaults and overrides instead?

Example is the following code that appears in the Unit Infos file for most subdued animals in the actions area
<Action>
<MissionType>MISSION_RECORD_TALE_ORAL</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_RECORD_TALE_ORAL1</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>1</iYield>
</Yields>
<Commerces>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>1</iCommerce>
<iCommerce>0</iCommerce>
</Commerces>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_RECORD_TALE_ORAL2</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>2</iYield>
</Yields>
<Commerces>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>5</iCommerce>
<iCommerce>0</iCommerce>
</Commerces>
</Outcome>
</ActionOutcomes>
</Action>
<Action>
<MissionType>MISSION_ANIMAL_STUDY</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_STUDY1</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>2</iYield>
</Yields>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_STUDY2</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>5</iYield>
</Yields>
</Outcome>
</ActionOutcomes>
</Action>

AIAndy
Oct 16, 2012, 02:46 PM
@AIAndy currently I have a number of outcome missions for subdue animals which are the same for almost all subdued animal. Is it possible to have defaults and overrides instead?

Example is the following code that appears in the Unit Infos file for most subdued animals in the actions area
<Action>
<MissionType>MISSION_RECORD_TALE_ORAL</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_RECORD_TALE_ORAL1</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>1</iYield>
</Yields>
<Commerces>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>1</iCommerce>
<iCommerce>0</iCommerce>
</Commerces>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_RECORD_TALE_ORAL2</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>2</iYield>
</Yields>
<Commerces>
<iCommerce>0</iCommerce>
<iCommerce>0</iCommerce>
<iCommerce>5</iCommerce>
<iCommerce>0</iCommerce>
</Commerces>
</Outcome>
</ActionOutcomes>
</Action>
<Action>
<MissionType>MISSION_ANIMAL_STUDY</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_STUDY1</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>2</iYield>
</Yields>
</Outcome>
<Outcome>
<OutcomeType>OUTCOME_ANIMAL_STUDY2</OutcomeType>
<iChance>100</iChance>
<Yields>
<iYield>0</iYield>
<iYield>0</iYield>
<iYield>5</iYield>
</Yields>
</Outcome>
</ActionOutcomes>
</Action>

Hmm, you mean define default chances, yields and commerces in the outcome type? So you just specify the outcome type and it will use the defaults for that type if you don't override?

Dancing Hoskuld
Oct 16, 2012, 03:26 PM
Hmm, you mean define default chances, yields and commerces in the outcome type? So you just specify the outcome type and it will use the defaults for that type if you don't override?

Yes exactly. It has just been suggested that I adjust the returns for those outcomes which means I need to do it for each animal and that leaves a lot of room for making mistakes. ;)

Thunderbrd
Oct 16, 2012, 04:21 PM
It was really ironic that you guys were posting in here as I was trying to read up on this section to get an idea of what we can/cannot do with these right now.

I get this strong indication this is a wonderful tool overall that can be used for... for just about anything!

But we haven't gotten much of an explanation of what or how to go about getting it to do anything more than create combat results. I'd really like to see this explained in detail from the top down and show us what we can (and specifically what we cannot) do with all this.

Had I understood this better I might've been able to work with this amazing structure for the curing missions as you had insinuated I probably should've done. And with a lot of planning in the works for the Nomadic Start, I'd like to really get a full picture on this.

I suppose I could look at some of the xml, but I figure I'm not going to get a full understanding that way.

The idea that these missions could be tied to events and thus pretty much able to accomplish ANYTHING that way is pretty cool in and of itself, but yeah, how would you work the ai on that? Can these missions be referred to in the dll as part of what an ai routine could seek to initiate under certain conditions? Would I be wrong in presuming it would simply take updating the enums file in the dll to be able to access them like any other mission?

Outside of that, I take it we're developing this out somewhat as we go in terms of: function is needed, thus function is programmed and eventually we should have enough to cover nearly any scenario? Where's a nicely documented list of all of the functions we currently allow here then?

The format on how to make things work here could do for a lot of explanation as well.

I'm not just asking for me but also for future modders who could make great use of this amazing mechanism!

Dancing Hoskuld
Oct 16, 2012, 06:06 PM
I am tying missions to events for all the diplomatic stuff. The one problem I am having is that some missions are defined in the dll and I can't change that. If a unit can give a culture boost, as defined by the XML values, then it must be a Great Artist and get the GA's version of a cultural boost, ie remove all anarchy turns. The only way around it is to remove those values from the XML, I suppose, and put them in the outcome but then how do I pass the info to the event.

AIAndy
Oct 17, 2012, 04:03 AM
It was really ironic that you guys were posting in here as I was trying to read up on this section to get an idea of what we can/cannot do with these right now.

I get this strong indication this is a wonderful tool overall that can be used for... for just about anything!

But we haven't gotten much of an explanation of what or how to go about getting it to do anything more than create combat results. I'd really like to see this explained in detail from the top down and show us what we can (and specifically what we cannot) do with all this.
I guess I should write a tutorial on it.

Had I understood this better I might've been able to work with this amazing structure for the curing missions as you had insinuated I probably should've done. And with a lot of planning in the works for the Nomadic Start, I'd like to really get a full picture on this.

I suppose I could look at some of the xml, but I figure I'm not going to get a full understanding that way.

The idea that these missions could be tied to events and thus pretty much able to accomplish ANYTHING that way is pretty cool in and of itself, but yeah, how would you work the ai on that?
There is some evaluation of outcomes for the AI but that only includes some of the features, mainly those that are already used in missions for subdued animals and that is also the only part of the AI code that it uses that evaluation.

Can these missions be referred to in the dll as part of what an ai routine could seek to initiate under certain conditions? Would I be wrong in presuming it would simply take updating the enums file in the dll to be able to access them like any other mission?
Eh, I see you already added some there. Preferably remove them again.
All behind the last in the enum should be considered outcome missions and referring to a specific one should be avoided (but can be done with the usual name resolution). That is not a very nice solution either but better than updating that enum every time you add an outcome mission.
So in short: Hard coded missions are all at the start of the main mission file, outcome missions are behind it and in modular code.

Outside of that, I take it we're developing this out somewhat as we go in terms of: function is needed, thus function is programmed and eventually we should have enough to cover nearly any scenario? Where's a nicely documented list of all of the functions we currently allow here then?
Well, yes, I originally made the outcome system specifically for animal kill outcomes and it got later extended to outcome missions.
The documentation is limited to what is in this thread at the moment so yes, I'll write a tutorial/reference.

Thunderbrd
Oct 17, 2012, 10:44 AM
Eh, I see you already added some there. Preferably remove them again.
All behind the last in the enum should be considered outcome missions and referring to a specific one should be avoided (but can be done with the usual name resolution). That is not a very nice solution either but better than updating that enum every time you add an outcome mission.
So in short: Hard coded missions are all at the start of the main mission file, outcome missions are behind it and in modular code.
I included those in fear that if I did not, I'd screw up the enumeration by adding the hard coded mission I was adding. So I can still just leave those off then without it causing trouble?

AIAndy
Oct 17, 2012, 10:58 AM
I included those in fear that if I did not, I'd screw up the enumeration by adding the hard coded mission I was adding. So I can still just leave those off then without it causing trouble?
Well, the order needs to be the same in the mission XML as it is in the enum but in both cases the hard coded missions should be before the outcome missions.

Thunderbrd
Oct 17, 2012, 12:11 PM
That won't cause any trouble for savegame compatibility then? Cool... good to know. So I'll try to remember to go back and reorder things this weekend.

AIAndy
Oct 17, 2012, 12:19 PM
That won't cause any trouble for savegame compatibility then? Cool... good to know. So I'll try to remember to go back and reorder things this weekend.
Oh, well, I didn't think about that. Both the order queue and the mission queue can store missions and they are not currently remapped so it will mix the missions there if the order is changed.
So I guess to keep savegame compatibility leave the order as it is.

Koshling
Oct 17, 2012, 12:20 PM
Oh, well, I didn't think about that. Both the order queue and the mission queue can store missions and they are not currently remapped so it will mix the missions there if the order is changed.
So I guess to keep savegame compatibility leave the order as it is.

We should probably add remapping of this type. It's pretty mechanical to do.

ls612
Nov 08, 2012, 04:19 PM
@AIAndy:

I have some questions regarding the Outcome System.

1. Is it possible to put an Outcome on a building right now? IE, if you have a building in a city you can trigger the outcome by pressing a button?

2. Is it possible to give Outcomes cooldowns?

3. How is it currently possible to choose targets for an Outcome? Would it be possible to select a city from a list as a target for an Outcome triggered by a building?

I ask this because I'm thinking about how to implement Cyberwarfare in C2C, and using the Outcome system seems like the idea that would require the least work. To get my initial ideas to work I'd at least need those three things to be possible.

AIAndy
Nov 08, 2012, 04:56 PM
@AIAndy:

I have some questions regarding the Outcome System.

1. Is it possible to put an Outcome on a building right now? IE, if you have a building in a city you can trigger the outcome by pressing a button?
No, outcomes always expect a unit to be the source.

2. Is it possible to give Outcomes cooldowns?
Yes, indirectly. If you want a cooldown on an outcome mission (and I think we talk about outcome missions here) you add a energy/cooldown/whatever property that has a limited constant source and then you give the outcome mission a property cost.

3. How is it currently possible to choose targets for an Outcome? Would it be possible to select a city from a list as a target for an Outcome triggered by a building?
No target selection at the moment.

I ask this because I'm thinking about how to implement Cyberwarfare in C2C, and using the Outcome system seems like the idea that would require the least work. To get my initial ideas to work I'd at least need those three things to be possible.
If buildings get abilities, some new UI should be added to the city screen separately from the unit controls that there are now.
And I also think this would deserve a serious extension of the system with entirely new parts. I would suggest that we go towards adding effects, both one time effects and lasting effects. Currently we have a lot of split parts that have effects: Buildings, civics, traits, promotions, .... There is a lot of code copying in between those parts to apply same effects.
So I would say adding a new system that is about effects with scaling, stacking behavior, triggering addition and removal (so you can also have temporary effects) and outcomes that can apply effects.

Buildings are already used as ways to apply effects but they have neither scaling nor stacking behavior.

ls612
Nov 08, 2012, 05:00 PM
If buildings get abilities, some new UI should be added to the city screen separately from the unit controls that there are now.
And I also think this would deserve a serious extension of the system with entirely new parts. I would suggest that we go towards adding effects, both one time effects and lasting effects. Currently we have a lot of split parts that have effects: Buildings, civics, traits, promotions, .... There is a lot of code copying in between those parts to apply same effects.
So I would say adding a new system that is about effects with scaling, stacking behavior, triggering addition and removal (so you can also have temporary effects) and outcomes that can apply effects.

Buildings are already used as ways to apply effects but they have neither scaling nor stacking behavior.

So what you are saying is that it would require a good amount of work to support, right? Because what you are suggesting is something that has been on my mind for a while now, adding effects (as special buildings now, but if we want to create an Effects object class that's fine too). So this could be used to replace the Pests, Crime, and Pollution buildings is what you are saying?

Also, would this be something you could work on in the V28 cycle?

AIAndy
Nov 08, 2012, 05:17 PM
So what you are saying is that it would require a good amount of work to support, right? Because what you are suggesting is something that has been on my mind for a while now, adding effects (as special buildings now, but if we want to create an Effects object class that's fine too). So this could be used to replace the Pests, Crime, and Pollution buildings is what you are saying?
I don't think there is a need to replace that part as it works well as it is but it would be good to have the framework to do temporary effects or effects that scale with some budget or similar things and also have more options for one time effects for outcomes.

Also, would this be something you could work on in the V28 cycle?
I can do that but I still have very little time at the moment so I am unsure how fast this will progress.

Dancing Hoskuld
Nov 17, 2012, 03:41 PM
I a back working on this stuff again.

Story Tellers (also Bards, Entertainers and Celebrities)currently use the Great Artist mission Great Work which displays the amount of culture going to be added to the value in iGreatWorkCulture adjusted for game speed etc. It also reduces anarchy length.

I can convert it to an outcome that calls an event but would need to know the formula for converting to actual values based on game speed etc. If we reinstate the other entertainer units that means 4 events - no problems but the effect will be invisible to the player and the AI.

Merchant Caravans and Treasure Chestscurrently use the Great Engineer mission Hurry which limits the hurry to the current building being built shows the number of hammers based on game speed. The value is calculated from the two fields iBaseHurry and iHurryMultiplier.

Again I need the formula used to convert those two fields into the actual value based on game speed.

So can anyone tell me the formula for adjusting cultural bomb and hurry production for game speed etc.?

Edit I need the formula for food as well - slaves, prisoners and food caravans.;)

Dancing Hoskuld
Nov 23, 2012, 12:36 PM
Continuing the previous post - is it possible that the values be made to adjust for game speed and map size etc.?

Thunderbrd
Nov 23, 2012, 01:07 PM
Yes, for game speed its easy enough. I'll be working on these tags for you today I think.

Dancing Hoskuld
Nov 23, 2012, 01:20 PM
Yes, for game speed its easy enough. I'll be working on these tags for you today I think.

I don't need new tags (Remember I can use the same tags for the caravans, story tellers etc as I am using in Subdue Animals.) or maybe just one bAdjustToGameSizeAndSpeed or something like it then I can use the existing tags and just say when I wanted them adjusted. For example I want the food and hemmers from kills to be static but the culture and science from study to be adjusted for game speed and map size.

Thunderbrd
Nov 23, 2012, 01:32 PM
I was talking about the tags we were discussing in pms. But the rest of what you want to do requires interaction with the Outcome Mission system which is beyond my realm of expertise.

Are you not wanting the tags we discussed any longer?

Dancing Hoskuld
Nov 23, 2012, 01:45 PM
I was talking about the tags we were discussing in pms. But the rest of what you want to do requires interaction with the Outcome Mission system which is beyond my realm of expertise.

Are you not wanting the tags we discussed any longer?

Sorry, I have not had my coffee this morning and I've run out anyway so I am confused until the shops open. But no I don't need those tags, sorry.

I had an "Ah ha!" moment and realised that most of what I need can already be done using the Outcome system. However that system needs two new tags- iReduceAnarchyLength and
- bScaleToGame

The first reduces the anarchy in a city by up to the number provided. The second scales the outcome results to the Game Speed and map size etc.

Thunderbrd
Nov 23, 2012, 03:04 PM
Fair 'nuff. One less thing for my list then.

Dancing Hoskuld
Feb 08, 2013, 01:18 PM
You mentioned in the code for Story Teller that I should not kill the unit in the code but in the Mission. Except the kill happens on a random number and if it does not get killed it should either return to the Capital or nearest city (again a random number) with improved exp. I can do the random number bit with different outcomes but can I have a set of outcomes where only some kill the unit?

The entertainer units are the first ones where this is optional but the diplomats may also survive their missions and get better at doing missions. IE they are like spies.

I can't see an example in the missions XML which uses a "kill" tag. Which tag is it?

Koshling
Feb 08, 2013, 02:30 PM
Sorry, I have not had my coffee this morning and I've run out anyway so I am confused until the shops open. But no I don't need those tags, sorry.

I had an "Ah ha!" moment and realised that most of what I need can already be done using the Outcome system. However that system needs two new tags- iReduceAnarchyLength and
- bScaleToGame

The first reduces the anarchy in a city by up to the number provided. The second scales the outcome results to the Game Speed and map size etc.

Did these tags go in and get used in the end, or did it wind up as just Python? (the tags are way better when it comes to writing AI, since without hem it has to guess what the Python might do)

Dancing Hoskuld
Feb 08, 2013, 02:44 PM
Did these tags go in and get used in the end, or did it wind up as just Python? (the tags are way better when it comes to writing AI, since without hem it has to guess what the Python might do)

:mischief:Like all my requests for tags they did not get added.:mischief:

AIAndy
Feb 18, 2013, 05:39 PM
You mentioned in the code for Story Teller that I should not kill the unit in the code but in the Mission. Except the kill happens on a random number and if it does not get killed it should either return to the Capital or nearest city (again a random number) with improved exp. I can do the random number bit with different outcomes but can I have a set of outcomes where only some kill the unit?

The entertainer units are the first ones where this is optional but the diplomats may also survive their missions and get better at doing missions. IE they are like spies.

I can't see an example in the missions XML which uses a "kill" tag. Which tag is it?
bKill defaults to true so the current outcome missions kill the unit except for the ones in the nomad demo.
I guess the bKill tag could be moved into the outcome instead of being part of the outcome mission price. But then it cannot default to true because of the animal kill outcomes so the current outcome missions would need to be checked and the tag set.

There is now an Adapt tag for the integer expressions which can be used to adapt to game speed, world size or difficulty.

AIAndy
Feb 19, 2013, 01:52 PM
I have added a tag to reduce anarchy duration to outcomes now. It is an integer expression tag so Adapt could be applied if desired.

AIAndy
Feb 20, 2013, 03:06 PM
Instead of moving the bKill tag I just added an additional bKill tag to the outcomes themselves now so with bKill set to false on the action the unit can be killed specifically in some outcomes with bKill there.
Check the story teller to see how it is done.

Dancing Hoskuld
Mar 06, 2013, 10:43 PM
So what is the parameter passed to the python in <Action>
<MissionType>MISSION_REMOVE_WV_SLAVERY</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_REMOVE_WV_SLAVERY</OutcomeType>
<iChance>100</iChance>
<PythonCallback>doRemoveWVSlavery</PythonCallback>
</Outcome>
</ActionOutcomes>
</Action>

AIAndy
Mar 06, 2013, 11:36 PM
So what is the parameter passed to the python in <Action>
<MissionType>MISSION_REMOVE_WV_SLAVERY</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_REMOVE_WV_SLAVERY</OutcomeType>
<iChance>100</iChance>
<PythonCallback>doRemoveWVSlavery</PythonCallback>
</Outcome>
</ActionOutcomes>
</Action>

An argsList with 3 entries. Only the first matters for action outcomes, which is the unit itself. The other two are for kill outcomes, the owner of the killed unit and the unit type of the killed unit.

Dancing Hoskuld
Mar 07, 2013, 04:04 PM
An argsList with 3 entries. Only the first matters for action outcomes, which is the unit itself. The other two are for kill outcomes, the owner of the killed unit and the unit type of the killed unit.

Ah, I thought 2 but I am getting a message saying it has only 1 parameter provided!
TypeError: doRemoveWVSlavery() takes exactly 2 arguments (1 given)
ERR: Python function doRemoveWVSlavery failed, module CvRandomEventInterface

AIAndy
Mar 07, 2013, 04:09 PM
Ah, I thought 2 but I am getting a message saying it has only 1 parameter provided!
TypeError: doRemoveWVSlavery() takes exactly 2 arguments (1 given)
ERR: Python function doRemoveWVSlavery failed, module CvRandomEventInterface
Pretty much all Python functions called from C++ take only one parameter, a list that contains the actual parameters (the argsList). Check all the many functions in CvRandomEventInterface.py as examples.

Dancing Hoskuld
Mar 07, 2013, 04:15 PM
So I assume the first argument is an integer identifying the unit. Or is it a pointer to the unit?

AIAndy
Mar 07, 2013, 04:19 PM
So I assume the first argument is an integer identifying the unit.
The first element of argsList is a CyUnit object, the unit doing the action for action outcomes or doing the killing for kill outcomes.

AIAndy
Mar 29, 2013, 08:06 AM
Outcome missions and kill outcomes can now be added to unit combat types.
Just add them to the unit combat infos the same way that you would add them to a unit.
They apply to all units that have the unit combat type either as main type or as sub combat type (and it does not matter if the combat type comes from the unit type definition or a promotion).

In the case of outcome missions if a unit has an outcome mission for the same mission type on the unit type and one or more of its combat types, then only the one on the unit type is active.

For kill outcomes the outcomes from the list on the unit type are merged with all those from unit combat types but only one instance of each outcome type is active.

Dancing Hoskuld
Jun 05, 2013, 12:35 PM
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?

AIAndy
Jun 05, 2013, 01:16 PM
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).

Dancing Hoskuld
Jun 05, 2013, 03:30 PM
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).

Thanks. I asked at 3am, at 3:30am as I got into bed I realised the solution.:D

strategyonly
Jun 07, 2013, 04:45 AM
Had this (mission)?

Dancing Hoskuld
Jun 07, 2013, 05:13 AM
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.

ls612
Jun 08, 2013, 10:09 AM
@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

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
Jun 08, 2013, 12:57 PM
@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

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.

ls612
Jun 08, 2013, 01:17 PM
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.

Dancing Hoskuld
Jun 28, 2013, 05:07 PM
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.

Dancing Hoskuld
Aug 22, 2013, 07:11 PM
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)

AIAndy
Aug 23, 2013, 12:52 AM
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.

Dancing Hoskuld
Aug 23, 2013, 01:20 AM
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.

Dancing Hoskuld
Jan 16, 2014, 04:04 PM
@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.

Thunderbrd
Jan 16, 2014, 07:44 PM
@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.

Dancing Hoskuld
Jan 17, 2014, 12:14 AM
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.

Thunderbrd
Jan 17, 2014, 07:18 AM
Yeah there will be some interface issues to address but I believe I can do it from the dll.

Dancing Hoskuld
Jan 17, 2014, 11:14 AM
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
Jan 17, 2014, 12:36 PM
@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.

AIAndy
Feb 15, 2014, 11:38 AM
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:

<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).

alberts2
Feb 15, 2014, 12:26 PM
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.

Thunderbrd
Feb 15, 2014, 02:27 PM
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:

<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).

Forgive my ignorance of the inner workings of the current (or pre-this-change) functioning of the Outcome Mechanism but I have a few questions that may come across as shamefully lacking understanding here.

1) So this enables us to basically program the outcome variables (with python language) right into the xml of the unit, unitcombat, etc itself?
2) What then is the need for referring to a python module at all? What further python will be necessary - it seems to me the whole process can be encapsulated here.
3) How do you compile the 'chances' of an outcome?
4) Is this purely useful in combat results at the moment? Or does it have other potential effects?
5) To what info types do this <Outcome> tag apply to?
6) If a unit is getting an <Outcome> ability from it's base unit info, a combat class, and a promotion, do they in any way seamlessly tally up somehow?

Sorry... again - I'm shamefully confused still on what Outcomes are and how they work (to an extent.) And I'm just trying to get this cleared up for myself.

Dancing Hoskuld
Feb 15, 2014, 02:30 PM
While this is a nice addition I doubt its usefulness. Having one piece of code in a Python module is much easier to maintain than having the same bit of code in each of the 200+ animals for example.

alberts2
Feb 15, 2014, 02:36 PM
While this is a nice addition I doubt its usefulness. Having one piece of code in a Python module is much easier to maintain than having the same bit of code in each of the 200+ animals for example.

If it is the same for e.g. 200 animals it is not usefull but if it would be different for each of them it would be usefull.

AIAndy
Feb 15, 2014, 02:52 PM
Forgive my ignorance of the inner workings of the current (or pre-this-change) functioning of the Outcome Mechanism but I have a few questions that may come across as shamefully lacking understanding here.

1) So this enables us to basically program the outcome variables (with python language) right into the xml of the unit, unitcombat, etc itself?
2) What then is the need for referring to a python module at all? What further python will be necessary - it seems to me the whole process can be encapsulated here.
3) How do you compile the 'chances' of an outcome?
4) Is this purely useful in combat results at the moment? Or does it have other potential effects?
5) To what info types do this <Outcome> tag apply to?
6) If a unit is getting an <Outcome> ability from it's base unit info, a combat class, and a promotion, do they in any way seamlessly tally up somehow?

Sorry... again - I'm shamefully confused still on what Outcomes are and how they work (to an extent.) And I'm just trying to get this cleared up for myself.
1) It mainly allows you to hook some Python into outcomes and have the specific code right in the XML.
2) There is no further Python needed but it is possible to use it.
3) The chance of each outcome is its chance parameter divided by the sum of the chances of the other outcomes or 100 if it is smaller.
4) It applies to both kill outcomes and mission outcomes (which e.g. the subdued animals use) but in general it is mainly an experiment and the pattern can be used anywhere you want to mesh Python and C++.
5) Outcomes can currently be applied to unit types and to unit combat types (in both cases kill outcomes and mission outcomes are possible).
6) The unit has missions for outcomes on the unit combat types and unit types available to it separately. Kill outcome lists on both are combined into one list and then executed.

While this is a nice addition I doubt its usefulness. Having one piece of code in a Python module is much easier to maintain than having the same bit of code in each of the 200+ animals for example.
Mind that for Python this is a module and you can import other modules.
So you could have your main code in some Python module file in the Python folder and then import that into each of these XML parts and call your code with different parameters for instance.

Example:

<Python>
import DHDiplos
def doOutcome(unit, plot, eDefPlayer, eDefUnitType):
DHDiplos.DiploGreeting(unit,plot,150,7,true)
</Python

Dancing Hoskuld
Feb 15, 2014, 03:12 PM
On 5 and 6 - I have tried this out and have it working in some instances but could not get it to work in others. I need to get back to the subdued animals and identify the problems again so you can help me sort it out. If I remember I had moved the "culture" outcome for all "Tales of..." units into the one for that combat class but could not do similar for any other grouping eg I wanted one for sharks and another for whales. I'll try again now that the combat classes have settled down.

edit You know this python in XML may be the solution to a problem I have with the captives settling as slaves....

Thunderbrd
Feb 15, 2014, 05:03 PM
1) It mainly allows you to hook some Python into outcomes and have the specific code right in the XML.
That is just fascinating and far beyond what I would've thought possible or would've seen any usefulness in developing (though I can now that you're providing some examples and good explanations.)
2) There is no further Python needed but it is possible to use it.
Now that makes sense then and tells me I'm not quite as confused as I thought.

3) The chance of each outcome is its chance parameter divided by the sum of the chances of the other outcomes or 100 if it is smaller.
Very clever math. Very clever indeed. I've never considered that sort of random model but it has a lot of benefits to it.

4) It applies to both kill outcomes and mission outcomes (which e.g. the subdued animals use) but in general it is mainly an experiment and the pattern can be used anywhere you want to mesh Python and C++.
hmm... ok. I'd have to look deeper to see how each are applied but it helps me understand the current limits.

5) Outcomes can currently be applied to unit types and to unit combat types (in both cases kill outcomes and mission outcomes are possible).
Not promotions? I thought promos could add to the chances for specified outcomes and from what you say next it would seem to me that it would follow suit that would be the way to get the two to blend into a final total for the unit right?

6) The unit has missions for outcomes on the unit combat types and unit types available to it separately. Kill outcome lists on both are combined into one list and then executed.
So from what I understand, if a given outcome is used on both a combat class and the core unit info then it'll combine into one unified likelihood right?

Now... this also suggests, since we're defining the outcome as a game object itself and calling to that outcome for definition, what if you have differing python on the same outcome between the unitcombat and the unit info? Based on what you show here I'm thinking that might be possible to cause a conflicting result sequence:
<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>

So if I have OUTCOME_BEAR_POWER on both the unit and the unitcombat - on the unit specifying different python processing than it does on the unitcombat, which takes the dominant role then?


Mind that for Python this is a module and you can import other modules.
So you could have your main code in some Python module file in the Python folder and then import that into each of these XML parts and call your code with different parameters for instance.

Example:

<Python>
import DHDiplos
def doOutcome(unit, plot, eDefPlayer, eDefUnitType):
DHDiplos.DiploGreeting(unit,plot,150,7,true)
</Python

wow... truly fascinating indeed.

I'll try again now that the combat classes have settled down.
Hopefully you now have yet more useful definitions available there! And yeah, I think the crust is solidifying on that project pretty well so you shouldn't have to account for strongly drastic adjustments taking place in that realm anytime soon - or ever.

AIAndy
Feb 15, 2014, 05:38 PM
So if I have OUTCOME_BEAR_POWER on both the unit and the unitcombat - on the unit specifying different python processing than it does on the unitcombat, which takes the dominant role then?
They are separate, both has its own chance. The outcome type only applies some extra conditions and allows it to be overridden by some other outcome type specifying that it overrides that outcome type (which would then remove both instances of OUTCOME_BEAR_POWER).

Dancing Hoskuld
Feb 15, 2014, 05:39 PM
Not promotions? I thought promos could add to the chances for specified outcomes and from what you say next it would seem to me that it would follow suit that would be the way to get the two to blend into a final total for the unit right?

There are
- outcome definitions which define the changes promotions has and where the outcome can happen eg hostile territory.

- Missions which define the buttons and

- outcomes and kill outcomes on the unit that link this all to the unit.

Thunderbrd
Feb 15, 2014, 06:21 PM
Ok... makes sense. Thanks to both of you for helping to clarify. Amazingly intricate programming indeed.

strategyonly
Apr 26, 2014, 03:38 AM
@ anyone

what is the difference between these??

<iAmountPerTurn>
<Div>
<Mult>
<AttributeType>ATTRIBUTE_POPULATION</AttributeType>
<Constant>9</Constant>
</Mult>
<Constant>2</Constant>
</Div>
</iAmountPerTurn>

and

<iAmountPerTurn>
<Mult>
<AttributeType>ATTRIBUTE_POPULATION</AttributeType>
<Constant>5</Constant>
</Mult>
</iAmountPerTurn>

schema has this???

<ElementType name="Minus"/>
<ElementType name="Mult"/>
<ElementType name="Div"/>
<ElementType name="IntegrateSum"/>

In the Handicap XML??

Thunderbrd
Apr 26, 2014, 08:12 AM
I believe that's the crime/population right?

The first is saying 9 crime per 2 population while the second is saying 5 crime per population (a touch more than the first).

strategyonly
Apr 26, 2014, 09:00 AM
I believe that's the crime/population right?

The first is saying 9 crime per 2 population while the second is saying 5 crime per population (a touch more than the first).

OK so why would IMMORTAL have the "extra" and then Deity does not?? Looks like every "other" handicap have the extra???

Thunderbrd
Apr 26, 2014, 09:12 AM
the extra?

Looking at the file it shows
Deity: 5 crime per population (which is 10 crime per 2 population right?)
Immortal: 9 crime per 2 population (which is 4.5 crime per population)
Emperor: 4 crime per population (or 8 crime per 2 population)
Monarch: 7 crime per 2 population (3.5 crime per pop)
Prince: 3 crime per population (6 crime per 2 population)
Noble: 5 crime per 2 population (2.5 crime per pop)
Warlord: 2 crime per population (4 crime per 2 population)
Chieftain: 3 crime per 2 population (1.5 crime per pop)
Settler: 1 crime per population (2 crime per 2 population)

if by 'the extra' you mean the bolded part in your above post, this is what's required to express 'per 2 population' so you'll see it in use with every other one, Chieftain, Noble, Monarch, Immortal. Whichever ones don't have just a full integer amount per single population.

strategyonly
Apr 26, 2014, 10:07 AM
the extra?

Looking at the file it shows
Deity: 5 crime per population (which is 10 crime per 2 population right?)
Immortal: 9 crime per 2 population (which is 4.5 crime per population)
Emperor: 4 crime per population (or 8 crime per 2 population)
Monarch: 7 crime per 2 population (3.5 crime per pop)
Prince: 3 crime per population (6 crime per 2 population)
Noble: 5 crime per 2 population (2.5 crime per pop)
Warlord: 2 crime per population (4 crime per 2 population)
Chieftain: 3 crime per 2 population (1.5 crime per pop)
Settler: 1 crime per population (2 crime per 2 population)

if by 'the extra' you mean the bolded part in your above post, this is what's required to express 'per 2 population' so you'll see it in use with every other one, Chieftain, Noble, Monarch, Immortal. Whichever ones don't have just a full integer amount per single population.

So when i make more then the next one and then 3rd one i make MUST have the "extra" constant in it, correct??

Thunderbrd
Apr 26, 2014, 10:12 AM
Yeah, it alternates if you need to use it or not.

Making some additional game difficulties beyond deity are we?

JosEPh_II
Apr 26, 2014, 10:21 AM
the extra?

Looking at the file it shows
Deity: 5 crime per population (which is 10 crime per 2 population right?)
Immortal: 9 crime per 2 population (which is 4.5 crime per population)
Emperor: 4 crime per population (or 8 crime per 2 population)
Monarch: 7 crime per 2 population (3.5 crime per pop)
Prince: 3 crime per population (6 crime per 2 population)
Noble: 5 crime per 2 population (2.5 crime per pop)
Warlord: 2 crime per population (4 crime per 2 population)
Chieftain: 3 crime per 2 population (1.5 crime per pop)
Settler: 1 crime per population (2 crime per 2 population)

if by 'the extra' you mean the bolded part in your above post, this is what's required to express 'per 2 population' so you'll see it in use with every other one, Chieftain, Noble, Monarch, Immortal. Whichever ones don't have just a full integer amount per single population.

From your post then is there a potential problem then with the game engine rounding the levels with x.5 per pop up to the next value? Example chieftain 1.5 the engine would round up to 2 making Chieftain actually equivalent to Warlord. Did anyone check to see if this does occur?

And why such a convoluted flip-flop method? Besides that Hydro stated that Crime base was 4 crime per pop. He had lowered it to 3 at one point because I protested it was climbing too fast. Then "others" started complaining about Crime reducing buildings taking it back down too fast. So he re-upped it back to 4. How does this play into this adjustment?

JosEPh

Thunderbrd
Apr 26, 2014, 12:06 PM
From your post then is there a potential problem then with the game engine rounding the levels with x.5 per pop up to the next value? Example chieftain 1.5 the engine would round up to 2 making Chieftain actually equivalent to Warlord. Did anyone check to see if this does occur?

And why such a convoluted flip-flop method? Besides that Hydro stated that Crime base was 4 crime per pop. He had lowered it to 3 at one point because I protested it was climbing too fast. Then "others" started complaining about Crime reducing buildings taking it back down too fast. So he re-upped it back to 4. How does this play into this adjustment?

JosEPh
This was the final answer to that flip-flopping. We, after some long deliberation as I recall, decided as a group to make the amount of crime per population be determined by the difficulty setting about a year ago.

It's not convoluted, it's a very simple linear mathematical progress from 1 crime per population to 5 crime per population at deity. The game won't round the 1.5 crime per population - rather it's stating, quite specifically, that it's an amount of crime per 2 population - 3 crime for every 2 pop. It means that the 1st pop won't incur added crime but the every second one will add 3. It does have the disadvantage that a clever player knowing very well what setting he's on may decide to keep his population at odd values to minimize the crime levels but in play this is rarely even viable strategically. It also may make it appear at first, with new pop 1 cities, that a harder setting may not be having any crime per population while the previous setting did, but once the city reaches pop 2 it will quickly make up the difference. So there is a little off-handed handicap effect simply for selecting Chieftain, Noble, Monarch, or Immortal level difficulty but it's a very subtle difference in play.

It was either we did it this way or introduce a (decimal) float value over the normal integer usage there and I think AIAndy was reluctant to do that for numerous understandable reasons.

Dancing Hoskuld
Apr 26, 2014, 04:10 PM
So that is the sort of code I need to put on the housing buildings so that they consume Education.

Thunderbrd
Apr 26, 2014, 07:33 PM
Yes but I believe there already IS some education drain by population... And the housing buildings... we had a discussion on that - I'm still pretty sure it would be hard to get a good reflection of what you're trying to achieve there without some further developments but I can't recall quite what I had thought that was at the time... we could certainly re-strike up that conversation.

Dancing Hoskuld
Jun 30, 2014, 02:56 PM
Pre v35 release a bug has been discovered in the Captives outcomes which I can't fix in the XML as far as I can see. The remove slavery etc needs to only be available in your cities. Currently it checks for the building in the city that the unit is in and that the city is friendly. This means that if you are in a city of a vassal, colony or nation you have open borders or better with and they have the building in that city your GP has the option to remove slavery.

alberts2
Jun 30, 2014, 03:27 PM
Pre v35 release a bug has been discovered in the Captives outcomes which I can't fix in the XML as far as I can see. The remove slavery etc needs to only be available in your cities. Currently it checks for the building in the city that the unit is in and that the city is friendly. This means that if you are in a city of a vassal, colony or nation you have open borders or better with and they have the building in that city your GP has the option to remove slavery.


You could try using a PlotCondition for the Outcome.
<Action>
<MissionType>MISSION_REMOVE_WV_CANNIBALISM</MissionType>
<ActionOutcomes>
<Outcome>
<OutcomeType>OUTCOME_REMOVE_WV_CANNIBALISM</OutcomeType>
<iChance>100</iChance>
<PythonCallback>doRemoveWVCannibalism</PythonCallback>
<PlotCondition>
<Is>TAG_OWNED</Is>
</PlotCondition>
</Outcome>
</ActionOutcomes>
</Action>

Dancing Hoskuld
Jun 30, 2014, 05:20 PM
Thanks, I'll try it out. Of course I now need to put it on almost all the missions I have done :D

Oh no, it is not on the mission outcome but every unit that uses that mission outcome. That is even worse to code!. Is it possible to use the same code on the actual outcome definition so it is used for all units?

alberts2
Jun 30, 2014, 11:35 PM
At the moment you have to do it this way. The PlotCondition tag can be used for the whole Action or for every Outcome inside of ActionOutcomes.

Dancing Hoskuld
Jul 01, 2014, 04:59 PM
bCity, bFriendly are on the Outcome definition. Looks like I made the assumption that made it your city. This means I am going to have to go through all the outcome actions and change them all.

Dancing Hoskuld
Jul 07, 2014, 04:28 PM
Yes I am going to have to do this to 100% of the outcomes that are for missions in a city. :(

How do I do an "and" for when I already have a plot condition?

Thunderbrd
Jul 07, 2014, 04:54 PM
I may be able to research the implementation of the bFriendly tag there and adapt a new tag to make it much easier for you - then you can do a mass xml search and replace on notepad to replace the bFriendly tag use.

What you've got ahead is daunting.

AIAndy
Jul 08, 2014, 12:49 AM
Yes I am going to have to do this to 100% of the outcomes that are for missions in a city. :(

How do I do an "and" for when I already have a plot condition?

<PlotCondition>
<And>
<Whatever>You Already Have</Whatever>
<Is>TAG_OWNED</Is>
</And>
</PlotCondition>