[Religion and Revolution]: Events

@orlanth:

I got another Python exception.
Could you please check that ? :thumbsup:
 

Attachments

  • Civ4ScreenShot0001.JPG
    Civ4ScreenShot0001.JPG
    122.6 KB · Views: 171
@orlanth:

I get another Python exception with the new Event for CattleThieves.
Could you please check and correct that ? :thumbsup:
 

Attachments

  • Civ4ScreenShot0001.JPG
    Civ4ScreenShot0001.JPG
    93 KB · Views: 187
Ok, I uploaded an update to prevent that.

Does anyone know how a python function could be made to add or subtract a unit from the King's expeditionary force? It would be nice to create a way that good relations could decrease the REF slightly while angering the King could increase it.
 
Ok, I uploaded an update to prevent that.

Great. :thumbsup:

Does anyone know how a python function could be made to add or subtract a unit from the King's expeditionary force ?

You could use this:

void addRevolutionEuropeUnit(UnitTypes eUnit, ProfessionTypes eProfession);

It is already made available for Python. :)
(At the player object.)

It is used from the "child" (meaning the colony) and not from the "parent" (meaning the king).

-----------

But actually it does not make a lot of sense. :dunno:
Any unit you would add with that method, would simply be there earlier, because there is always the calculation / comparison:

Needed REF vs. Existing REF

If you add units to Existing REF with an event, the King will simply not increase the REF, until Needed REF is bigger than Existing REF again .
By removing units from REF, it is even worse, because it will directly be replaced again in the next round.
 
Thanks, I see. If the existing REF system would undo any change, I guess that wouldn't be a helpful Event.

Could there be some way to apply a modifier to the "needed REF"? It would be nice if by keeping consistently good relations with the King and completing missions for him, REF will be a bit lower than it would otherwise be. For example, if there's a global variable that applies a modifier to Needed Ref, you could use this to earn a permanent -1 modifier to REF size as a quest reward. While if you often antagonize him and refuse to kiss his ring etc, this REF modifier can become a bit higher than it would be if considering your weapons and Bells alone.

Or does the current Needed REF calculation already take past behavior toward the King somewhat into account?
 
Or does the current Needed REF calculation already take past behavior toward the King somewhat into account?

Indirectly yes. :)
(It takes into account MaxTaxRate, which is mainly affected by Attitude of King.)

Better King Attitude -> lower MaxTaxRate -> lower REF.

Summary:

You can (indirectly) reduce REF by having good realtions to the King.
So everything ok. :thumbsup:
 
I added a Royal Crackdown Event that can trigger when the King's relation with you is at "Furious" and you're not in Revolution. You can either pay a fine to the royal treasury or royal agents will seize Food from your city and burn several Improvements :cry::p , the King's relation then gets adjusted upward by one point. So this adds some consequence for all that disobedience :nono::king: and can also prevent relations from getting stuck permanently at Furious.
 
@orlanth:

