The Land
Posts: 857
Joined: 2/19/2010 Status: offline
|
I'll start with a simple Unit event and illustrate how to chain it to a Decision. I've picked a Unit event because they can have fairly straightforward triggers, and are also easy to test in the game because the results are obvious. Unit events do what they say on the tin: Create units. Each Unit event can create one or more units, of any different kind, for one power. Units may only be placed at friendly resources, and all the event's units will show up at the same time. If you want to have lots of different units arrive at different places and times, then simply use more Unit events. Here is the event. It creates a British Cavalry Division at Tehran. {
#NAME= Iranian Gendarmerie takes the field as a pro-British formation
#POPUP= Iranian Gendarmerie takes the field as a pro-British formation
#IMAGE= Indian_Mobilization.png, IndianCorpsFrance.png, IndianCorpsFrance2.png
#SOUND=
#FLAG= 1
#TYPE= 1
#AI= 0
#LEVEL= 0
; Set global variable condition to always trigger (dummy value)
#GV= 1[1,100]
; Set link value to De1000
#LINK= 1000[1]
#COUNTRY_ID= 112
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_TURN= 0
#FULL_RESEARCH= 0
#DESTINATION_RESOURCE= 248,115
#DATE= 1911/07/01
#FAILSAFE_DATE= 1925/01/01
; 1st Line - UK politically aligned with AG and not surrendered
#VARIABLE_CONDITION= 112 [1] [100] [0]
; dummy condition position
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
#UNIT= 11 [8] [1] [Persian Gendarmerie]
} If you're new to this, then the list of components may look bafflingly long. What do all of these do, and why? The good news is you don't have to understand all of these to have a viable event. Most of it you can just copy forward from this event, or another existing one in the file from the vanilla game. I'll mark the ones you really need to change for your first event with a * Here are some that are fairly simple: #NAME* is the internal name, not displayed to players, so you can use whatever's convenient. #POPUP* is the popup text that displays to players (if any). This must be descriptive. Most of the vanilla events have references to <<TAG>> numbers in localisation files, but just writing text here is much simpler. #IMAGE and #SOUND refer to media. I have been lazy here and left in some media from the event I copied forward to create this one. Later I will have to go back and replace it, as this media is not actually very appropriate for the event. #FLAG is a marker for whether the event is 'default for the campaign'. Safe to keep this as 1. (I have never seen it not be 1!) Next is #TYPE. For now you can just leave it as 1. There is a lot to say about this, but not for this post! Next, two variables about how AI interacts with the event. There is no need to change either of them. #AI controls whether the event fires exclusively for certain AI or multiplayer game types. #LEVEL controls what AI skill level the event fires for. Both of these are mainly for AI-helper events. I recommend just leaving these as 0 until you start to try to balance the game for the AI. Then we have two complex event triggers, one less important, one really important. #GV is another kind of trigger %. You should leave this as [1,100] unless you want to do some advanced things using the Global Variables to create branching event paths. #LINK* means this event is chained to a Decision Event. In this case I have set this to [1000, 1]. That means it will check DE 1000 and this event will only fire if that event was selected. I'll come on to what DE1000 does in the next post! But for now you are safe to change this to [0,0] so the event you create will be possible to test. #TRIGGER is the % or % per turn chance that the event will happen. What this means depends on the #TYPE -but for now leave it at 100. #PRIVATE sets whether the event message appears for the other side in the game. #DISPLAY_TURN defines whether the event happens on the 'Axis' or 'Allied' turns. or if it has a 0 it can appear on either. Usually I'd leave this as 0. #COUNTRY_ID*tells you which Country ID number will benefit from this event. You must, of course, use the ID number not the name. In this case it's 112, meaning United Kingdom. Feel free to pick another country ID! #FULL_RESEARCH states whether the units that appear from this event will appear with upgrades applied, or not. As this event is meant to fire on Turn 1 and the UK has no research, the point is moot. But I set it to 0. #DESTINATION_RESOURCE* is the place that the units will arrive at. You can have several destination resources, the units will try to appear at the top one first. But at least one of the Destination Resources must be controlled by the same side as the country the event is for (defined in #COUNTRY_ID). NB, units can only appear at resources. To find the coordinates of resources, go to the Editor and hover your mouse over the hex you want the units to appear. In this case, (248, 115) is Tehran. Of course in most scenarios Tehran is not controlled by the United Kingdom, so if you're trying this for the first time, pick a resource that makes sense for you! #DATE* is the date the event is first checked on. Again, what this means depends on the #TYPE you set earlier. #DATE will be the date the event happens on, or happens on or after. I've set this to be the start date of the scenario, as I want this unit to appear on turn 1. You are recommended to change this to the start date of whatever scenario you're working on, to make it easy to test. #FAILSAFE_DATE* is the date when the event will trigger if it has never previously triggered. I'd only use this if what I was intending was for the event to happen on or before a specific date (usually you are looking for 'on or after'). As a dummy, put this after the end date of your scenario! Now, finally, we get on to the section that tells you what unit goes where and under what circumstances! We have two Conditions that determine whether the event actually fires: #VARIABLE_CONDITION* is based on country politics. In this case I have 112 [1] [100] [0]: the UK is on the Axis side, fully mobilised, and not surrendered. Those are easy condition to fulfill in the scenario I've made; the UK is already set to be the only fully-mobilised Axis major on turn 1. I suggest updating this so that it checks that the country you defined in COUNTRY_ID is on the side it actually is (1 for Axis/Central Powers, 2 for Allies/Entente). #CONDITION_POSITION would let you define a trigger based on there being a certain number of units near a certain resource. For now, leave this as all 0s. And finally, the Units that will arrive! #UNIT defines a unit that will arrive in the event. If you want more than one unit, add more #UNIT= rows. Each one needs to define a unit type, strength, experience, and optionally a name. 11 [8] [1] [Persian Gendarmerie] means a Cavalry Division at Strength 8 with 1 experience point, called Persian Gendarmerie. The list of Unit Types is towards the top of the event file. Of course the units have to be valid for the resource type. If the resource is a port then you can only tell the event to create naval units. If it's anything other than a port, then only land or air units are possible. If you're experimenting with the event scripts, this post should give you enough info to create a Unit script with a simple trigger that will fire for one nation at the start of the game. Next up: How to chain the event script to a Decision Event so that the unit costs MPPs.
< Message edited by The Land -- 5/9/2020 7:20:13 PM >
_____________________________
|