I need help with flags!

Which modifier do you use most?

  • @AND

    Votes: 0 0.0%
  • Continuous

    Votes: 0 0.0%
  • Delay

    Votes: 0 0.0%
  • Justonce

    Votes: 5 83.3%
  • Randomize

    Votes: 0 0.0%
  • Delayperflag

    Votes: 0 0.0%
  • None

    Votes: 1 16.7%

  • Total voters
    6
I didn't even know there was a patch. Is it required?
No. We bought ToT clearanced at an Office Depot.
I don't know what version it is.
 
You need the patch --'obsolete format' means obsolete version. Almost all ToT stuff you will find requires v.1.1 patch.
(BTW, what did you use to get that screenshot?)

:lol: Hope I didn't cause you any loss of sleep. I do appreciate the effort though.

The big problem is what happens if the Romans retake the city , lose it, then retake it within the Delay. In other words, the first delay will trigger within the time of the second delay. Talk about a brain-fry!

I was thinking of using some aspect of the MGE solution but the overlapping Delay problem still gets in the way... :cry:
 
(BTW, what did you use to get that screenshot?)

I used paint v2 to save it, and then photosuite to convert it to a *.gif file. That's why the image is streched. My fault for not formatting it first.
 
Perhaps this would work. Then again, it's late and I'm tired.
  1. Citytaken (Oil City) by nonRomans -> set Flag x
  2. CheckFlag x=on -> set Flag y=on
  3. CheckFlag y=on -> ChangeTerrain
  4. CityTaken (Oil City) by Romans -> set Flags x & y = off
    [/list=1]
    IIRC, flags are set at the end of the turn, so two flags should set up a 3 turn delay. If not, use another flag.
 
Thanks. Tried it. Screwed up the CheckFlag (trigger?) --not sure if it's reading properly.

