Quote Originally Posted by Suraknar
Hello Scripting Gurus!

A small question here about scripting, I went through some Scripting guides here, but I am affraid I am not catching the essence of the reason of scripting...

So I thought to ask directly..

Is it possible to make some behavior happen following a presice action?

For instance, would it be possible to have some province rebel, trigered by the conquest by a certain faction of another province?

Exemple:

lets say that the germans have advanced in to Britain, and captured a couple of provinces, but not the Britons Capital, in subsequent turns the germans advance and lay siege and then capture the Capital of the Britons (the britons still have another province so this does not eliminate their faction)...yet the initially captured Provinces Rebel against their new masters in a last ditch effort to overthrow the germans from their territory and outraged by the capture of their Capital city...

Is it possible to script triggers like that?
It is possible to make most of the things you want but depending on how you want it the code can be very simple or very complicated.

If you want that cities A and B revert to the Britons if city C is conquered and the Brits still have other cities left, then this is not so difficult to script.

If you want that all the cities ever controlled by the Britons (that is, also the Briton conquests, not only their starting cities) to revert back to them in case city C is conquered, this is still possible but you need to create a permanent record of the cities controlled by Britons. You can do that by marking those cities with a special building ("owned_by_britons"). I am not sure if the AI razes buildings so I cannot tell if this method is 100% reliable.

Now you should also keep in mind that the capital location can change. So if you want the revolt to happen when the current capital is conquered, then you need a way to record which is the current capital. If Britons are played by humans then you need a special building ("Capital") and a house rule that says:
1. Build the special building "Capital" in your capital city
2. When you change your capital raze the building from your former capital and build it in the new capital.

Unfortunately this metod can't work if AI plays the Britons.