User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Changing flags

Thu Aug 04, 2016 10:08 pm

Is it possible to write a script that changes the flags that get used by a particular side?

I really don't care for the flags that were in use with the vanilla version. I've put together several sets of preliminary flag mods for the national flags, but have found that I am even unhappier with the state flags (some of which are off by more than a hundred years), so I expect to spend the next week or so figuring out how to deal with them.

In the best of all possible worlds, the Southerners would be using a blue flag with a single white star (the Bonnie Blue Flag, as in the song) for everything during the first turn while they fired on Fort Sumter. By late April of 1861 all of the flags should be the Stars and Bars. In December of 1861 the Southern Cross should appear on units and in the strategic menu. The Stainless banner should appear fluttering over towns in the early summer of 1863, and should eventually replace the Stars and Bars as a region control flag (yes, during 1863 the Stars and Bars, the Southern Cross, and the Stainless Banner will all be visible in different places at the same time -- and what happened in reality was even less uniform and more confusing). Sometime in 1865 the Bloodstained Banner should replace the Stainless banner (it may have been used unofficially as early as December 1864), probably in January or February.

So far I've made all of these flags except the Bonnie Blue Flag, because it didn't make any sense to have to do a manual install of a flag that only appears in the game for one turn. But if there were a script that could tell the engine to look at particular flags for particular functions after a certain date, I'd make a fourth set of Confederate flags.

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Fri Aug 05, 2016 2:44 am

Hmm,

I am guessing you found where the flag graphics are held CW2>Graphics>Factions

and have maybe found where they are actually assigned CW2>Gamedata>Factions

I see events that change some flags on the map .. example for Nevada below .. so it looks like you could change flags for states .. not seen anything that would change your unit stack flags or unit roundels based on events but it may well be possible if you can find the right parameter. The wiki didn't seem to have any info on it but there may be something in the CW2 or old AACW forums as they are a wealth of knowledge with the right search.

SelectFaction = USA
SelectRegion = $OMB_Nevada_NV
StartEvent = evt_nam_USA_36thState1864|1|2|evt_txt_USA_36thState1864|Event-img_USA_36thState1864|$OMB_Nevada_NV|121

Conditions
MinDate = 1864/10/31

Actions
DescEvent = evt_desc_USA_36thState1864
ChangeMoneyPool = 15
ChangeFacMorale = 5

SelectRegion = $Rockies

ChangeSupply = 10;10;0
SetMoraleLevels = 40;200
RemDynGraphic = $OMB_Nevada_NV;Flag_NV.png
AddDynGraphic = $OMB_Nevada_NV;Gx_StateCapitole.png;Gx_StateCapitole.png;NULL;135;100;strStateCapitol
AddDynGraphic = $OMB_Nevada_NV;Flag_NV.png;Flag_NV.png;NULL;150;100;strNV

EndEvent

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Fri Aug 05, 2016 3:02 am

Managed to find a couple of threads related to this .. though nothing yet on changing them mid game

http://www.ageod-forum.com/archive/index.php/t-32176.html

http://www.ageod-forum.com/showthread.php?32158-Built-In-CSA-Flag-Mod

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Tue Aug 09, 2016 2:57 pm

A first draft of the mod is pretty much done. If I don't use the Bonnie Blue Flag on the first turn (the flag was briefly used by only a few states though it was a generally understood symbol of secession), the CSA flag/symbol part of the mod fits into five folders. Oddly enough the hardest part was doing the state flags, a trivial exercise from a graphics manipulation standpoint, but involved a certain amount of research to grind through. Most of the states didn't actually have flags during the Civil War, and most of the flags that the game uses are late nineteenth-early twentieth century. But what they all had were state seals, and these show up with a fair amount of frequency on the regimental banners of units raised in the various states. So I spent a lot of time looking at regimental banners, a great many of which survived the war.

I may release a manual installation version of the mod while I figure out how to write simple event scripts. Given that the last flag change takes place in 1865 and the torpid pace at which I play these games, I'm not sure how I'm going to be able to test any flag-changing scripts that I eventually write. As it stands, after you install the base part of the mod, you just have to remember to add in the Confederate Battle Flag in December 1861, the Stainless Banner in May 1863, and the Bloodstained Banner in February (officially March) 1865.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Wed Aug 10, 2016 5:58 pm

Here are some screenshots of the first draft of the mod.




The first set of flags (Stars and Bars used everywhere) at start of game:


Image




The second set (CSA Battle flag for units only) December 1861:


Image




The third set (Stainless Banner for cities only) May 1863:


Image


