Unit Naming

ruff_hi

Live 4ever! Or die trying
Joined
Oct 24, 2005
Messages
9,134
Location
an Aussie in Boston
Here is the code for unit naming.

## Naming Convention
## - ^civ4^ - no naming convention, uses standard civ4
## - ^rd^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^cv^ - Civilization
## - ^ut^ - unit (eg Archer)
## - ^ct^ - combat type (Melee)
## - ^dm^ - domain (Water)
## - ^ld^ - leader
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
##
## Where [f] can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)

I've also written a short document that illustrates some possible unit naming conventions. You can set a default naming convention that is used for all units via the options screen. You can also set a different naming convention for each combat type from the options screen. If you select, 'Advanced', then the combat type naming conventions are ignored (note: the default naming convention is NOT ignored). The Advanced option allows you to set different naming conventions by ERA and by UNIT TYPE. You will need to edit the BUG Mod.ini file directly, these options are not available from the options screen.

Edit: Note that we changed some of the counting conventions so the above doesn't work for v3.6 (or maybe earlier) onwards. See this post for more details.
 

Attachments

  • BUG Unit Naming v2.zip
    23 KB · Views: 438
reserved for options screen shot.
 
keep it in the family. I was thinking that we should have a thread here that touches on the components of our mod ...

- dom adviser
- logger
- main screen
- city screen
- etc
 
keep it in the family. I was thinking that we should have a thread here that touches on the components of our mod ...

I agree, at least for the one still under development.

What about the idea to ask the admin to move the old thread inside this folder?
 
Here is the code for unit naming.

Not tried yet in the game, but I'm reading the readme and it looks great! :goodjob:

The only thing that I have to say is that I fear it may be a bit confusing using [n] for generic attribute when we already have ^n^ for no naming convention and [n] (a real 'n' in this case) for 'number' as an attribute.
I suggest using something else, maybe even a capital N will be better.
I think it doesn't appear in the code, so it's only a doc's problem.
 
I'm sorry to say that it seems not to work for me.
What I did was to go to option screen and to check the box for using the unit renaming component, i left unchecked the advanced box, and I left all the text boxes as they were (so, the first one with ^u^ ^cnt[r]^ of ^ct^ and all the other one with "DEFAULT").
I built a couple of warriors, but they are still called simply "warrior" (well, the Italian word for "warrior").
I've missed something? :confused:
 
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader
##
## Where [f] is the number format and can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)
 
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader
##
## Where [f] is the number format and can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)

better ^_^
what about ^cv^ for civilization (as ^ct^ is for city) and maybe ^st^ (for 'standard') or ^v^ (stands for 'vanilla') instead of ^civ4^? And, if you want to completly avoid using the same letter in 2 places, maybe ^rn^ instead of ^r^ for random name.
 
Unit Naming bug fixes complete. I have also changed the logic behind how it searches for the naming convention / code.

  • look for ERA_UNIT naming convention in ini file (you have to manually edit these in the ini file, way too many options to put on screen
  • if not found, or returns DEFAULT, look for COMBAT naming convention
  • if DEFAULT, look for DEFAULT naming convention

Unfortunately, I cannot get the python code to read the ERA_UNIT value directly from the ini file HELP EF!!!

I'll update my word doc and give some more counting examples tonight.
 
Unfortunately, I cannot get the python code to read the ERA_UNIT value directly from the ini file HELP EF!!!

I'll update my word doc and give some more counting examples tonight.
Problem fixed by removing some comments or some such. Doesn't make a lot of sense but it works.

I also updated the zip file in the first post.
 
Problem fixed by removing some comments or some such. Doesn't make a lot of sense but it works.


Now it works properly ^_^
And it seems to be really great! :goodjob:

Note: some of the "default" values in the ini file are already replaced by some code, is it intentional?
 
re the 'defaults' ... yes, I was just playing. I fully expect people to change them.
 
Ehm, I'm a bit dumb, but I didn't get the true behaviour of tt1 and tt2.

Let's look at your Borg example (I think tou had to put "n" instead "f" in this, but doesn't matter):

^cnt[f]^ of ^tt1[f][6:10]^, Unimatrix ^tt2[f][1]^

Scout 1 of 7, Unimatrix 1
Worker 2 of 7, Unimatrix 1
Galley 3 of 7, Unimatrix 1
Bomber 4 of 7, Unimatrix 1
Axeman 5 of 7, Unimatrix 1
Swordman 6 of 7, Unimatrix 1

So, ^cnt[f]^ counts over all units (regardless of unit type, combat type and domain), from 1 to a random number chosen between 6 and 10, in this case 7.
I get it. But what about tt2?. It starts as 1 and stays equal to 1 until tt1 resets to 1? If it works in this way, the next unit will be something like:

Archer 7 of 7, Unimatrix 1
Bowman 1 of 9, Unimatrix 2

Correct? :confused:
 
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization

## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader

I've just realized that in your readme you report a different one:

• ^rd^ - random name
• ^rc^ - random civ related name
• ^ct^ - City
• ^cv^ - Civilization
• ^ut^ - unit (eg Archer)
• ^ct^ - combat type (Melee)
• ^dm^ - domain (Water)
• ^ld^ - leader

so... what are the correct ones? :confused:
 
I've just realized that in your readme you report a different one:

• ^rd^ - random name
• ^rc^ - random civ related name
• ^ct^ - City
• ^cv^ - Civilization
• ^ut^ - unit (eg Archer)
• ^ct^ - combat type (Melee)
• ^dm^ - domain (Water)
• ^ld^ - leader

so... what are the correct ones? :confused:

Oh, answering to myself, i suppose that the correct one is the one included as a comment inside the file itself, so this one:

## - ^civ4^ - no naming convention, uses standard civ4
## - ^rd^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^cv^ - Civilization
## - ^ut^ - unit (eg Archer)
## - ^cb^ - combat type (Melee)
## - ^dm^ - domain (Water)
## - ^ld^ - leader

So, I'll update the readme with that cb :)
 
Ok, so I started a new game, and I choose to leave all the naming convention set to DEFAULT, and to set the DEFAULT box to :
^ut^ ^cntu(n)^ (^ct^)
So, I expected that my firs Settler will be called something like:
Settler 1 (Rome)
instead I get a random name... where is my error? :confused: :blush:
 
Ok, so I started a new game, and I choose to leave all the naming convention set to DEFAULT, and to set the DEFAULT box to :
^ut^ ^cntu(n)^ (^ct^)
So, I expected that my firs Settler will be called something like:
Settler 1 (Rome)
instead I get a random name... where is my error? :confused: :blush:

Open the "BUG mod.ini" and find these lines:

Code:
# Advanced optional naming conventions based on ERA and UNIT CLASS

ANCIENT_SETTLER = ^rd^

This is a setting that is not accessible via the in-game option, but overrides whatever you specify there. Changing "^rd^" to "DEFAULT" in the ini should do the job.
 
Top Bottom