Guide to event modding in BtS

In order to build Quests (such as the game's "Build X Buildings" quests) does one HAVE to use Python? Or can such be done with XML?
 
If you want an individual event to be more likely to occur, increase the <iWeight> number relative the all the other event <iWeight> numbers. Make sure too that <iPercentGamesActive> number is where you want it. <iPercentGamesActive>100 means that event can occur in every game.

But if you want more events in a game, that is all events, you need to go to the GlobalDefines.xml file and look for <DefineName>EVENT_PROBABILITY_ROLL_SIDES</DefineName>

The lower that number, the MORE often events will occur.
 
What are some helpful hints on troubleshooting events? Do the log files keep up with this info. I make a slight adjustment to a trigger or an event, then go test it out in python in the worldbuilder, and it just won't work, and I cannot figure out why.

What are some strategies for troubleshooting events?

Any help is appreciated.
 
Aaaargh! Has anyone anywhere in the universe seen the <iNumUnits> tag with something OTHER than 0 or 1?

I want an event to occur if a city has over a dozen or so aircraft in it. I do not want it to fire if it has less than 12. How is that done? What other tags have to be checked?

Solvers event guide is great, but there are so many questions it does not answer.... its very frustrating.
 
According to the guide, <iNumUnits> is used for events which pick a plot. I don't know if this makes a difference for when you want to trigger an event for a city (a city is also on a plot of course), but I think you need at least to have <bUnitsOnPlot> set to 1.

If it doesn't work with XML you can always add some Python to count units of a type or class and hook it up with the <PythonCanDoCity> tag.
 
Thanks Fierabras,

Do you have an example of that use of Python in an event? I am not knowledgable in Python, but I can Frankenstein something together if I have the parts.

Again, thank-you for your feedback.
 
Are you sure you need Python? It seems that a combination of

UnitsRequired
iNumUnits (12)
bUnitsOnPlot (1)

and without bPickCity = 1 should do the trick. If not, have you tested with iNumUnitsGlobal to make sure the event gets triggered?

As I also always Frankenstein my Python together, I want to make sure you need Python...
 
I have been modding and testing some events of my own. When using the console to test events, how do I select which unit or city gets affected by an event that picks a random unit or city?
 
I'm trying to make an events that causes a relations change with ALL other players. Is this possible through the XML, or would I have to write a python code for that?

eh, take the time to read the first 3 posts, maybe?

where solver goes through the events files line by line, for you?

i'll give you a hint- its in the very first post, roughly 3/4s of the way down.

HDK
 
very nice guide, but i am wondering about this tag..

iWeight- is a number that affects the probability of this trigger triggering. Applies to events that are active in this game only (as does everything else). Set to -1 if the trigger needs to always occur if the other conditions are met (for example, triggers that determine quest completion should be with -1).

It is not clear what is the range of numbers that can used here and also wether small numbers mean higher probability or large numbers mean higher probablity.
 
The game does a random check to see if you get an event for this turn.


If that check passes, then it cycles through all the events to find which ones you are allowed to have (meet all prereqs, and hasn't been done yet, or is repeatable).


The game will add up all of the iWeight values for events you are allowed to have during this cycle.


Once it is done, a random number is generated using the sum of all the iWeight values. Then the game cycles through the promotions again, subtracting the iWeight of an event you are allowed to have from the randomly generated number. When the difference becomes negative, then it assigns that event to happen.




So summary is: The larger the weight, the more likely the event is to happen once it becomes a legal event. If I have 9 events possible, with weights 12, 4, 6, 7, 3, 15, 13, 35, 5 each, then it just HAPPENS that they add up to 100, so the weight of each winds up being the percent chance of each being the event I get this turn. Let's say that I get the 35 iWeight event, but it is a non-repeatable event. Next turn I miraculously get another event, and haven't made any more leagel for myself. Now the iWeight values only add up to a total of 65, so figuring out the precise percent chance for each event is a bit trickier, but I can still say that I am most likely to get the 15, and almost as likely to get the 12.
 
The game does a random check to see if you get an event for this turn.


If that check passes, then it cycles through all the events to find which ones you are allowed to have (meet all prereqs, and hasn't been done yet, or is repeatable).


The game will add up all of the iWeight values for events you are allowed to have during this cycle.


Once it is done, a random number is generated using the sum of all the iWeight values. Then the game cycles through the promotions again, subtracting the iWeight of an event you are allowed to have from the randomly generated number. When the difference becomes negative, then it assigns that event to happen.




So summary is: The larger the weight, the more likely the event is to happen once it becomes a legal event. If I have 9 events possible, with weights 12, 4, 6, 7, 3, 15, 13, 35, 5 each, then it just HAPPENS that they add up to 100, so the weight of each winds up being the percent chance of each being the event I get this turn. Let's say that I get the 35 iWeight event, but it is a non-repeatable event. Next turn I miraculously get another event, and haven't made any more leagel for myself. Now the iWeight values only add up to a total of 65, so figuring out the precise percent chance for each event is a bit trickier, but I can still say that I am most likely to get the 15, and almost as likely to get the 12.


ok thanks that is really helpful and informative. But i wonder if you know if there is a maximum number you could use here? 10,000? 1,000,000? etc.
 
Whatever the largest INT value that C++ will handle, I think somewhere in the 2 Billion range.

ok thanks, i ask because i made a simple xml event mod that spreads organic resources like horses and such for an earth map game but found that the event didn't come up as often as i wanted it to even tho it was included in 100% of games. I have increased the roll side prob in global defines and now i can try wanging up the iweight.
 
Back
Top Bottom