Page 1 of 1

Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Tue Aug 01, 2023 8:37 am
by DarkHorse2
I have 4 seperate script blocks in popup.txt that update map symbols based on number of units within 10 hexes of Warsaw.

However, it appears to get confused on the number units within range. (or it is not updating map symbols after each unit is moved)

The pertinent script sections are:

; Blue Hash, Red Exclamation
#DISPLAY_STYLE= 2.14
; Axis have 0-3 units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [4,4] [1] [0] [<]
...
; Blue Hash, Blue Exclamation
#DISPLAY_STYLE= 2.15
; Axis have 4-15 units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [4,15] [1] [0]
...
; Blue Hash, Yellow Exclamation
#DISPLAY_STYLE= 2.16
; Axis have 16-18 units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [16,18] [1] [0]
...
; Blue Hash, Red Exclamation
#DISPLAY_STYLE= 2.14
; Axis have 19+ units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [19,19] [1] [0]

EDIT: Based on feedback from El Dorado, previous has been fixed as follows:

; Blue Hash, Red Exclamation
#DISPLAY_STYLE= 2.14
; Axis have 0-3 units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [4,4] [1] [0] [<]
...
; Blue Hash, Blue Exclamation
#DISPLAY_STYLE= 2.15
; Axis have 4+ units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [4,4] [1] [0]
...
; Blue Hash, Yellow Exclamation
#DISPLAY_STYLE= 2.16
; Axis have 16+ units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [16,16] [1] [0]
...
; Blue Hash, Red Exclamation
#DISPLAY_STYLE= 2.14
; Axis have 19+ units within 10 hexes of Warsaw(188,76)
#CONDITION_POSITION= 188,76 [10,10] [19,19] [1] [0]

NOTE: When it is done this way, it may be dependent on ordering within popup.txt

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Wed Aug 02, 2023 1:45 pm
by El_Condoro
I have responded to the question on the Tech Support forum but the issue is the same:

[4,4] will trigger when there are 4 or more units within range of hex. Less than 4 if [<] is used.

[4,10] will randomly use a number between 4 and 10 to use as the range or number of units.

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Wed Aug 02, 2023 4:17 pm
by DarkHorse2
[4,10] uses a random number? OMG!

how can you glean that from: :?: :?: :?:

Code: Select all

; #CONDITION_POSITION= Map positions that will serve to trigger the event as well as distance and
;                      number of enemy unit ranges.
;                      Format: x,y [min_range, max_range] [min_enemy_units, max_enemy_units] [alignment] [aligned_country_id]
:roll:

Nothing in the user manual about it. And nothing in the "templates" that properly describe any "randomness".

:cry:

What an utterly useless feature - one that is rarely (if ever) used. Even then, most likely used incorrectly given the lack of documentation on it.
CG3_RandonNumUnits.PNG
CG3_RandonNumUnits.PNG (271.12 KiB) Viewed 580 times

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Wed Aug 02, 2023 9:20 pm
by El_Condoro
I wasn't able to work it out myself until I asked on this forum (years ago?) I was looking to do the same thing that you are and thought 0-3 meant if there were none, one, two or three, the script would trigger. It never worked properly and so I asked here and was told about the random aspect. The inclusion of [<] has fixed the issue, at least for me.

I'm not sure how you would implement your checks, though. I assume the scripts are read top-down, so their order in the file might be important but I can't see any way to prevent the others that meet the conditions from triggering, too.

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Sat Aug 05, 2023 8:23 pm
by DarkHorse2
El_Condoro wrote: Wed Aug 02, 2023 9:20 pm I wasn't able to work it out myself until I asked on this forum (years ago?) I was looking to do the same thing that you are and thought 0-3 meant if there were none, one, two or three, the script would trigger. It never worked properly and so I asked here and was told about the random aspect. The inclusion of [<] has fixed the issue, at least for me.

I'm not sure how you would implement your checks, though. I assume the scripts are read top-down, so their order in the file might be important but I can't see any way to prevent the others that meet the conditions from triggering, too.
I think I have gotten it to work using the changes, above. I really don't like it as I think you need it in the correct order (within the file).

And I highly suspect that the hex may be getting updated more than once doing it like this.

Consider having 20 units within 10 hexes of Warsaw
That would fail for the [0-3] case.
Would succeed for the [4] case.
Would succeed for the [16] case.
Would succeed for the [19] case. (but since this is the last one, its map symbol over-writes the other two?)

I don't know this is how it works for certain, but it would not surprise me.

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Sat Aug 05, 2023 10:04 pm
by El_Condoro
That sounds like a good approach. I'm not sure it will work but I think it will.

I have found it invaluable to create a test campaign and set all the conditions to test some scripts. I then play it hotseat to see how things work without ruining the main campaign. With this one, I'd do a file, save of the 1939 campaign, set up all your conditions (place n units within the range) and test it. That's probably telling you how to suck eggs but, hey.

Re: Game appears to be mis-counting units when using #CONDITION_POSITION=

Posted: Sun Aug 06, 2023 1:51 am
by DarkHorse2
I have a test scenario I have been making changes into and playing against.

So far so good.

https://github.com/mlshort/Fall-Weis-II ... angeLog.md