Page 1 of 1
#CONDITION
Posted: Tue Jun 09, 2020 6:21 am
by El_Condoro
I would like to check if NO MORE than 2 units of a country are within 2 hexes of a hex. I cannot get it to work, though. Is this the correct way?
#CONDITION_POSITION= x,y [2,2] [0,2] [2] [112]
My understanding is that if there are no units, 1 unit or 2 units of country_id 112 within 2 hexes of x,y the script will fire (all other criteria met). With 3 or more units, the script won't fire.
RE: #CONDITION
Posted: Tue Jun 09, 2020 7:46 am
by The Land
ORIGINAL: El_Condoro
I would like to check if NO MORE than 2 units of a country are within 2 hexes of a hex. I cannot get it to work, though. Is this the correct way?
#CONDITION_POSITION= x,y [2,2] [0,2] [2] [112]
My understanding is that if there are no units, 1 unit or 2 units of country_id 112 within 2 hexes of x,y the script will fire (all other criteria met). With 3 or more units, the script won't fire.
While the documentation suggests it might work this way, I don't believe it does. The 'maximum' just doesn't seem to do anything.
If you look at the scripts in game that increase mobilisation if there are less than X units present - there are in fact 2 scripts, one that increases mobilisation if there are more than 0 units, and another one that counteracts the first precisely if there are X or more units.
RE: #CONDITION
Posted: Tue Jun 09, 2020 10:57 am
by El_Condoro
Yes, I think you're right and I've used that approach as a workaround for another script that I use in my campaign. I just did a test with a #CONDITION with units [0,1] - it fired on 0 and 1 as expected but also on 2, so the maximum is not working.
RE: #CONDITION
Posted: Fri Jun 12, 2020 10:45 pm
by El_Condoro
I am wondering if a developer can confirm that #CONDITION_POSITION is working as intended and, if not, whether it can be corrected in an update. It would be such a handy thing if the minimum worked as described. Cheers.
RE: #CONDITION
Posted: Sat Jun 13, 2020 5:17 am
by The Land
ORIGINAL: El_Condoro
I am wondering if a developer can confirm that #CONDITION_POSITION is working as intended and, if not, whether it can be corrected in an update. It would be such a handy thing if the minimum worked as described. Cheers.
since the WW2 title have events which work around the fact it doesn't work, I think we can be confident they know about it

RE: #CONDITION
Posted: Sat Jun 13, 2020 11:55 am
by El_Condoro
I'm sure they know about it but I was hoping it could be made a bit simpler than this workaround.
Goal: show a popup spy report when a city has less than 2 units guarding it.
Workaround:
I have set up a kind of work area in a corner of the map where trade cities are for convoys. It's inaccessible in the game.
1. Set a hex on the work area with ownership of the spying country (Allies)
2. A dummy DE fires on the Axis turn (#AI= 4) that fires a territory.txt entry to change the ownership of the hex to the spying country (this is to make sure if things change with the number of units of 2+ that the popup will not fire)
3. A dummy DE fires on the Allied turn (#AI= 3) to test the number of units present and fires a territory.txt entry to change the ownership of the hex to the spied-on country (Axis) if 2+ units are present in the city
4. The popup fires when the hex has #ALIGNMENT_POSITION of Allied (i.e. the dummy DE in 3. does not fire because there are less than 2 units present)
I am basically using a hex and territory.txt as a toggle.
It works but it's messy!
RE: #CONDITION
Posted: Mon Jun 15, 2020 10:03 am
by BillRunacre
#CONDITION_POSITION= x,y [2,2] [0,2] [2] [112]
The above will fire at different times, sometimes when no units are present, sometimes when 1 is present, and other times when 2 are present.
There isn't currently a way to get a script to fire if there are less than a certain number of units present.
But you can have an event fire if there are a specific number of units present, whether that be 0, 1 or more.
For example, this will only fire if there are 3 British units within the range specified:
#CONDITION_POSITION= x,y [2,2] [3,3] [2] [112]
RE: #CONDITION
Posted: Mon Jun 15, 2020 10:31 am
by pzgndr
ORIGINAL: BillRunacre
There isn't currently a way to get a script to fire if there are less than a certain number of units present.
In a way, there is. I have an East Front garrison requirement for German units in Poland prior to DOW. Basically a check for having a unit on/adjacent to 4 hexes along the Russian border, all at least 2 hexes apart. So if there are not 4 units at the border then an adverse mobilization script triggers. So some clever applications of the #CONDITION_POSITION can possibly achieve the intended goal.
RE: #CONDITION
Posted: Mon Jun 15, 2020 5:57 pm
by El_Condoro
Thanks, Bill. The workaround I mentioned seems to do the trick well (DE sets territory, which is used by various #ALIGNMENT_POSITION checks). The reading I made of the min,max [0,2] was that the script would be definite in its search of between 1-2, not random of 0, 1 or 2.