Modding Events

Depends on what you mean by events. I normally take that to mean scripted events in Python, but post-BTS it also can refer to random events. For that, you want Solver's guide. :)
 
Depends on what you mean by events. I normally take that to mean scripted events in Python, but post-BTS it also can refer to random events. For that, you want Solver's guide. :)

I know you, G.O.... You pretty much live and die by Python. :p

I just had a look at the EventInfos, EventTriggerInfos, and CIV4GameText_Events_BTS xml files out of curiosity. I'm talking about random events in the game, and how to add more of them. Some of the xml entries refer to some other Python material, but most do not. So my assumption was that perhaps I could create simple random events that require no Python.

True?
 
I know you, G.O.... You pretty much live and die by Python. :p

I just had a look at the EventInfos, EventTriggerInfos, and CIV4GameText_Events_BTS xml files out of curiosity. I'm talking about random events in the game, and how to add more of them. Some of the xml entries refer to some other Python material, but most do not. So my assumption was that perhaps I could create simple random events that require no Python.

True?

But I am trying to migrate to the SDK these days. :)

Yes, you can create events with no Python, though to do some nifty things you will need it. That's why I actually don't like the random events system and prefer to do everything exclusively in Python, except for simple things that are better suited for the XML.

Ironic that I should like Python so much, since when I joined I could not make the mod I wanted right away because I knew no Python... :lol:
 
OK -- very cool info. Just what I needed. Thanks!! I'm surprised the Guide isn't stickied.

One question though -- how can I test new events without having to actually run the game and wait for a chance that new events actually trigger? I could make them automatic (based on your post -- Fierabras) and link them together, one being the prereq for the next... How do you do it?
 
Hi there! Remember working with Warlords 2.08? Those were the days...

I have been busy with CIV Gold for a long time, but recently BTS events have drawn my attention. One thing I like about it, is that you start with XML but once you run into the limitations, you cross-over to Python, which makes it a good introduction to writing Python.

Testing random events can be done to make them non-random by setting

Code:
<iPercentGamesActive>100</iPercentGamesActive>
<iWeight>-1</iWeight>

in the event trigger, so when you have met the requirements, the event will trigger. The linking together of events (by using the <AdditionalEvents> tag) is something I'm going to try soon, but I haven't used it yet. Solver's guide explains the functionality of it.
 
basically if you start a game and make it to turn 5, your events in xml only are fine. It'll crash if their not.
 
Hi there! Remember working with Warlords 2.08? Those were the days...

Sure do!

I have been busy with CIV Gold for a long time, but recently BTS events have drawn my attention. One thing I like about it, is that you start with XML but once you run into the limitations, you cross-over to Python, which makes it a good introduction to writing Python.

...must...resist...temptation... :faint:

Testing random events can be done to make them non-random by setting

Code:
<iPercentGamesActive>100</iPercentGamesActive>
<iWeight>-1</iWeight>

in the event trigger, so when you have met the requirements, the event will trigger. The linking together of events (by using the <AdditionalEvents> tag) is something I'm going to try soon, but I haven't used it yet. Solver's guide explains the functionality of it.

So I set the event as above, it triggers on the very next turn after conditions are met, excluding possibly any other event that also may apply?

Using the event linkage seems to me a must for events that should happen in a pre-set order, short of relying on Python (i.e. putting in a specific calendar date used in a scenario for example).
 
basically if you start a game and make it to turn 5, your events in xml only are fine. It'll crash if their not.

Well, that's pretty straightforward!! Incidentally, you do have to wait 5 turn before any event at all can trigger? Is this modifiable in a GlobalDefines file?
 
well I haven't figured it out 100%, just from my experience with it making my mod crash. But I do know, if your eventsinfo.xml is messed up it'll just crash... Almost always within 5 turns of starting a game, sometimes instantly. Obviously it'll only do this if the actual code is messed up or its calling variables that don't exist, not for just calling wrong variables that do exist. you buying what I'm selling? if not i can maybe explain more

it loads the eventinfos during a game launch, not during all the xml loading, right before the main menu. hence no xml errors on start up.

The eventtriggersinfo.xml will give you XML errors though, so its a piece of cake to debug.

i'm still a learning modder, I don't know about any moddable configurations for this.
 
So I set the event as above, it triggers on the very next turn after conditions are met, excluding possibly any other event that also may apply?

Hmmm, good question, not sure what happens if event triggers have the same conditions.

Using the event linkage seems to me a must for events that should happen in a pre-set order, short of relying on Python (i.e. putting in a specific calendar date used in a scenario for example).

Also not sure if it's possible without Python, but that's what I want to try with

Code:
<AdditionalEvents>
<EventTimes>
 
Yes, good idea and make it modular as well. For an example, check out my Statue of Zeus event XML.
 
Yes, good idea and make it modular as well. For an example, check out my Statue of Zeus event XML.

I'm very happy you did that bit on events. Thanks for the Zeus event. It was very informative ---> actually, it might get me to do something with Python.

(...he says holding a teeny-tiny hammer and staring longingly up a tall mountain)
Anyway... two of the xml files had square symbols instead of carriage returns at the end of records when I opened them with Notepad. Why was that? And also, why did you include the schema file as well? Did you need to modify something in there?
 
"A journey of a thousand miles begins with a single step."

I think I'm using UNIX style CR/LF (carriage return/line feed), which results in the square symbols when you use an editor that doesn't understand it, like Notepad. I would suggest using a multipurpose editor with syntax highlighting. I use Editplus for all my XML and Python modding.

The schema files are not modified, they are just copies of the BTS originals with only the filename changed. They have to be included when using modular XML. Don't ask me why though...

What do you with foreign text material? Just leave nothing at all between pairs of <Foreign></Foreign> tags?

I always include text for the foreign tags (same text as for <English>), otherwise players who play a non-english version will not see text at all and maybe the text will be translated later.
 
"A journey of a thousand miles begins with a single step."

Indeed.

The schema files are not modified, they are just copies of the BTS originals with only the filename changed. They have to be included when using modular XML. Don't ask me why though...

I guess I misunderstood how modular xml actually works. You don't have to cut & paste their contents into the mod's corresponding files? :crazyeye:

I always include text for the foreign tags (same text as for <English>), otherwise players who play a non-english version will not see text at all and maybe the text will be translated later.

Makes sense. Will do.
 
On second thought, it might be easier to start non-modular:

- create a folder for your new mod
- copy Assets/XML/Events/*.*
- append new event triggers and events

If you want to use Python in the events

- copy Assets/Python/EntryPoints/CvRandomEventInterface.py
- append new Python defs
 
Top Bottom