• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

froglegs

Colonel
4 Badges
Mar 10, 2005
940
2
  • Arsenal of Democracy
  • Darkest Hour
  • Hearts of Iron III
  • 500k Club
type = clrflag which = [keyname] # Global flag, visible for all countries

From the event command file the above line is shown.

What is "clrflag"? Does it remove a setflag?
 

froglegs

Colonel
4 Badges
Mar 10, 2005
940
2
  • Arsenal of Democracy
  • Darkest Hour
  • Hearts of Iron III
  • 500k Club
Is it possible that clrflag has been deactivated by mistake? In my test of it and using debugai I see when setflag has fired. Then when clrfalg should fire I never see that happen.

Basically does anybody know of an existing clflag that commonly fires and does work?

What I am trying to do is to improve the Japanese Pacific AI. I want the ai to target certain USA/Allied controlled islands for invasion. So, for instance, in the case of Midway, I setflag "Midway" if it is garrisoned by 2 or less divisions. Then the "Midway" flag fires an ai switch for Japan that increases the relative value of Midway to say 250. I find that the Jap ai will then shortly attempt to invade Midway. Success!

Then if I as USA increase the garrison of Midway to 3 or more divisions, a event should fire causing the clrflag "Midway" to fire and the flag "Midwaynot" to fire. The flag "Midwaynot" now tells the Jap ai file to switch to an ai switch file reducing Midway from 250 to 0 so that Japan ai will not now attempt an invasion of Midway. But it does anyway!

It is as if clrflag does not work and the debugai never shows the new setting. Again I ask, is anybody certain that clrflag still works in AOD 1.08?
 

Tegetthoff

General
14 Badges
Apr 14, 2006
2.101
4
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • For the Motherland
  • Hearts of Iron III
  • Semper Fi
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 500k Club
  • Rise of Prussia
  • Mount & Blade: Warband
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Imperator: Rome - Magna Graecia
We use setflag and clrflag extensively in CORE, both local and global and it definitely works.

debugai does not show any flag settings as far as I know.

There are many other things that can go wrong with the coding you describe above, including that the coding is absolutely correct and the AI just ignores it.

Teg
 

froglegs

Colonel
4 Badges
Mar 10, 2005
940
2
  • Arsenal of Democracy
  • Darkest Hour
  • Hearts of Iron III
  • 500k Club
Thanks for you reply Tegetthoff!

I now have confirmed that "clrflag" does indeed work.

What instead seems not to work is the following:

province_building = { province = [ID] building = [building type] size = x } # true if province ID has a building of [building type] that is at least of size X, use following values for building: 1 = IC, 2 = #coastal fort, 3 = land fort, 4 = AA, 5 = infra, 6 = air base, 7 = naval base, 8 = radar station, 9 = nuclear reactor, 10 = rocket test, 11 = synthetic oil, 12 = synthetic rares

The above is copied directly from the eventcommands.txt file.

So, the event should not trigger when the coastal fort is size 3 or greater if I have the following trigger line in my event: "NOT = { province_building = { province = 662 building = 2 size = 3 } }# 2 = coastal fort"

But it does! The fort in question is shown to be exactly 3 in size. Even if I change the fort size from 3 to 1 in the trigger "size = 1" just to see if there is a rounding error, the event will still trigger.

Either my trigger line format is wrong or the province_building/coastal fort trigger does not work anymore with AOD 1.08 ( or perhaps it never has).
 

Pang Bingxun

Field Marshal
2 Badges
Nov 22, 2011
5.596
185
  • Arsenal of Democracy
  • 500k Club
There is the floating point issue. If you try 2.99 instead of 3 it may work.

Even if I change the fort size from 3 to 1 in the trigger "size = 1" just to see if there is a rounding error, the event will still trigger.

That is strange. A trigger line like
NOT = { province_building = { province = 1305 building = 5 size = 0.49 } }
does work.
 

froglegs

Colonel
4 Badges
Mar 10, 2005
940
2
  • Arsenal of Democracy
  • Darkest Hour
  • Hearts of Iron III
  • 500k Club
is it possible to use the name instead of the numeric ID? coastal_fort instead of 2

There were problems with the numeric ID trigger in past versions but I thought they were fixed.

I thought about that too, but using the name does not work either. I am surprised thought that using the name does not crash -- normally a improper term will crash.

I did a search through a number of mods and nowhere could I find the use of "province_building" as a trigger. If anybody know of its use I would like to know just to see their exact code line in use.

Again, my purpose is to make the Japanese ai smarter by invading underdefended islands and avoiding overdefended islands -- among lots of other things. It takes a pair of events and a pair of ai switches for each island/beach -- but since little has been done with the Pacific war for Japan ai it seems really worth it. Of course the USA ai could use help too but that is a Bridge Too Far at this time. My Plan B to get around this naval fort issue is simply to make naval forts too expensive to be worth building by a human USA player. I can live with that.
Hopefully in a month or so I will have something releasable as a Human USA mini mod. My two play testers seem to like it so far. They both have been around HOI2 since 2005.