One final question that should do it for this scenario. Does an "or' instead of an "and" between two "if's" work in the macro event language as it is? I'd like to set it so the North Korean Guerillas, complete with an announcement text, happens if the North Koreans research the requisite technology OR a certain turn hits, whichever comes first, but not both. Does anyone know if this can be done?
Hi Patine,
It's not entirely clear what you want to do here, e.g. is it that once one of the two conditions is met that you want to start generating random number of guerrilla units per turn, or that you simply want to allow the North Koreans to start being able to build guerrilla units in their cities once they've either developed the technology or after reaching a specific turn?
In any case, the 'or' is not a code word that can be used in the macro language. You need to use masks.
Here is an example that will randomly generate guerrilla units once one of the two conditions is met:
@IF
RECEIVEDTECHNOLOGY
technology=x ; where x equals the number of the requisite technology in the rules.txt file
receiver=North Korea
@THEN
Flag
Continuous
Who=North Korea
State=On
Flag=0 ; where FLAG 0 is set to state ON
@ENDIF
@IF
TURN
turn=x ; where x equals the turn number
@THEN
Flag
Continuous
Who=North Korea
State=On
Flag=1 ; where FLAG 1 is set to state ON
@ENDIF
@IF
CheckFlag
Who=North Korea
Mask=0b00000000000000000000000000000011 ; mask using the binary method
Count=1; where either FLAG 0 or 1 are set to ON
State=On
@THEN
JUSTONCE
Flag
Continuous
Who=North Korea
State=On
Flag=2 ; where FLAG 2 is set to state ON
TEXT
The citizens of the glorious Democratic People's Republic of Korea rise up in arms to repel the foreign imperialistic invaders.
ENDTEXT
@ENDIF
NOTE: You can also use the hexadecimal method for mask. In the example above the value would be: Mask=0x3
@IF
CheckFlag
Who=North Korea
Flag=2
State=ON
@AND
RANDOMTURN
denominator=x ; where x equals the number of random turns you want the units to be generated on
@THEN
CREATEUNIT
unit=Guerrilla
count=x ; where x equals the number of units you want to create
owner=North Korea
veteran=no
homecity=none
Randomize
locations
x,x
x,x
x,x
x,x
endlocations
@ENDIF