I get a Python-Exception with your new event. :(
Could you please check that ?
 

Attachments

  • Civ4ScreenShot0001.JPG
    Civ4ScreenShot0001.JPG
    73.9 KB · Views: 132
@orlanth:

I updated to the current revision, but got some more Python-Exceptions with the new events. :(
 

Attachments

  • Civ4ScreenShot0007.JPG
    Civ4ScreenShot0007.JPG
    87 KB · Views: 168
After a long time of looking at it I can't figure out what would cause that. It uses the exact same syntax as numerous existing events from TAC and vanilla game (canDoTriggerImmigrant, canDoTriggerMotherland, canTriggerPeasantWarPrep etc) but sometimes prints a python exception saying global variable eplayer is not defined, and sometimes causes no exception at all. I will just have to deactivate it for the time being.
 
@orlanth:

I made small correction to CIV4EventInfos.xml.
(Please get current revision.)

----------------------

Here you have an undefined variable (iChoose).

I am not totally sure, what you are trying to do there.
Otherwise I would have fixed it.

Code:
def applyKingAngry(argsList):
	eEvent = argsList[0]
	event = gc.getEventInfo(eEvent)
	kTriggeredData = argsList[1]
	player = gc.getPlayer(kTriggeredData.ePlayer)
	eking = player.getParent()
	king = gc.getPlayer(eking)
	[COLOR="Red"]iYield = gc.getInfoTypeForString(iChoose)[/COLOR]
	player.AI_changeAttitudeExtra(eking, event.getGenericParameter(3))
	king.AI_changeAttitudeExtra(kTriggeredData.ePlayer, event.getGenericParameter(3))
	if event.getGenericParameter(4) == 1 :
		player.NBMOD_IncreaseMaxTaxRate()

----------------------

Here I think it might be better to have that condition after the check if not player.isPlayable().

Code:
def canDoNotInRevolution(argsList):
	pTriggeredData = argsList[0]
	player = gc.getPlayer(pTriggeredData.ePlayer)
	if player.isNative():
		return false
	[COLOR="Red"]king = gc.getPlayer(player.getParent())[/COLOR]
	if not player.isPlayable():
		return false
	if not king.isEurope():
		return false
	if player.isInRevolution():
		return false
	return true

----------------------

A general question:

Sometimes you get the player like this:

Code:
def canTriggerDeliverCoats(argsList):
	...
	ePlayer = argsList[1]
	...
	player = gc.getPlayer(ePlayer)
	...

and sometimes like this:

Code:
def canDoInRevolution(argsList):
	pTriggeredData = argsList[0]
	player = gc.getPlayer(pTriggeredData.ePlayer)
        ...

Are you sure, that both variants work ?

----------------------

The Event Cattle Thieves can be triggered, even if you do not have cattle.
(If you select option 1, you will have negative storage of cattle.)

We probably have the same problem with Horse Thieves.
(The events are very similar.)

I tried to correct it, but I get the same problem again. :confused:

Could you please take a look again, at that event ? :thumbsup:

See screenshot 1 and screenshot 2.
 

Attachments

  • Civ4ScreenShot0001.JPG
    Civ4ScreenShot0001.JPG
    153.4 KB · Views: 217
  • Civ4ScreenShot0002.JPG
    Civ4ScreenShot0002.JPG
    159.4 KB · Views: 191
@orlanth:

I really don't understand why Cattle Thieves can be triggered without YIELD_CATTLE being available in the city ... :confused:
(I cannot find anything wrong in XML or Python.)

It is really easy to test by the way.
Simply put a city directly next to a Native Village (borders touching) and then click through a few rounds.
(The trigger is only activated in 80% of the games, so if it doesn't work, try again with a new game.)
 
@Ray:

I can't understand why that wouldn't work either :confused: Now I've totally redone the python triggers using a different way which also seems like it should work, but still it can be triggered without YIELD_CATTLE being available.

For the KingFurious trigger, I also tried to do a version using the ePlayer = argsList[1] python from other TAC events, but this also had an exception.
 
If you don't mind, I will ask Ronnar - a former colleague from TAC and the one who did most of the TAC events - if he might take a look.
 
@orlanth:

I have noticed that you are trying to use 2 ways of getting player at the same time.
(the second red line is wrong)
Spoiler :

Code:
def canTriggerCattlethief(argsList):
	eEvent = gc.getInfoTypeForString("EVENT_CATTLETHIEF_1")
	event = gc.getEventInfo(eEvent)
	eTrigger = argsList[0]
	ePlayer = argsList[1]
	iCityId = argsList[2]
	[COLOR="Red"]player = gc.getPlayer(ePlayer)[/COLOR]
	city = player.getCity(iCityId)
	iYield = gc.getInfoTypeForString("YIELD_CATTLE")
	[COLOR="Red"]player = gc.getPlayer(kTriggeredData.ePlayer)[/COLOR]
	if not player.isPlayable():
		return false
	if city.isNone():
		return false
	if (city.getYieldStored(iYield) + event.getGenericParameter(1)) < 1:
		return false
	return true


--------------------

Also I have asked Ronnar for help and got some information. :thumbsup:

Methods called by <PythonCanDo> and <PythonCanDoCity> get their parameters very differently.
(Parameters themselves and their order is different.)

This is the way you get the player with <PythonCanDo>:

Code:
kTriggeredData = argsList[0]
player = gc.getPlayer(kTriggeredData.ePlayer)

This is the way you get the player with <PythonCanDoCity>:

Code:
ePlayer = argsList[1]
player = gc.getPlayer(ePlayer)

This is the way you get the city with <PythonCanDoCity>:

Code:
iCity = argsList[2]
city = player.getCity(iCity)

I hope this helps a little. :)
However, I am not sure, if this solves our problem ... :dunno:

Could you please check all our new Events, if the parameters are acquired correctly. :thumbsup:
 
phew.. I've made it use the specific methods for python candocity, and it finally triggers only when Cattle are present in the settlement!
thank you to Ray and Ronnar for the advice:king:

Fantastic !!! :goodjob:
(Thanks for not giving up. :) )

By the way:
I am really looking forward to see more of your great events. ;)
 