The fourth set (Stainless Banner for cities and regions) January 1864:


Image



The fifth set (Bloodstained Banner for cities and regions) February 1865:



Image

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Wed Aug 10, 2016 11:21 pm

Very very nice ... Do you plan to share a mod or the event script changes you made?

I for one am keen to see how you made the changes for the unit.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Wed Aug 10, 2016 11:53 pm

Earlier today I received two very helpful e-mails from Philippe Thibaut and Philippe Malacher pointing me at two particular event files in PON and giving a few hints about syntax. I'm currently trying to digest what I've learned, but things are already a lot clearer. Writing events to effect the changes that you can see in the screenshots is possible, but it will take me a little while to get my bearings because I've never written an event for an Ageod game before.

There will most certainly be a mod release. I do a fair number of them for other games, and I must say that it is a pleasure to make an historical flag mod that doesn't involve swastikas.

I'll post the relevant part of the two files in question a little later on. And because this is new territory I'll also post what I think will be the needed addition to the CSA event file.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Thu Aug 11, 2016 12:08 am

Teatime wrote: I for one am keen to see how you made the changes for the unit.


Do you mean what I did to produce those graphics?

I make about half of the mod in Paint, and then finish it off in Photoshop 7. I'm probably going to move completely into Photoshop eventually, because the newer version of Paint has less functionality and is harder to use than the one that came with Windows XP.

The main thing when working with PNG files is to set up transparent alpha channels. My alpha channel technique needs some improvement, because over the years most of the work I've done has been with bitmaps, so I'm a bit sloppy when it comes to adding transparent areas to DDS files (used in the Battle Academy engine and in a lot of flight sims) and PNG files.

Making changes to PNG's in Paint destroys the alpha channel, so you have to make a template for re-inserting them. One of the reasons what you see is a draft rather than the final product is that I'll need to refine my template for the alpha channel for the fluttering flag.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Thu Aug 11, 2016 6:31 pm

The two events from PON that are relevant here are this one:



SelectFaction = CMN
SelectRegion = $Brandenburg

SelectFaction = CMN
SelectRegion = $Brandenburg

StartEvent = evt_nam_PRU_NorthGermanConfederation1867|1|2|evt_txt_PRU_NorthGermanConfederation1867|Event-img_GER_NorthGermanConfederation1867|$Brandenburg|NULL

Conditions

SelectFaction = GER
EvalIsAtPeaceWith = AUS
MinDate = 1860/01/01
MaxDate = 1875/03/10
Probability = 25
EvalEvent = evt_nam_GER_Hannover_UnificationOK;=;1
EvalEvent = evt_nam_GER_Sachsen_UnificationOK;=;1
EvalEvent = evt_nam_GER_Hessen-Kassel_UnificationOK;=;1
EvalEvent = evt_nam_GER_Hessen-Damrstadt_UnificationOK;=;1

Actions
DescEvent = evt_desc_PRU_NorthGermanConfederation1867
AbsorbFaction = HAN;100;100;100;100;100;100;100
AbsorbFaction = SAX;100;100;100;100;100;100;100
AbsorbFaction = HEK;100;100;100;100;100;100;100
AbsorbFaction = HED;100;100;100;100;100;100;100
AbsorbFaction = HLS;100;100;100;100;100;100;100
ChgFacDisplayTag = NGF
ChgVPCount = 100
ChgRgnDecisionFP = $rgdProposeUnificationGER;3

EndEvent


and this one:



SelectFaction = GER
SelectRegion = $Brandenburg

StartEvent = evt_nam_PRU_Germany1871|1|2|evt_txt_PRU_Germany1871|Event-img_GER_ImperialGermany1871|$Brandenburg|NULL

Conditions
EvalEvent = evt_nam_PRU_NorthGermanConfederation1867;=;1
MinDate = 1870/07/01
MaxDate = 1888/03/10

EvalRgnOwned = $Alsace

EvalRgnOwned = $Lorraine
Probability = 85

