Courtenay
Private
Posts: 24
Joined: Tue Nov 03, 2009 7:07 am

Forrest appearing in Union owned Stewart, TN

Sun Dec 13, 2009 4:05 am

I recently had Forrest show up in a Union owned Fort Donelson (Stewart, TN), even though the Confederates still owned many cities in Tennessee. Why did this happen? Obviously, because that's where the computer was told to put him.


Forrest's arrival is caused by the following event, in CSA Leaders:

Code: Select all

SelectFaction = $CSA
StartEvent = evt_nam_CSA_Forrest|1|1|NULL|NULL|NULL|NULL

Conditions
  MinDate = 1862/02/01
  MaxDate = 1862/03/01
  EvalUnqUnit = Nathan B. Forrest;NOT
SelectRegion = $Stewart, TN
  SelectRegInArea = $TN;Squared;OwnedCities;CondSkip
  GenMsg
  PickFromRegList = NotEnemy
  GenMsg
  EvalRegionSel = NULL

Actions
  GenMsg

etc, etc.
I do not have the manual for event codes, so have had to make do with the wiki, which is incomplete, and searching the forum for old posts.
At any rate, here is my best guess for what the critical part of this code does:

Code: Select all

  EvalUnqUnit = Nathan B. Forrest;NOT   // If Forest is not on the map
SelectRegion = $Stewart, TN             // Pick Stewart, TN as region
  SelectRegInArea = $TN;Squared;OwnedCities;CondSkip
           // If valid region has been picked, which it always has, skip
           // this line.  In other words, this line is a no-op.
  GenMsg   // Connect map region to event display
  PickFromRegList = NotEnemy  // Pick only regions that are not enemy from list.  This is a guess.
  GenMsg   // Again, associate map region to event display. 
  EvalRegionSel = NULL  // Accept event even if there are no valid regions.
            // This is a complete guess.  I have no documentation on "EvalRegionSel".

Actions
  GenMsg   // Again, etc.
Thus, if my understanding of CondSkip is correct, Forrest appearing in Stewart, TN, under all circumstances is exactly what this code should do. My understanding of CondSkip is based on an old post by Pocus: [POST]62546[/POST] that I found by doing a search for "CondSkip" in the forums.

Correcting the code:
I submit that the following code much more accurately represents the desired intention:

Code: Select all

  Conditions

  MinDate = 1862/02/01
  MaxDate = 1862/03/01
  EvalUnqUnit = Nathan B. Forrest;NOT
  SelectRegion = $Stewart, TN;NotEnemy
  SelectRegInArea = $TN;Squared;OwnedCities;CondSkip
  SelectRegion = $Stewart, TN;CondSkip
  GenMsg
Translated into English prose:
Pick Stewart, TN if not enemy owned.
If Stewart is not valid (i.e. was enemy owned) pick a random friendly-owned
Tennessee city, weighted by city size squared,
If still don't have a valid region, go back to Stewart, TN.
Associate event message with region on map.
I am not sure if multiple "GenMsg" commands are needed, or just one after all the regions are finally picked. I am also unsure if this should go before or after the "Actions" statement.

If I am correct that this event is bugged, and how it bugged, then there are at least twenty-five other instances of similar bugs just in the file "CSA Leaders". I have not yet looked at the other event files for this bug.

User avatar
Gray_Lensman
Posts: 497
Joined: Mon Jun 18, 2007 4:04 am
Location: Who is John Galt?

Sun Dec 13, 2009 6:25 am

deleted

Courtenay
Private
Posts: 24
Joined: Tue Nov 03, 2009 7:07 am

Sun Dec 13, 2009 8:27 pm

Gray_Lensman wrote:There has never actually been a complete manual for event codes, though it has been requested more than once over the last 2 years. Recently there have been some postings into the Wiki however.

You may/may not have stumbled onto something however... but to clarify the use of the statement:

SelectRegion = $Stewart, TN;NotEnemy

will still allow Forrest to be placed in Stewart, TN if there are NO USA units present. The NotEnemy literal in this statement evaluates for the presence of an enemy unit, NOT ownership of the region. Thus even if the region is owned (but not garrisoned) by USA units, the statement above would be the one accepted placing Stewart, TN in the RegList and the following condskip statements would then of course be "conditionally skipped".

The current game statement (without the NotEnemy literal) may/may not be a type of database discrepancy, along with dozens if not hundreds of others that still exist in the AACW database files. It would depend on testing to be sure that NO enemy unit was present in Stewart, TN at the time Forrest's placement.

Yes, I did have a garrison in Ft Donelson. Indeed, I was forced to, as the Donelson garrison appears by event and is locked in Donelson until attacked. (I also had another brigade and the captured guns of the original Confedeate garrison there, as well.)

Thank you for telling me that NotEnemy applies to units, not ownership. I still like my mod; I think that if a Union player somehow manages to have Ft Donelson ungarrisoned, he deserves to have Stewart take the place.
Gray_Lensman wrote:If you still have the saved game files that brought this to your attention it would be most helpful to post them here so that the turn could be rerun to debug the actual event processing.


Which files do you want me to post? The save game files are the most elaborate I have seen in any game, with multiple subfolders for each game, and multiple files in each subfolder. Also, does one post compressed or uncompressed files? Thank you.

P.S. While I am on the subject of saved games, I know that if I want to go back and replay a turn, I can use the 'Home' key on the 'Load Game' subwindow. If all I want to do is to look and see what my stupid orders actually were the previous turn (as opposed to the orders, possibly stupid, that I thought I made), how do I undo the effects of the 'Home' key?

User avatar
Gray_Lensman
Posts: 497
Joined: Mon Jun 18, 2007 4:04 am
Location: Who is John Galt?

Sun Dec 13, 2009 9:43 pm

deleted

Courtenay
Private
Posts: 24
Joined: Tue Nov 03, 2009 7:07 am

Mon Dec 14, 2009 4:18 am

Gray_Lensman wrote: I forgot about the autogarrison event. This pretty much confirms the original event syntax is incorrect as you stated above.


Yes, and there are at least twenty-five instances of the same bug, where a region is unconditionally picked and the next line has a CondSkip, in the
"CSA Leader" file. I just skimmed the "USA Leader" file, and noticed only one instance of this bug (Dupont).

The next question is, "Is my fix correct?" It looks right to me, but since I don't really know what I am doing, I can't be certain.

Gray_Lensman wrote:You meant Forrest, but I agree...

I did indeed mean Forrest.

Thank you for the information about the 'Home' command.

I am perfectly willing to do a mod to fix bugs, but I am leaving on a month long trip in a week, and I know what sort of code I produce when I try to rush, so it won't happen until February of next year at the earliest.

User avatar
Gray_Lensman
Posts: 497
Joined: Mon Jun 18, 2007 4:04 am
Location: Who is John Galt?

Mon Dec 14, 2009 6:46 am

deleted

Return to “AACW Mods”

Who is online

Users browsing this forum: No registered users and 13 guests