capital and city hex graphics

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, The Lordz

Post Reply
ANZACMICK9
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Wed Apr 17, 2019 8:21 am

capital and city hex graphics

Post by ANZACMICK9 »

gday all, was wondering where the capital and city hex graphics are registered/referenced from. Any ideas would be grand...thx
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: capital and city hex graphics

Post by Robotron »

Find them in

Commander the Great War\Data\Graphics\hexes

Are you planning on replacing them?
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
ANZACMICK9
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Wed Apr 17, 2019 8:21 am

Re: capital and city hex graphics

Post by ANZACMICK9 »

hey robotron...love your mod btw...

I know where to find the actual graphics of the cities and capitals, im just wanting to know from where from they are referenced. eg, which file says that hex number x,y is to displayed as a capital.
Or maybe all this is hard coded in the map files?
And yes ive made various little mods that I use alongside your fantastic POTZBLITZ mod. one is a entirely new map made from satellite imagery.
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: capital and city hex graphics

Post by Robotron »

All "constructions" for any nation - meaning capitals, cities, fortresses and harbors - are defined by the file constructions.lua

Every construction must be given type (capital, city, fortress, harbor), name, coordinates (x,y) and production points (PP).
Harbors must always be named "PORT" and don't get PP assigned.

See here the part for switzerland as an example:

Code: Select all

  switzerland =
  {
    {
      type = "capital",
      name = "BERN",
      hex = {90, 34},
      PP = 9,
    },
	{
      type = "fortress",
      name = "SANKT MAURICE",
      hex = {89, 34},
      PP = 1,
    },
	
	{
      type = "fortress",
      name = "SARGANS",
      hex = {91, 32},
      PP = 0,
    },
  },
You can add new constructions for each nation by sticking to the syntax given above: start each new entry for a construction with a bracket and end it with a bracket followed by a comma.

Harbors must be set to sea hexes.

Also every harbor must be set in a way that it only borders onto a single city or capital or else the game will crash.

Finally you must add the new names of constructions to the language file which is english.txt or else the name of the construction will be blank on the map.

Add new construction names into english.txt onwards from line 400 (in vanilla CTGW) or line 1137 in PotzBlitz.

The first name is the one defined in constructions.lua the second is the one displayed on the map. Keep it simple by using the same name for both.

It should look like this after editing:

Code: Select all

AQABA = AQABA
SARIKAMIS = SARIKAMISH
RUHR = DORTMUND
LARISSA = LARISSA
NEWCITYNAME = NEWCITYNAME
NEWFORTRESSNAME = NEWFORTRESSNAME
NEWCAPITALNAME = NEWCAPITALNAME
etc.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
ANZACMICK9
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Wed Apr 17, 2019 8:21 am

Re: capital and city hex graphics

Post by ANZACMICK9 »

thx again for your quick replies...
however I think I am asking the question wrong.....
I do understand the last post unto which you replied regarding the constructions file, but what I am trying to say is, what is- where are the referencing points to say "put capital.png as the icon/graphic for paris / London /etc. .
what im wanting to do is reference each capital / city as its own icon/graphic, not the generic capitol.png or the city.png.
I cannot find these file name references in any of the scripts to say, that is where that graphic goes.
hope this makes better sense... thx for your patience
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: capital and city hex graphics

Post by Robotron »

Still not clear enough.

Do you want to do individual graphics for A:
map1.jpg
map1.jpg (17.69 KiB) Viewed 5053 times
or B:
map2.jpg
map2.jpg (19.87 KiB) Viewed 5053 times

I can't help with A, but B could be individualized by going into vanilla's main_hud.lua and editing the checks from 1610 to 1630

For example line 1626 goes like:

Code: Select all

if hex.construction.type == Construction.TYPE_CAPITAL then
      hud:GetImage("terrain_image"):SetImage("graphics/terrain", "terrain_capital.png")
      hud:GetText("terrain_text"):SetLocalText("capital")
end



maybe these could be individualized for example for Paris and Berlin which are at (x/y: 82/30) and (x/y: 101/22) by doing:

Code: Select all

if hex.construction.type == Construction.TYPE_CAPITAL then
      if hex.x == 82 and hex.y == 30 then
      		hud:GetImage("terrain_image"):SetImage("graphics/terrain", "terrain_paris.png")
      		hud:GetText("terrain_text"):SetLocalText("PARIS")
      
      elseif hex.x == 101 and hex.y == 22 then
      		hud:GetImage("terrain_image"):SetImage("graphics/terrain", "terrain_berlin.png")
      		hud:GetText("terrain_text"):SetLocalText("BERLIN")
      
      else
      		hud:GetImage("terrain_image"):SetImage("graphics/terrain", "terrain_capital.png")
      		hud:GetText("terrain_text"):SetLocalText("capital")
      end
end


I've not tested that though.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
ANZACMICK9
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Wed Apr 17, 2019 8:21 am

Re: capital and city hex graphics

Post by ANZACMICK9 »

gday mate, again thx for the quick reply.
sorry not clear enough but A is the one I was wanting to try. I fear that may be hard coded if you have no answer... I may try B for shits and giggles to get some individual flavor into the displays.
Seems capital, cities and fortresses may all be hard coded in the map file then?
I was just going to work on some "fluff" on making the game a bit prettier. Ill try to post some pics when done.
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: capital and city hex graphics

Post by Robotron »

You can move them around as much as you like but you can't individualize the graphics representing them since you can't access the so-called "political map".

For the same reason you cannot change the original owners of hexes and the terrain.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
ANZACMICK9
Private First Class - Wehrmacht Inf
Private First Class - Wehrmacht Inf
Posts: 6
Joined: Wed Apr 17, 2019 8:21 am

Re: capital and city hex graphics

Post by ANZACMICK9 »

no worries.... thx very much for your help
Post Reply

Return to “Commander the Great War : Mods & Scenario Design”