Is this possible in ToT No2 ?

Palaiologos2

Prince
Joined
Jan 27, 2011
Messages
340
Location
Thessalonique
Is this possible in ToT No2 ?
Can one make a sort of countdown timer via events?
If trigger A is active then a X turns timer is activated, before something occurs. If during those X turns the trigger A ceases to exist the countdown is terminated.

In particular; If the Franks seize Rome and hold it for 50 turns then they get the unit "Emperor of the Romans".
If before those 50 turns the Romans get the city back the countdown is terminated-not haltened.
To get restarted if and when the Franks or any other take the city again.
 
The following should work unless the DELAY counter cannot be interrupted. That I do not know.
Romans=Civ1, Franks=Civ2 etc.


@BEGINEVENTS
@INITFLAG



@IF
TURN
turn=1
@THEN
FLAG
continuous
who=Romans
mask=0b00000000000000000000000011111110
state=off
@ENDIF


@IF
CITYTAKEN
city=Rome
attacker=Romans
defender=Anybody
@THEN
FLAG
continuous
who=Romans
flag=1
state=on
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@THEN
FLAG
continuous
who=Romans
flag=2
state=on
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Civ #3
defender=Anybody
@THEN
FLAG
continuous
who=Romans
flag=3
state=on
@ENDIF

Same for each of other 4 civs


@IF
CITYTAKEN
city=Rome
attacker=Romans
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=1
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Romans
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF



@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=2
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Franks
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Civ #3
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=3
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Civ #3
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF

Same for each of other 4 civs

@IF
CITYTAKEN
city=Rome
attacker=Anybody
defender=Anybody
@THEN
FLAG
continuous
who=Romans
mask=0b00000000000000000000000011111110
state=off
@ENDIF
 
Can one make a sort of countdown timer via events?
Not without, perhaps, some elaborate Mousetrap method - which escapes me at the moment. Don't make me think. I'm getting rusty at Civ2.
The following should work unless the DELAY counter cannot be interrupted. That I do not know.
It can't, so it won't. Once the Delayed event is triggered, it's loaded to memory and there's no changing that, save running delevent.exe on the save and reloading. The event action will execute 50 turns later. If the Franks capture Rome and the Romans take the city back, the counter will not be reset. If the city changes hands several times, without the JustOnce modifier, several free units could be produced, depending on who holds Rome at the time. Add to that the issue of memory space with stacked Delays.

@IF
TURN
turn=1
@THEN
FLAG
continuous
who=Romans
mask=0b00000000000000000000000011111110
state=off
@ENDIF
This event is not necessary, as all Flags are set to off initially. All you need is the @INITFLAG event. What's more, the Continuous modifier is only used to keep flags on. Flags are turned off by removing the Continuous modifier.
 
Thank you very much for your very helpful explanations. :thanx:

The problem may not be insoluble. If the Franks capture Rome and the Romans recapture it fewer than 50 turns later, then the Frankish DELAY event will fire on schedule but nothing will happen because events will not spawn a Frankish unit in a Roman city. That would seem to take care of the simplest case.

However what happens if the Franks capture Rome and start their delay counter; the Romans recapture Rome 10 turns later and start their counter; and 10 turns later, the Franks capture it once more and start their counter a second time?

Will triggering

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=2
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Franks
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF

a second time reset the Frankish counter to 50 or will it remain at 30? I would guess that if it counts down from 50 it will reset to 50. If it counts up from 0, who knows?

I'll run a quick and dirty test as soon as I find some time.



I can never remember if @INITFLAG sets all flags to off or on. :confused:
 
The Romans don't need a counter, they are the legitimate owners.
I am propably gonna get my PC at the end of the week and will do some testing.
 
@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@THEN
FLAG
continuous
who=Romans
flag=2
state=on
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=2
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Franks
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF
This combination of events won't work either because the flag won't be set until the following turn. I kind of skimmed the thread last time around. You would need to remove the CityTaken trigger in the second event. Remove the Continuous modifier from the first event and the flag will switch on for only a single turn.