This is one version (doesn't work). See what you can do with it:

@IF
CityTaken
city=Veii
attacker=Anybody
defender=Romans
@THEN
Text
^The Romans have lost control of Veii! Supplies will run out in 3 turns.
EndText
Delay
delay=3
@THEN
Flag
who=Romans
state=On
flag=0
@ENDIF


@IF
CityTaken
city=Veii
attacker=Anybody
defender=Romans
@THEN
Delay
delay=3
CheckFlag
who=Romans
flag=0
State=On
Text
^The Romans have failed to retake Veii. Supplies run out.
EndText
ChangeTerrain
terraintype=2
maprect
23,67,23,67,23,67,23,67
@ENDIF

@IF
CityTaken
city=Veii
attacker=Romans
defender=Anybody
@THEN
Text
^The Romans have retaken control of Veii! Supplies replenished.
EndText
Flag
who=Romans
state=Off
flag=0
@ENDIF
 
This doesn't work?
Code:
@IF
CityTaken
city=Veii
attacker=Anybody
defender=Romans
@THEN
Delay
delay=1
Flag
flag=0
who=Romans
State=On
Text
The Romans have lost control of Veii! Supplies will run out in 3 turns.
EndText
@ENDIF

@IF
CheckFlag
who=Romans
flag=0
State=On
@THEN
Delay
delay=1
Flag
flag=1
who=Romans
State=On
@ENDIF

@IF
CheckFlag
who=Romans
flag=1
State=On
@THEN
Delay
delay=1
Flag
flag=2
who=Romans
State=On
@ENDIF

@IF
CheckFlag
who=Romans
flag=2
State=On
@THEN
ChangeTerrain
terraintype=2
maprect
11,11,11,11,11,11,11,11
Text
The Romans have failed to retake Veii. Supplies run out.
EndText
@ENDIF

@IF
CityTaken
city=Veii
attacker=Romans
defender=Anybody
@THEN
Flag
Continuous
flag=2
who=Romans
State=Off
Text
The Romans have retaken control of Veii! Supplies replenished.
EndText
@ENDIF
 
The first part works (Romans lose city) --except text message is delayed until the next turn. But the delayed CT still triggers even though the Romans have retaken the city within the delay. That happened to me too (though not in the example I posted --because I accidentaly overwrote the previous version).

For some reason CheckFlag isn't ...uh... checking for the flag before triggering the CT action (once Romans retake city).
 
If you can trust the manual, ChangeTerrains are executed before Flag actions. If you retake Veii a turn sooner than you did in your last test, does it still fail? If it does, um, can you devote techs to this event sequence (GiveTech/TakeTech)?
 
Tried it 1 turn sooner (i.e. 1 turn after city taken) and the same thing happened.

Tried taking the city in the same turn that the city is lost (i.e. before the first text message appears) and the same thing happened --I still got the message telling me the Romans have lost the city even though they had already retaken it.

Devote techs? You mean use the tech trigger to set the first flag? Well I'm open to anything so feel free to post whatever it was that you had in mind.
 
Don't have much time and haven't had any coffee, so this is probably flawed (e.g. too many techs and doesn't work any better than flags). Uses the same idea as the flag sequence.

CityTaken Veii by enemy -> GiveTech x to Romans
ReceivedTech x -> GiveTech y to Romans
ReceivedTech y -> GiveTech z to Romans
ReceivedTech z -> ChangeTerrain

CityTaken Veii by Romans -> TakeTechs x,y,z
 
I think I know why your example didn't work, and with the techs it probably won't work either... There are two problems:

1. When Veii is retaken you only reset flag 2. Since flag 1 is still on, the earlier CheckFlag event will be triggered again, and turn flag 2 back on again. So you'd need to use a mask to reset all 3 flags. It isn't possible to use JustOnce either, since you'd want this to work every time Veii is taken.

2. Regardless of the above problem, it won't work even then... With the delayed events, the flag will only be set next turn. This whole contraption is only applicable before the 3 delays run out, so there will always be a flag that's still in delay. Even if you reset the 3 flags, one of them will always be turned on again the next turn. So the supplies will always run out.

What I was thinking earlier... There is no way to prevent those supplies from running out. Instead of trying to prevent it, accept it will happen, but add another event that counters it, and turns the terrain right back again.

Oh, and since there is no way to prevent it, you should not add a text message when it happens, but only use the changeterrain. The initial warning when the city is taken should be enough.

Unfortunately, I'm not entirely sure how that should be realised in actual events yet... It should probably involve an event delayed by 3 turns that sets a flag and changes terrain (removes supplies). Another event that sets another flag when the city is recaptured. Thirdly, an event that changes terrain (adds supplies) when both those flags are set... I'm not sure if that's all it takes.
 
Even if you reset the 3 flags, one of them will always be turned on again the next turn.
:cry:

I'm still being stubborn about this. :wallbash:

How about this one?

CityTaken Veii by enemy -> Flag 1 on continuous
CityTaken Veii by enemy -> Delay 3, Flag 2 on (not continuous?)

CityTaken Veii by Romans -> Flag 1 off continuous
CheckFlag 1 off -> Flag 2 off (necessary?)

CheckFlag 1 on @AND CheckFlag 2 on -> ChangeTerrain
  • If the Romans don't retake Veii, both flags will be on in 3 turns.
  • If they do, only Flag 2 will turn on - not enough for the ChangeTerrain.
Well, do you think it'll work? :cringe:
 
OK... I've had a try at that and came up with this. It seems to sort of work, except the delay doesn't work properly. :confused:

Because the delay doesn't work, I couldn't really test it for when the city changes hands more than once either...

Code:
@BEGINEVENTS
@DEBUG
@INITFLAG

@IF
CityTaken
city=Veii
attacker=AnyBody
defender=Romans
@THEN
Flag
Continuous
who=Romans
state=On
flag=0
@ENDIF

@IF
CityTaken
city=Veii
attacker=AnyBody
defender=Romans
@THEN
Delay
delay=3
Flag
who=Romans
state=On
flag=1
@ENDIF

@IF
CityTaken
city=Veii
attacker=Romans
defender=AnyBody
@THEN
Flag
Continuous
who=Romans
state=Off
flag=0
@ENDIF

@IF
CityTaken
city=Veii
attacker=Romans
defender=AnyBody
@THEN
ChangeTerrain
terraintype=2
exceptionmask=0b10000000000
maprect
20,20,20,20,20,20,20,20
@ENDIF

@IF
CheckFlag
who=Romans
state=On
mask=0b00000000000000000000000000000011
threshold=2
@THEN
ChangeTerrain
terraintype=0
exceptionmask=0b10000000000
maprect
20,20,20,20,20,20,20,20
@ENDIF

@ENDEVENTS
 
I think the delay is 1, but a flag takes until next turn to be set anyway, doesn't it? So it seems as if the whole delay event doesn't do anything at all, and the final checkflag event simply triggers with just one flag on, rather than two flags (and I've also tried it with "count=2").
 
but a flag takes until next turn to be set anyway, doesn't it?
Yeah, I'm pretty sure that's true. Perhaps because it's so late in the sequence that it might as well be next turn.

Maybe we're missing something. :spank: From the manual (p214):
DelayPerFlag: This is the flag modifier, which allows you to delay the actions in an event a number of turns based on the state of selected flags. It's similar to the Delay modifier, and like Delay it belongs in the action portion of the event. BaseDelay is a constant; the actions will always be delyed by at least this number of turns...
Is the following the unwritten corollary? "Delay does not work with flags. Use DelayPerFlag."

Delay works well with other actions in EA, although it often appears to be ignored if its not immediately following @THEN. Randomize, on the other hand, is anything but random. English Patient noted that the distribution is highly weighted toward short delays. Anecdotally, I'd wholeheartedly agree.

So, perhaps evaluating two flags and using DelayPerFlag for one of them could work. Right? :cringe:
 
Originally posted by Boco
Is the following the unwritten corollary? "Delay does not work with flags. Use DelayPerFlag."

No, I don't think so. DelayPerFlag isn't just the Delay action for when you're using flags, it actually delays depending on the state of flags, and that's not what I'm doing.

So, perhaps evaluating two flags and using DelayPerFlag for one of them could work. Right? :cringe:

Well, there's also the "perflagdelay", so assuming that works, there's no need for extra flags.
 
DelayPerFlag isn't just the Delay action for when you're using flags
Yes, the PerFlagDelay argument for DelayPerFlag depends on flag status, but I thought the BaseDelay argument was the Delay action for flags regardless of status. :confused:
 
Um... I'm not sure I'm getting you.

The Delay and DelayPerFlag actions are simply two ways of adding a delay to an event, the latter using flags for a possibly variable delay. Of course, it's also possible to have a fixed delay with DelayPerFlag, if you only use the basedelay and only ever have the same amount of flags set... So um, I think Delay does work with flags (in the same event structure), it's just that it doesn't use them to determine the length of the delay, unlike DelayPerFlag.
 
Back
Top Bottom