Actions
DescEvent = evt_desc_PRU_Germany1871
AbsorbFaction = BAD;100;100;100;100;100;100;100
AbsorbFaction = WUR;100;100;100;100;100;100;100
AbsorbFaction = BAY;100;100;100;100;100;100;100
ChgFacDisplayTag = GER
ChgVPCount = 1000
ChgRgnDecisionFP = $rgdExploreParty;2
ChgRgnDecisionFP = $rgdNatExpedition;1
ChgRgnDecisionFP = $rgdGeoExpedition;1
ChgRgnDecisionFP = $rgdAnthroExpedition;1
ChgRgnDecisionFP = $rgdProspection;5
ChgRgnDecisionFP = $rgdProsecute;3
ChgRgnDecisionFP = $rgdPacify;5
ChgRgnDecisionFP = $rgdRetaliate;5
ChgRgnDecisionFP = $rgdOutpost;10
ChgRgnDecisionFP = $rgdGunboatDiplomacy;1
ChgRgnDecisionFP = $rgdNavalDemo;1
ChgRgnDecisionFP = $rgdChiefBribing;10
ChgRgnDecisionFP = $rgdChiefTreaty;3
ChgRgnDecisionFP = $rgdChiefTerritory;3
ChgRgnDecisionFP = $rgdMissionary;5
ChgRgnDecisionFP = $rgdMerchants;5
ChgRgnDecisionFP = $rgdTradepost;15
ChgRgnDecisionFP = $rgdRoad;10
ChgRgnDecisionFP = $rgdTelegraph;1
ChgRgnDecisionFP = $rgdSchool;5
ChgRgnDecisionFP = $rgdVaccination;0
ChgRgnDecisionFP = $rgdSanitation;0
ChgRgnDecisionFP = $rgdImmigrants;10
ChgRgnDecisionFP = $rgdSociety;1
ChgRgnDecisionFP = $rgdProtectorate;2
ChgRgnDecisionFP = $rgdColony;2
ChgRgnDecisionFP = $rgdStake;10
ChgRgnDecisionFP = $rgdCustoms;1
ChgRgnDecisionFP = $rgdRail;1
SetEvtOccurs = evt_nam_PRU_SouthGermanConfederation1872;MaxOccurs;0

EndEvent



The nation (GER) switches from its old flag to a new one called NGF

ex:

GER NULL ChgFacDisplayTag NGF to display the NGF flag (instead of initial one)


See also the wiki here

http://www.ageod.net/agewiki/ChgFacDisplayTag

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Thu Aug 11, 2016 7:33 pm

My current questions about how to write this thing:


Will the event fire or crash if there is no SelectRegion line ?