@orlanth:

What about these old ideas ?
(Is one of them interesting for you to implement ?)

Spoiler :

1. Deserter from another European Nation caught

Condition:
4 cities and contact to another nation exists.

A deserter from Nation X has been caught while trying to steal some food from one of our farms.

Options:
A) Give this pure man something to eat and a chance to prove himself in our society. (+1 Criminal, -2 relationship to other nation)
B) We must return this criminal to his mother country. (+1 relationship to other nation)

----------------------------------------------------------------

2. Protectionism

Condition:
Market exists in a city.
(Event is unique.)

The traders of your cities are asking you to close the market for foreign goods, to ensure their profits.
They are willing to pay for this favour.

A) Yes of course, we must think about our economy. (-2 relationship to every European player. +100 gold for each city the player has.)
B) No, we cannot do this, good relations to our neighbours are too important.

----------------------------------------------------------------

3. Diplomatic Conference

Condition:
At least 4 other Europeans met. Peace with all of them.
(Event is unique.)

Mylord, there are strong tensions between the European colonies.
Maybe we could act as mediators by having a diplomatic conference in our capitol.
If we do not act, these tensions will probably increase.

A) Tensions, between the other European Nations, that is perfect ! (relations between all European nations -1)
B) We should try to do everything for peace. (-100 gold, relations between all European nations +1, relations of all European nations to player additional +1)

----------------------------------------------------------------

4. Famine in the Mother Country

Condition:
Random.
(Event is unique.)

After a very hard winter the last harvest in the mother country was extremely bad.
Thus there is famine in the mother country.

A) That is very sad, but we cannot do anything about that.
B) Donate food to our mother country. (-50% food in each city, +4 relationship to king.)
C) Sell all food, that we can currently spare. (-50% food in each city, 10 gold for each unit food sold.)

----------------------------------------------------------------

5. Social Unrest

Condition:
City > 10 citizens and >50 Luxury Goods in Storage

Social imbalance has caused several citizens to storm the storages and trying to steal some Luxury Goods.

A) Let them blow off some steam, things will become normal after that again. (-50 Luxury Goods)
B) We cannot allow this to happen. (Social Unrest)

----------------------------------------------------------------

6. Disease spreading at Natives

Condition:
Having contact to a Native Nation and being at peace with them.
City with food > 50.

It seems, as if some of last our Native visitors accidently got infected with a flue and now it is spreading in their village.

A) That is very bad, we will be more careful next time. (-1 relation to Native Civ)
B) We should help our neighbours. (-50 food from city, +1 relation to Native Civ)


Another idea:

Conflict between Cattle Ranchers and Sheep Ranchers

Condition:
Butchery in City and > 100 Cattle and > 100 Sheep in city.
(Event is unique.)

Cattle Ranchers and Sheep Ranchers have started fighting over rights for the best pastures.

A) Side with the Cattle Ranchers and have all Sheep in Town butchered.
(All Sheep in town transformed into Food + Wool.)
B) Side with the Sheep Ranchers and have all Cattle in Town butchered.
(All Cattle in town transformed into Food + Hides.)
C) Throw a party for the town to have them celebrate together and become friends again.
(-50 gold)

Comment:
A) and B) sound good on first sight, but remember, that Sheep and Cattle are livestock and you need some available in city to bread other.
 
Top Bottom