Not without, perhaps, some elaborate Mousetrap method - which escapes me at the moment. Don't make me think.
Shortly after posting last night, I thought of this ridiculous idea: create a 50-tile long tunnel on a secondary map with a trigger unit at one end. If the Franks take Rome, a barbarian unit with a movement rate of one spawns at the opposite end of the tunnel and a MoveUnit command sends it to the trigger. When the trigger unit is killed the bonus unit is created in Rome. If, at any time, Rome retakes the city, a ChangeTerrain event clears the tunnel. If Rome falls to the Franks again, then another Barbarian unit created, and so on. I've got no idea about the reliability of this method.

If the Franks capture Rome and the Romans recapture it fewer than 50 turns later, then the Frankish DELAY event will fire on schedule but nothing will happen because events will not spawn a Frankish unit in a Roman city.
Providing the Franks don't take it back a second time.

Will triggering

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@AND
CHECKFLAG
who=Romans
flag=2
state=on
@THEN
DELAY
delay=50
CREATEUNIT
unit=XXXXXX
owner=Franks
veteran=yes
homecity=None
locations
x,y coords of Rome
endlocations
@ENDIF

a second time reset the Frankish counter to 50 or will it remain at 30? I would guess that if it counts down from 50 it will reset to 50. If it counts up from 0, who knows?
Assuming we drop the CityTaken trigger (so it'll work), this event will occur 20 turns after the first. The Delayed events are discrete events, and, as such, are loaded into memory separately. They don't share the same turn counter. I hope we're on the same page.
 
Does the City taken command only triggers when a city is actually taken or if is controlled from the beggining?
If the latter is the case then we could tie the trigger with a technology.

For instance:


@IF
CITYTAKEN
city=Rome
attacker=Romans
defender=Anybody
@THEN
GIVETECHNOLOGY
technology=Control of Rome
who=Romans
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@THEN
GIVETECHNOLOGY
technology=Control of Rome
who=Franks
@REMOVETECHNOLOGY
technology=Control of Rome
Who=Romans
@ENDIF

@IF
Technologygiven
technolgy=control of rome
who=franks
@THEN
Delay=50
createunit
unit=xxx
owner=franks
erc...

moreover,
@IF
CityTaken
city=Rome
Attacker=anybody
defender=Franks
@THEN
removetechnology
technology=control of Rome
who=franks
@ENDIF

Won't that cancell the delay;
 
The problem may not be insoluble. If the Franks capture Rome and the Romans recapture it fewer than 50 turns later, then the Frankish DELAY event will fire on schedule but nothing will happen because events will not spawn a Frankish unit in a Roman city. That would seem to take care of the simplest case.

However what happens if the Franks capture Rome and start their delay counter; the Romans recapture Rome 10 turns later and start their counter; and 10 turns later, the Franks capture it once more and start their counter a second time?
[/QUOTE]

Could you tie a flag to a whole event?
like

@IF
TECHNOLOGYGIVEN
technology=Control of Rome
who=Franks
@THEN
FLAG
continuous
who=Franks
flag=1
state=on
@ENDIF
 
so you can have

@IF
Technologygiven
technology=control of Rome
who=Franks
@AND
CHECKFLAG
who=Franks
Flag=1
state=of
@THEN
Delay=50
createunit
unit=xxx
owner=franks
etc...
 
that would affect gameplay as thus;

If the Franks capture Rome they have their countdown timer started. When the 50 turns are over and the city is still in Frankish hands they get the special unit. If however during those 50 turns the Romans got their city back and then the franks recaptured it a second time they won't have a second counter running.
Yes?

If that is the case then i can live with that.
 
To summarize:

@IF
TECHNOLOGYGIVEN
technology=Control of Rome
who=Franks
@THEN
FLAG
continuous
who=Franks
flag=1
state=on
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Romans
@THEN
GIVETECHNOLOGY
technology=Control of Rome
who=Franks
@ENDIF

@IF
Technologygiven
technology=control of Rome
who=Franks
@AND
CHECKFLAG
who=Franks
Flag=1
state=of
@THEN
Delay=50
createunit
unit=xxx
owner=franks
etc...

Will that sequence of events produce the above mentioned gameplay results?
 
and adding a

@IF
CityTaken
city=Rome
Attacker=anybody
defender=Franks
@THEN
removetechnology
technology=control of Rome
who=franks
@ENDIF

to give the Franks a second chance at claiming imperial authority.

@IF
CITYTAKEN
city=Rome
attacker=Romans
defender=Anybody
@THEN
create unit
unit=xxx
owner=Romans
etc...


Just in case the Romans attempt a reconquista.
 
@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Anybody
@THEN
GIVETECHNOLOGY
technology=Control of Rome
who=Franks
@REMOVETECHNOLOGY
technology=Control of Rome
Who=Romans
@ENDIF
Can't use GiveTechnology and TakeTechnology in the same event. There's a copy of macro.txt on my site, if you need a syntax reference.

Will that sequence of events produce the above mentioned gameplay results?
Assuming correct syntax and order of execution, isn't that an over-complicated way of writing:
Code:
@IF
CityTaken
city=Rome
attacker=Franks
defender=Romans
@THEN
JustOnce
Delay
delay=50
CreateUnit
owner=Franks
unit=[UnitName]
veteran=[Whatever]
homecity=[Whatever]
locations
x, y ;Rome
endlocations
@ENDIF

FYI, it's more economical to combine the technology check with the CheckFlag event:
Code:
@IF
CheckFlag
who=Franks
technology=# ;Control of Rome
flag=1
state=on
@THEN

What about something like this:
Code:
@IF
Turn
turn=1
@THEN
Flag
continuous
who=Franks
flag=1
state=on
@ENDIF

@IF
CityTaken
city=Rome
attacker=Franks
defender=Romans
@THEN
JustOnce
Delay
delay=49
Flag
continuous
who=Franks
flag=2
state=on
@ENDIF

@IF
CityTaken
city=Rome
attacker=Anybody
defender=Franks
@THEN
Flag
who=Franks
flag=1
state=off
@ENDIF

@IF
CheckFlag
who=Franks
mask=0b110
count=2 ;same as Threshold, but I use it when this value matches the number of flags checked - for readability.
state=on
@THEN
JustOnce
CreateUnit
owner=Franks
unit=[UnitName]
veteran=[Whatever]
homecity=[Whatever]
locations
x, y ;Rome
endlocations
@ENDIF
If the Franks lose Rome at any point before the 50 turns is up, they forfeit their bonus unit.

and adding a

@IF
CityTaken
city=Rome
Attacker=anybody
defender=Franks
@THEN
removetechnology
technology=control of Rome
who=franks
@ENDIF

to give the Franks a second chance at claiming imperial authority.
Frankish Flag 1 is on. What does this do?
 
@Palaiologos2

I wonder if what you are trying to do is unnecessarily complicated because it tries to cover all possible situations, however unlikely. Perhaps the number of situations that are actually possible and need to be considered can be severely reduced if one looks at the scen as a whole.


It would be helpful to know the main scen parameters:

Is this going to be a single or multiplayer scen?
Will it use single or multiple event files?
How many turns?
What period of Rome's history does it cover?
What civs are included?
What does the "Emperor of the Romans" unit do for whoever holds Rome so that its creation warrants a significant amount of event space?
 
I think i have misunderstood the use of flags. I am only just entering in ToT, being an ardent MGE fan for more than a decade.
I thought "flag" was simply a way to "bookmark" an eventuality. And that bookmark could be checked by the ToT event engine if it is active or not. Which in turn could be an event trigger in itself. Yes?

So why is this necessary?

@IF
Turn
turn=1
@THEN
Flag
continuous
who=Franks
flag=1
state=on
@ENDIF

edit: Ok got it. And what does the "mask" command do?
 
@Palaiologos2

I wonder if what you are trying to do is unnecessarily complicated because it tries to cover all possible situations, however unlikely. Perhaps the number of situations that are actually possible and need to be considered can be severely reduced if one looks at the scen as a whole.


It would be helpful to know the main scen parameters:

Is this going to be a single or multiplayer scen?
Will it use single or multiple event files?
How many turns?
What period of Rome's history does it cover?
What civs are included?
What does the "Emperor of the Romans" unit do for whoever holds Rome so that its creation warrants a significant amount of event space?

I idealize the scenario as both single and multiplayer. In single mode the playable civs will be the Franks, Romans, Persians, Scythians(Slavs, Avars etc) and maybe the Germans and the Turks (i'll see how playtesting goes). Since the player can play as either the Franks(and maybe the Germans) or the Romans(or even the Scythians) the eventuality that Rome falls is high. Plus there will be barbarian hordes all over.
As for the bonus of controlling Rome it will be a wonder and a unique 0 movement nuclear weapon-it supposedly affects AI diplomacy, yes?

Although i am thinking of tying the claims to the Imperial throne with a certain tech level-i.e for the Franks , Germans or whoever to claim the title, they must be sufficiently civilized first. And to the hell with the countdown.


Main problem for my indeciveness is my lack of knowledge of western history in general(being an easterner myself)-i have only begun researching the political background of the Frankish kingdom.
 
@Catfish

Ok i understood the event sequence. But that doesn't cover the chance of the Franks getting the city back, does it?

If i am reading the events correctly, then if the Franks loose the city they have their flag=1 as deactivated, so the last event that checks for both flags can't be fired. When 49 turns from the Frankish capture of Rome pass flag 2 is activated giving the bonus, provided they haven't lost it in the meantime, Yes?

That was my thought of tying the trigger with a tech. The Tech can be removed every time they loose the city and vice versa and its effect is constant according to the event engine(hmmm is it?) , while the capture of the city is a one time only.

So if at the end of those 49 turns the engine checks if the Franks are in possesion of the tech, not of the city, it will fire normally. I think....

The Technologygiven trigger actually checks if the tech is in the possesion of a civ, not the actual point in time they get the tech, yes?
 
I thought "flag" was simply a way to "bookmark" an eventuality. And that bookmark could be checked by the ToT event engine if it is active or not. Which in turn could be an event trigger in itself. Yes?
That's a pretty decent description. I'd recommend you take a look at these articles in the Cradle of Civilization:
An Introduction to Flags
Flags and Masks

And what does the "mask" command do?
It's a way of setting or checking multiple flags (up to 32) at once.

Ok i understood the event sequence. But that doesn't cover the chance of the Franks getting the city back, does it?
Correct. They only get one shot at the bonus unit.

If i am reading the events correctly, then if the Franks loose the city they have their flag=1 as deactivated, so the last event that checks for both flags can't be fired. When 49 turns from the Frankish capture of Rome pass flag 2 is activated giving the bonus, provided they haven't lost it in the meantime, Yes?
Yep. They'll get their unit 50 turns after capturing Rome so long as they maintain control of the city.

That was my thought of tying the trigger with a tech. The Tech can be removed every time they loose the city and vice versa and its effect is constant according to the event engine(hmmm is it?) , while the capture of the city is a one time only.
That's what I thought you were trying to do, but the result was more like the first example I posted.

The Technologygiven trigger actually checks if the tech is in the possesion of a civ, not the actual point in time they get the tech, yes?
Yes, so that trigger (ReceivedTechnology) returns true every turn until you remove it with TakeTechnology.

So far, the only suggestion that complies with the opening post is the secondary map trigger scenario.
 
Yes, so that trigger (ReceivedTechnology) returns true every turn until you remove it with TakeTechnology.

@IF
TECHNOLOGYGIVEN
technology=Control of Rome
who=Franks
@THEN
FLAG
continuous
who=Franks
flag=1
state=on
@ENDIF

@IF
CITYTAKEN
city=Rome
attacker=Franks
defender=Romans
@THEN
GIVETECHNOLOGY
technology=Control of Rome
who=Franks
@ENDIF

@IF
CHECKFLAG
who=Franks
Flag=1
state=on
@THEN
Delay=50
createunit
unit=xxx
owner=franks
etc...


Does that mean that the event sequence above is triggered every turn?
 
Back
Top Bottom