Will the event work if only some of the elements of the StartEvent command are there? (There's an article in the wiki that explains what all of the elements are).

Does this event need a max date? What about a max date that is one day before the next changeflag min date?


Do these events need to go into a specific place in the CSAEvents file? If I had to guess I would think they would need to be inserted into the appropriate chronological spot.

Does any of this need to go anywhere BESIDES the CSA Events file ? (In other words, will this make the flags show up in the individual scenarios?)

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Thu Aug 11, 2016 10:05 pm

After staring at the two examples from PON, reading the wiki, and looking through

the CSA event file, my first stab at writing an event for changing the flags

would look something like this:




SelectFaction = CSA

StartEvent = evt_nam_CSA_BattleFlag|1|2|NULL|NULL|NULL|NULL

Conditions
MinDate = 1861/12/01

Actions
ChgFacDisplayTag = CSB

EndEvent




This is supposed to change the flags that show up in the first screenshot to the

flags in the second screenshot, and takes place at the start of December 1861.

All of the flags that will show up in this faction display change would have CSB

in their names instead of CSA.

The syntax of the StartEvent line makes me a little nervous. I have set the

Display Type parameter at 2, but I'm not really sure which parameter to use. I

also find that string of NULL's a little scary.

Anyone with any experience in writing these things is encouraged to chime in.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Thu Aug 11, 2016 11:21 pm

Just ran a quick test. This kind of thing never works the first time out, and this was no exception. Now the fun begins while I try to figure out why it didn't work. Either I'm fiddling with the wrong file, or some of the parameters in the event description are wrong.

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Fri Aug 12, 2016 10:13 am

I would add a MaxDate in there as well ... just make it the same as your MinDate to guarantee that is the date it occurs .. things don't always trigger on exactly the MinDate and may not for a few turns but should always trigger by the MaxDate at the latest.

When testing stuff I also typically just set things for a turn or 2 into a new game so I can see it trigger early .. then change dates to those I actually want.

The faction file currently contains FactionTag = CSA and DisplayTag = CSA but I'm not clear what they each relate too and I am assuming the ChgFac part of the parameter acts as a command, so I think that piece is correct.
I will see if i can find anything that might help there as well. I don't have PON so can't see what the equivalents are in the faction files there but I expect they would be the same

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Fri Aug 12, 2016 2:22 pm

I've been using early May 1861 as a provisional test date.

Added in a MaxDate but nothing changed.

Assuming that I'm messing with the right file in the first place (CSA events), I wonder if there isn't some other file I should tinker with to make the game recognize that CSB is a legitimate faction flag set for the CSA. That might be the problem.

User avatar
Captain_Orso
Posts: 5766
Joined: Tue Sep 01, 2009 5:02 pm
Location: Stuttgart, Germany

Fri Aug 12, 2016 3:08 pm

1. If changing the national flags were intended by the game, you would have already found the command in the AGE Wiki, but it's not there, so it doesn't exist, and was never intended.

2. Read the AGE Wiki Script Commands, read what it says about the parameters each command uses. If you don't understand a term being used, search for the term. There is generally a description. Search in the game's events for examples of commands you don't readily understand.


The only way you might be able to do what you intend would be by using dynamic graphics, but that would entail writing scripts which checked every single region per, time frame, per turn for ownership, because ownership can change, no? That would be thousands of scripts, and you'd have to 'tune' the scripts for each region, to place the dynamic graphics flag exactly over the top of the default flag...

BTW if you want to know if and how a script fired, look in the script logs: '..\My Games\CivilWarII\CW2\Scripts'.
Image

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Fri Aug 12, 2016 3:09 pm

Yeh,

That faction file contains a number of flag parameters which appear to be pointing to specific images but as per the wiki link that tag should be pointing you to the right graphics image

You could try adding in an event message that would tell you in the message window that the event had triggered and therefore whether the problem is the event not triggering or if the tag assignment is failing

also perhaps used FixedDate rather than Min & Max

e.g from the great comet event

Conditions
FixedDate = 1861/06/29

Actions
DescEvent = evt_desc_CMN_Great_Comet1861


I am wondering too if you can somehow just redirect the generic flag image which is set by CSFlagImg = CSFlag_CSA.png in the CSA factions file .. that should logically translate to all occurrences

Teatime
Lieutenant
Posts: 132
Joined: Wed Apr 27, 2016 2:56 pm

Fri Aug 12, 2016 3:24 pm

Also .. from the Wiki

http://www.ageod.net/agewiki/FactionTag

Did you create a new CSB faction file in CW2>Gamedata>Factions?

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Fri Aug 12, 2016 4:43 pm

No, and that may be the problem. I'll take a look.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Tue Aug 16, 2016 4:56 pm

I'm not sure that I'm going to be able to figure out how to trick the program
into making the flag changes any time soon.

I'm not giving up since it's the best way of going about things, but in the meantime I've started looking at
putting together a manual version of the mod.

The one minor obstacle I'm having is that I only own the Steam version of CW 2.

So I can test the Steam side of things, but that leaves me a bit up in the air for the non-Steam version of the game.

Based on what I've seen in other games with Steam and non-Steam versions, there is often a slight difference in
nomenclature in one or more folders in the folder structure, that makes producing
two slightly different versions of the same mod necessary.

The difference ususally has to do with the use of the ampersand in a folder name, and it usually crops up in one of the first few folders in the game.

The path for the Steam version that I need to work with is:

.../Steam/SteamApps/common/Civil War II/CW2/Graphics/...

In the non-Steam version, is the path .../Civil War II/CW2/Graphics as well ?

One of the folders that I make changes to in the Steam version has the path:

.../Civil War II/CW2/Graphics/Armies&Fleets.

Does that path exist in exactly that form in the non-Steam version?

I'm concerned that Armies&Fleets might be written Armies and Fleets or ArmiesnFleets in the non-Steam version.

I don't think this next point will be an issue, but could someone confirm that these folders exist with exactly this nomenclature inside the faction folder in the Steam version:

BottomLeft, CityscapeFlags, Counter_OnMap, Roundels, StateFlags.

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Tue Aug 16, 2016 7:25 pm

The Steam version of the mod has been posted to Steam's Civil War 2 forum under Historical Flag Mod.

As soon as I am satisfied that I know the answers to the questions in the previous post, I'll post a non-Steam version here as well.

For the moment the flag changes are done manually, but I haven't given up on figuring out how to make them automatic.

User avatar
Pocus
Posts: 25664
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Wed Aug 17, 2016 4:15 pm

Hi Philippe. Still on half crew here as this is summer and we are hard pressed finishing a deadline... So please wait until at least next week for a detailed answer.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Philippe
AGEod Veteran
Posts: 754
Joined: Thu Oct 26, 2006 11:00 pm
Location: New York

Wed Aug 17, 2016 4:48 pm

I am the soul of patience.

After 150 + years, another week will hardly make any difference.

Return to “Civil War II”

Who is online

Users browsing this forum: Blood and Thunder Brigade and 28 guests