No, unfortunately not.Is it possible to make some kind of reloading triggers without clearing fired() and once() things?
No, unfortunately not.Is it possible to make some kind of reloading triggers without clearing fired() and once() things?
import random
def prob(self, iProb):
self.Conditions.appendEntry(CheckRandom(iProb))
return self
class CheckRandom(Conditions):
def __init__(self, iProb):
self.prob = iProb
self.notTurnTrigger = None
def check(self, pContext):
#pContext.debug(("CheckFired.check()", self.binding, self.fired), {})
#if random.random()*100<self.iProb:
return random.random()*100<self.iProb
#else:
#return False
Trigger().player(iEgypt).date(-2990).check(True,False).message("ROFLCOPTER").popup(True).prob(100)
interval( iInterval=1, bRandom=False, bScaling=True )
This Condition makes the Trigger fire at turn intervals by limiting the valid game turns to ones that are equally dividable with the iInterval setting. Note that its not possible to change which actual game turns are valid - only the interval. Also note that the iInterval setting refers to game turn on Normal game speed and that if the last setting is left unchanged (bScaling=True) the interval will change dynamically on other game speeds. (Its roughly 1,5 times the interval on Epic speed and 3 times on Marathon speed, but there will be some unforeseeable rounding issues.) This can however be prevented entirely by changing the setting to False - then the turn interval will be exactly the same on all game speeds.
The second setting (bRandom) can be set to a True value and then the condition will be fired at random intervals. The probability is basically one in the iInterval value on Normal speed. The random interval scales as above on other game speeds.
You mean that you need one Trigger for spawning the city, and then another one that automatically flips it back to a minor player if acquired by a major player?How do I spawn a independent city that mustn't belong to any AI before a coded turn?
As with any PyScenario event you need to define a Trigger for it. Each Trigger has a Target Player and a Target Tile. For flipping cities you use the flip() method. From the API:Please do teach me how to flip cities from AI to Player, AI to minor, Minor to AI, all vice versa .
So flipping London to the English on AD 900 you would go:flip( name=None, eOwner=None, bMinorsOnly=True, bAIOnly=True, bSafe=True )
This Action hands over the reigns of a city to the Target Player. The default way of defining the city - and thereby the Target Tile - is to use the name setting (string). (To define a Target Tile - or a Plot List - are equally valid options.) Actually, if the name setting (string) is used in tandem with other map target definitions, then it will work as a built-in condition. (The city by that name has to be on the Target Tile or within the Plot List.) It is also possible to specify the prerequisite current owner of the city with the eOwner setting.
Only cities belonging to Minor Civs and controlled by the AI are, by default, subject to city flipping. These settings (bMinorsOnly and bAIOnly, respectively) can however be disabled (set to a False value).
Civs losing cities due to flips are by default safe from automatic collapse (bSafe=True), but only if the eOwner setting is also used (set to other value than None).
Trigger("flip London").date(900).flip("London",iEngland)
Trigger("flip London").date(900).flip("London",iEngland,False,False,False)
Trigger("flip London").target(53,54).date(900).flip(None,iEngland)
Trigger("flip London").target(53,54).player(iEngland).date(900).flip()
You mean that you need one Trigger for spawning the city, and then another one that automatically flips it back to a minor player if acquired by a major player?
Spoiler :As with any PyScenario event you need to define a Trigger for it. Each Trigger has a Target Player and a Target Tile. For flipping cities you use the flip() method. From the API:
So flipping London to the English on AD 900 you would go:
There are additional parameters you could use; restricting the flip to minor players only or restricting the flip to AI players only, or to safeguard the current owner from collapse due to the flip. These are all enabled (True) by default, but can easily be disabled (False), like this:Code:Trigger("flip London").date(900).flip("London",iEngland)
Now London will flip regardless of who owns it (minor/major or AI/human) and the previous owner isn't protected from collapse.Code:Trigger("flip London").date(900).flip("London",iEngland,False,False,False)
Note however that the dynamic city names (or player named cities) will disable the flip. If you wanna flip any city on the London tile (regardless of its actual name), then you can define a Map Target instead. Look in the documentation for the various ways of defining one. The important thing is to set the name parameter to a None value, which disables it. An example:
You could do this also, because then the flip() method will simply use all the default parameters:Code:Trigger("flip London").target(53,54).date(900).flip(None,iEngland)
This is a good example of how to build your Triggers; Firstly you name it (optional), then you define a map target, and a player target, then some Condition method(s) and finally you use a Action method (or several).Code:Trigger("flip London").target(53,54).player(iEngland).date(900).flip()
Trigger("flip Example").target(27,38).player(iInca).date(728).flip()
So you wanna script the whole game? I don't think PyScenario is the easiest way to achieve this...Yeah..
Not just back to minor, any AI major city conquered by any another AI Major before the rightful time should be returned automatically to prevent unhistorical event...
No, because the default settings of flip() are:So, if I want to flip a city (27,38) that belong to any (major,minor,etc) to Inca civilization, at 728AD, the code simply goes like this?
Code:Trigger("flip Example").target(27,38).player(iInca).date(728).flip()
Those True values mean that only minor Civs are allowed, and only AI Civs. What you wanna do is set those parameters to False:flip( name=None, eOwner=None, bMinorsOnly=True, bAIOnly=True, bSafe=True )
Trigger("flip Example").target(27,38).player(iInca).date(728).flip(bMinorsOnly=False, bAIOnly=False)
There seems to be no support for this sort of thing. But if you learn Python scripting for real, then you'll be able to do whatever you want. It would be less work for you than it would be for me to rewrite the application.How do I activate the bSafe=True if the player owning (27,38) at 728 is a Major Civs?