Events Thread

yoshi,
I am unclear on how to use the Trigger***.
Do you use it as a wildcard(Like if someones capital is taken(A Schism) You could have the NoSchism event trigger and the Defender would be "TriggerDefender)?
That would come in alot of handy sometimes.
 
The TriggerDefender/TriggerAttacker are a wildcard parameter values that work in conjunction with the Anybody value.

Example:

@IF
CITYTAKEN
city=Rome
attacker=Anybody
defender=Anybody
@THEN
CHANGEMONEY
reciever=TRIGGERDEFENDER
amount=-100
@ENDIF

Note that you can still use trigger defender if you put the defender as the Romans for instance, but it would be redundant because the event would only trigger if the the Roman civ is the defender so it would be the same as writing, 'reciever=Romans.' In other words, if the latter were the case you don't need to use the wildcard.

I'm not sure whether you can use a wildcard (i.e. Anybody) as a parameter value in the NoSchism trigger. Never tried it.

Here's what it says in the Macro:

In the uncommon case when someone captures or destroys the capital city of a large empire (the defender civilization), a schism might occur. In that situation, this trigger does two things. First, it prevents the schism from happening. Second, it activates any actions associated with it.

If you want to try I think you would write the following (I'll use the same action as above):

@IF
NoSchism
Defender=Anybody
@THEN
ChangeMoney
reciever=TRIGGERDEFENDER
amount=-100
@ENDIF


Aside:

In my revious example, using Impassbale terrain as a blockade, I forgot to mention that you can use the optional ExceptionMask parameter in ChangeTerrain (only available in ToT) to change only the Impassable terrain. Just set the maprect coordinates to cover the entire area affected by the blockade --or the entire map-- and set all the switches to 1 except for the Impassable terrain.

Example:

@IF
TURN
turn=45
@THEN
Text
^A new frontier opens up...
EndText
@THEN
ChangeTerrain
terraintype=1 [passable terrain]
ExceptionMask=0b11011111111 [let's say Grassland is impassable]
maprect
x1,y1,x2,y2,x3,y3,x4,y4 [cover whole area of blockade]
@ENDIF

(Note: I've never used the ExceptionMask parameter before so it may not be written out properly.)

BTW, about the CHANGETERRAIN examples in the previous post: possible terraintype values are from 0 (Desert) o 10 (Ocean) (i.e. 11 slots).

---------------------------------------------

Another way of making the unique, immobile unit event from the previous post work is by using cities as triggers. If you use CityTaken it means only land units can trigger the event (as only they can capture cities --with the exception of units with 0 Range; i.e. Helicopters). If you want air units to be able to trigger the event you can use the CityDestroyed trigger. Just set the city to size 1 (make sure to edit Rules.txt so that cities can't grow beyond size 1 without an Aquaduct) and place an immobile unit in it to ensure that there is always something to attack. This means that these cities take the place of the Factory unit only you can name them individually.

The two downsides are that it wastes cities (255 maximum) and they can't be replaced via event.

The upside is that you can use them to create units.

Example:

@IF
CityDestroyed
city=Berlin Industry
owner=Axis
@THEN
Text
^Factories near Berlin destroyed! Berlin's production drops.
EndText
CHANGETERRAIN
terraintype=3 [non-productive terrain]
maprect
x1,y1,x1,y1,x1,y1,x1,y1 [productive square near Berlin]
@ENDIF


For some odd reason ToT's designers decided not to add an attacker parameter.

Not sure if TriggerDefender works with this since the parameter is 'owner' and not' defender.'


-------------------------------

Increased Production through the Building of City any Improvement

@IF
CityProduction
builder=Romans
improvement=62 [Hoover Dam]
@THEN
Text
^Romans build the Hoover Dam! Production increased in all cities.
EndText
CHANGETERRAIN
terraintype=8 [productive terrain]
maprect
x1,y1,x1,y1,x1,y1,x1,y1 [target square]
@ENDIF


Here's a similar example using the unit parameter:

@IF
CityProduction
builder=Romans
unit=Factory
@THEN
Text
^The Romans build a Factory! Production increased in all cities.
EndText
CHANGETERRAIN
terraintype=8
maprect
x1,y1,x1,y1,x1,y1,x1,y1
@ENDIF


The problem with this is that once again, MP neglected to add a 'city' parameter. As a result, you can't specify which city has produced the item, thus limiting location-specific applications of an event using this trigger.

You would use this to trigger a general action. So, if you wanted to change to productive terrain then you would probably have to write out multiple ChangeTerrain events (one for each city) to have an general increase in production.
 
Talked about it in a post at Eivind IV's BK1936 thread.

The main problem with this is that it's only good if you want a particular player to be able to use the canal --allies can't use it (check out the thread and you'll see what I mean). Nevertheless, it makes for a better alternative than using cities when playing in SP mode because the AI will understand that better then cities.
 
I’m baaack….bwahahahaha…heh..uh…heh. Okay that wasn’t funny. Here’s another Event idea before people start throwing vegetables at me:


OMAHA BEACH


There are Bunker units one square apart along the northern coast of France.

Allied Infantry are set to appear at the same coordinates of the Bunkers.

If Allied Bombers destroy the Bunkers, Allied Infantry will start to appear along the coast. Presto.

Solves the problem of not being able to create Marines in Transports (because the program won’t allow land units to be created on Ocean tiles).


@IF
TURN
turn=263
@THEN
Text
^Allies make assault on Normandy!
EndText
CREATEUNIT
owner=Allies
unit=Bomber
veteran=no
homecity=none
locations
64,66
endlocations
@ENDIF

@IF
TURN
turn=every
@THEN
CREATEUNIT
owner=Allies
unit=Infantry
veteran=no
homecity=none
locations
64,64
endlocations
@ENDIF


Note that you can also do this for cities. Just set Allied Infantry to appear in a city. If Allies take the city, the Infantry units will start appearing there. Ensures that the AI will have units there unlike when you use MOVEUNIT –or you could just depend on the AI to move them there (good luck with that).


BTW, if anyone has any questions concerning events or you need help with the application of a certain event in your scenario than post it. I’ll reply ASAP.
 
For all those who complain that the AI doesn’t do a good job of using transports to move units around I have a solution for you (this is also a solution for thos ewho don’t want transports moving about the map when you don’t want them to):


CONVOY INTERCEPTION

Allied Freighter appears in Halifax and is set to go to Britain.

Halifax can only maintain that Freighter unit. Note that the Freighter unit has Halifax as its home city.

Another Freighter is set to appear in Halifax once the first Freighter reaches British waters (5 turns). Once the second Freighter appears in Halifax, the city can no longer maintain the first unit so the first Freighter automatically disbands. (This is to prevent the AI taking over and moving the unit about the map in its usual stupid fashion until its destroyed.)

If the Axis manage to destroy a Freighter unit before it reaches Britain, the Allies will lose production (productive squares are made less productive).

The terrain changes back some time after the sinking of the Freighter unit.


@IF
TURNINTERVAL
interval=5
@THEN
Text
^Allied ships sent out to supply Britain. (You probably wouldn’t include this message.)
Endtext
CREATEUNIT
owner=Allies
unit=Freighter
veteran=no
homecity=Halifax
locations
45,57
endlocations
@THEN
MOVEUNIT
unit=Anyunit
owner=Germans
maprect
44,56,46,56,46,58,44,58
moveto
92,54
numbertomove=ALL
@ENDIF

@IF
UNITKILLED
unit=Freighter
attacker=Axis
defender=Allies
@THEN
Text
^Freight heading for Europe sunk! Britain loses vital War Materiel.
EndText
CHANGETERRAIN
terraintype=2
maprect
88,52,88,52,88,52,88,52
@ENDIF

@IF
TURNINTERVAL
interval=10
@THEN
Text
^British manage to bring production back up to standard.
Endtext
CHANGETERRAIN
terraintype=7
maprect
88,52,88,52,88,52,88,52
@ENDIF

(The last part isn’t as clean but I’m sure you can figure something out. You can employ the Delay modifier if using ToT.)

A simpler alternative to the loss of production is to just cause the Allies to lose gold, but that isn’t nearly as effective:

@IF
UNITKILLED
unit=Freighter
attacker=Axis
defender=Allies
@THEN
Text
^Freight heading for Europe sunk! Britain loses vital War Materiel.
EndText
CHANGEMONEY
receiver=Allies
amount=-300
@ENDIF


Please comment on this stuff. If not for yourself, just to make my own scenario designing much easier by speeding up the rate at which I can filter out errors.
 
civ2 said:
As I said elsewhere:
Very cool way to create an Immortal:
UNITKILLED
Immortal
Anybody...
CREATEUNIT
Immortal
previous (xy) or
capital (xy)
MOVEUNIT
from capital (xy)
to enemy.capital (xy +- 1)
etc...
Must be precised by adequate xy.

So each time you kill the Immortal unit, it reappears at it's original spawn coordinates or at it's owner's capital?

I did this once by editing the Rome scen that ships with the original Civ2: Goths just keep reappearing in Northern Europe so the Romans fight an uphill battle. The catch in this case is that each time the Romans kill a Goth, 2 more Goths appear; so basically, you get 2 for each 1 you kill. Result is a rapidly expanding horde. Of course, the Romans only unleash the horde by destroying an immobile Germanic Village unit--which they have to if they want to expand into Germania.

The main problem you're going to have is that units set to go to x coordinates--MoveUnit essentially forcing the 'GoTo' order on the AI units--can have their orders cleared by the presence of a rival unit in an adjacent sqaure. This means that the Immortal may destroy that 1 enemy unit that cleared it's orders but may then roam the map as the AI just LOVES to do.

One way to ensure that the AI will send units towards a certain UNIT (as opposed to sqaure) is to place one of the AI's units next to the target unit--thus revealing the enemy unit to the AI. The AI will send every non-fortified unit towards that square (including air units--EVEN IF THEY LACK THE FUEL TO GET THERE).

The typical way of getting unit to keep going all the way to the target sqaure is by having the same MoveUnit action every turn. In this case, it means that if the Immortal gets its orders cleared, it may still be given the 'Go To' order again. (Note that the 'Go To' order in AI terms means code:7; i.e. the number sevent appears in the AI units' shield when you reveal the entire map--cheat menu, not option in scenario properties in cheat menu.)

The two problems with this are that a) it will activate all AI units of that civ to go to your capital and that b) if you only want the MoveUnit event at certain times you will have to write a MoveUnit event for each turn that you want the AI's units to go to the enemy capital. (The latter being a mute point if that's what the scen is about. ;) )

Just a note on the MoveUnit action:

MOVEUNIT
unit= [I think all units are affected regardless]
owner=
maprect
x,y,x,y,x,y,x,y
moveto
x,y
numbertomove= [AI frequently ignores number so 'ALL' is best value]


A related event you could do is this so as not to have units re-appearing ad infinitum:

@IF
UNITKILLED
unit=[Leader]
attacker=[player1]
defender=[player2]
@THEN
JUSTONCE
TEXT
^^[Leader] has been killed by the forces of [player1]!
^
^^The [unit1]s of [player2] prepare a massive assault in vengance.
ENDTEXT
CREATEUNIT
unit=[unit1]
owner=[player2]
veteran=yes
homecity=none
locations
x,y
endlocations
@THEN
MOVEUNIT
unit=[unit1]
owner=[player2]
maprect
x,y,x,y,x,y,x,y [somewhere in player2's part of map]
moveto
x,y [player1's capital]
numbertomove=ALL
@ENDIF

(Repeat this event for each unit1 only without the Text part.)


Another thing you could do is create a new unit in each captured city pre-set to go to the next enemy city.

Example:

@IF
CITYTAKEN city=[city1]
attacker=[player1]
defender=[player2]
@THEN
CREATEUNIT
unit=[unit1]
owner=[player1]
veteran=yes
homecity=none
locations
x,y [city1]
endlocations
@THEN
MOVEUNIT
unit=[unit1]
owner=[player1]
maprect
x,y,x,y,x,y,x,y [city1]
moveto
x,y [city2]
numbertomove=ALL
@ENDIF

(When unit1 takes city2 another unit1 will appear there an proceed to city3 and so on.)
 
An even cooler thing:
UNITKILED unit1
creates several unit2 + unit1
UNITKILLED unit2
creates several unit3 + unit2
UNITKILLED unit3
creates lots of unit3

This is like a bacterian attack - the more you kill the even more you get!!!
Would be perfect for Alien BARBARIAN attacks if not...
The stupid (100%) AI never uses even Attack units as the human would do.
It never makes a massive assault trying to destroy you...

BTW would be funny if unit1=catterpilar unit2=cocoon unit3=butterfly and...
unit1 changes into unit2 changes into unit3 spawns unit1 etc...
Like a progressive upgrade.
 
In my TRON I had

UNITKILED Asian Warrior
creates Africa Tribesman

UNITKILLED Africa Tribesman
creates American Indian

UNITKILLED American Indian
creates Asian Warrior

This redistributed the barbarians continuously. Unfortunately, the ANYONE bug prevents its widespread use in any scenario where you can play as more than one tribe.
 
kobayashi said:
In case you were wondering, yes I read this thread once in a while.
You made my day man.

civ2 said:
The stupid (100%) AI never uses even Attack units as the human would do.
It never makes a massive assault trying to destroy you...

That's what my last example was about (i.e. city captured event creates unit in that city set to go to next city): it forces the AI to maintain momentum in an assault that is initiated by the AI itself and not a pre-set event (e.g. creating units at x by x trigger).

BTW would be funny if unit1=catterpilar unit2=cocoon unit3=butterfly and...
unit1 changes into unit2 changes into unit3 spawns unit1 etc...
How do you change them though unless by destroying them?

kobayashi said:
In my TRON I had

UNITKILED Asian Warrior
creates Africa Tribesman

UNITKILLED Africa Tribesman
creates American Indian

UNITKILLED American Indian
creates Asian Warrior

This redistributed the barbarians continuously. Unfortunately, the ANYONE bug prevents its widespread use in any scenario where you can play as more than one tribe.

I hadn't thought of distributing them that way. Nice.
 
i play a lot of scenarios (my deep thanks and gratitude to all your efforts; please keep them coming) but continually run into problems with multiple events files; this is frustrating and sad - all your work ends abruptly and to no avail

so: i play an original Civ2 with the FW patch from this site's download page; W98

the problem: typically, the third or fourth events files have errors; the one exception was Second Front - no errors occurred until the 5th or 6th events file (yes, i played the whole fabulous scene)...i think it was simply a missing "@ENDIF" that i corrected (this might have been the Eagles scen, too)

usually, though, i am too incompetent to find the problem..... or am able to ascertain no such easy solution exists ....this seems to be the case in the fantastic Imperium Roman scen - the text files seem perfect, but the 3rd and 4th events files do not load properly for the Romans (nor the Macedonians or Carthaginians if my memory is right)

this is very frustrating - it can take hours of play to get to the change events turn; i am usually happily engrossed in the defense or expansion of my great nation (in accordance with the divine precepts of the Scen Creator) and am then abandoned by my scen deity by a bug i cannot detect, typically rendering the AI incompetent or denying me the ability to create the units necessary to fulfill the creator's will

this makes me wonder: is there a bug in the change events program? am i missing a patch? do the Scen Gods really play through all the change events turns? (i had to slow down in both the SF and Imperium scenarios in order to stay abreast of history and the events files)

am i really blind to a simple text error in those files?

most important: is there a way to verify an events file before i put hours of play into an otherwise magnificently developed and displayed scenario?

do you Gods need more play-testers? (i am hesitantly volunteering)
 
these bugs you mention are quite atypical.

could be that the FW patch on your plain-Civ2 lets MGE-only scenarios past the gate when it shouldn't. Then there is insufficient memory allocated to the events and parts get lopped off. I suggest you upgrade fully to MGE anyway as most of the good scenarios are MGE-only nowadays.

to manually load the events, you need simply drag the icon of your sav file onto the delevents file in windows to get rid of the embedded events and then make a copy of the correct events file and rename it events.txt. This requires that you know which files were intended for a particular stage and unless you are a seasoned scenarioer who knows how to read the 'change files' code, maybe thats not the right road to take.
 
What do you mean by the "change files code?"

Are you referring to the data in a batch file?
 
ty yoshi

1. the del event copy/paste/open works well...possibly perfectly
2. the MGE requires me to hit the 'enter' button 227 times (?!!) before i can load and begin a game!!!???!@#$%...i think it automatically tries to get on-line and refuses to play until some saturation point is reached.....so i give up on MPG (for now and via the patch offered here and at Apolyton) ((it also makes *.txt and *.wpd documents crash minutes after they are opened))
3."what do i mean by the 'change files code'?" - specifically: i do not know how the dos files are made and set-up tso that they do what they do...though i can open them and check their commands, i do not know what commands majke them depoly in the first place; i do not play around with these, i was simply curious and wondered if there were some command i might recognise as an error (i am just old enough to remember writing race car games in dos that were saved on cassettes!)...regarding the *events/rules/game.txt files in scenes, i am confident that i am competent
4. at the same time, i am not even a pretend programmer....i really do not know what a batch file is supposed to contain or facilitate

..nonetheless, i'm a gamer :)

with sincere thanks for your speedy response and certain prowess,

D
 
eeks...
and kobayashi....
(the one japanese this canadian has known well was named 'yoshi'.....i have erred....

(orders another hecatomb.....and closes farm....
 
1. Ok. BTW, you can get a batch file to automate the delevent function--see other scens that use file swapping. (And also take a look at Mercator's CivSwap program.)
2. ??? (I don't play much MP so I'm not familiar with potential bugs. If you post that problem in the Multiplayer forum, i'm sure someone there cold help.
3. Ok, I'll assume you're referring to batch files. They can cause errors if the new files they swap contain data that does nt correspond to names in the scen (e.g. one of the newly swapped files has a mispelled name in it).
4. Again, check out the more complex scens (e.g. scens that incorporate season change). You should figure ot how it works from example. if you need specific help, just ask.
 
Scenario League Design Tips: Fun with Barbarians
(Events-related stuff is at the bottom of the article.)
I feel it is worth mentioning that I have had great success using ToT to spawn barbarian units of my own design in the "Extra Unit" slots. The above article implies that only certain unit slots permit barbarian units to "stick around" for a while, but the Extra slots seem to do the same. I created hostile alien units for use on ToT's extra maps (Mars and Centaurus, in my game), and once they spawn they do indeed continue to menace.

Just a note.
 
Thanks very much for the tip bud.

You're referring to land barbs right?
 
Back
Top Bottom