Unit Renaming and WB Saves

Hey guys, found a bug that needs fixing. Use this python file instead.

Before, empty names were being saved as the unit description. Which means when loaded it would come up as Cavalry (Cavalry).

This fixes it so if the unit's name is empty, then it does not save the UnitName field. :)
 
Dale: might be a new bug now. I renamed the units at Pearl Harbor in my scenario to test it out, but when I reloaded I got "BB Arizona (Battleship) (Battleship)" when it should obviously just have one Battleship tag. The names are being saved correctly though.
 
Nah, I've asked Alex to put it in the next patch. ;)

:Faints:

Do you have any kind of timeframe for the next patch?
 
Dale: might be a new bug now. I renamed the units at Pearl Harbor in my scenario to test it out, but when I reloaded I got "BB Arizona (Battleship) (Battleship)" when it should obviously just have one Battleship tag. The names are being saved correctly though.

No that's the same bug. It was saving the full name + type, instead of the entered name + type.

Sorry. Don't worry, the easiest way to negate all UnitName keys in the WBS (in other words flush all the UnitName entries like I had to do in a new RtW scenario) is to remove the python file from the mod, and then save a new WBS file. That'll get rid of all the UnitName entries.
 
:Faints:

Do you have any kind of timeframe for the next patch?

Sometime in the future. I don't know their plans, just that my emails to Alex still get read. :p
 
Wow! I have been asking about this functionality since the first week BtS came out! Thank-you so much for making it work. This is a GIGANTIC upgrade, now those WW2 scenarios can actually start with all the divisions, armies, and warships named and in position.

Uh... next question.... could you now create an event that is triggered by a particular unit?
 
No that's the same bug. It was saving the full name + type, instead of the entered name + type.

So is it supposed to be taken care of in your new file? Because I still get the same problem... (I'm looking into fixing it, however.) ;)
 
Okay, I have edited Dale's Python script to account for the unit type. Instead of getting that extra (UNIT NAME HERE) tag, it will now correctly save only the unit's actual name.

I have tested this and did not find any bugs, but it is good to double-check. :)
 

Attachments

Okay, I have edited Dale's Python script to account for the unit type. Instead of getting that extra (UNIT NAME HERE) tag, it will now correctly save only the unit's actual name.

I have tested this and did not find any bugs, but it is good to double-check. :)

GO, your script will only work in your situation where you saved it under the original script I produced.

The new one I produced does not save the unitType in the description. Thus, your's will keep reducing the unitName on subsequent saves. :)
 
Dale, check it again to be sure. The second file you posted does save the unit type with the WB! ;)

EDIT: It can't keep reducing the names upon every save, since I've tested it. In fact, I've already added my unique unit names to WWII in the Pacific, and I saved it probably upwards of 20 times in the process. The names appear just fine. :crazyeye:
 
I just checked my script, and it works fine. I've compared all three (mine, yours and what I posted up above) and all three are different. I can only conclude I uploaded the first one again above.

The one posted above uses unit->getName() which includes the unitType, yours then strips out the unitType, but mine (attached to this post) which is what should've be uploaded before, uses unit->getNameNoDesc() which doesn't include the unitType.

I get this:
Code:
BeginPlot
	x=46,y=32
	TerrainType=TERRAIN_PLAINS
	PlotType=2
	BeginUnit
		UnitType=UNIT_SETTLER, UnitOwner=0
		UnitName=John
		Damage=0
		Level=1, Experience=0
		FacingDirection=4
		UnitAIType=UNITAI_SETTLE
	EndUnit
	BeginUnit
		UnitType=UNIT_SETTLER, UnitOwner=0
		UnitName=Name Test
		Damage=0
		Level=1, Experience=0
		FacingDirection=4
		UnitAIType=UNITAI_SETTLE
	EndUnit
	BeginUnit
		UnitType=UNIT_SETTLER, UnitOwner=0
		Damage=0
		Level=1, Experience=0
		FacingDirection=4
		UnitAIType=UNITAI_SETTLE
	EndUnit
	TeamReveal=0,1,2,3,4,5,6,7,8,9,10,11,
EndPlot

So, my code is right, I just uploaded the wrong one before. :blush:
 
Dale, check it again to be sure. The second file you posted does save the unit type with the WB! ;)

EDIT: It can't keep reducing the names upon every save, since I've tested it. In fact, I've already added my unique unit names to WWII in the Pacific, and I saved it probably upwards of 20 times in the process. The names appear just fine. :crazyeye:

Yeah sorry, I thought the script WAS using getNameNoDesc() which would've produced the correct result, then with you removing characters from the end would've been wrong.

I was wrong, as I explained above. :)
 
Yeah, I figured it was just some kind of snafu. :mischief:

So I guess we have two versions that work, not that it really matters, since this will be in the next patch. Anyways, I'm glad to see that we can finally give our armies real names for our scenarios now!

:cheers:
 
One very minor point...

Using this ability to give historical tags to units is that the tag itself is used in the combat log to refer to units, rather than their actual types. So you end up with logs like "Your Squadron 222 shot down a German 1./JG 26 unit." :crazyeye:

------------------------

EDIT

On the other hand, there is a benefit in that the actual units involved can be better identified this way, especially in my project where many units of the same type are involved. This is particularly true to air units.
 
It's possible to have the combat logs display the unit type rather than the unit's specific name.

Would also be possible to have them display "Unit Name (Unit Type)"... so you could say "Our Bismark (Battleship) has killed an enemy HMS Hood (Battleship)" *I mean Battlecruiser!* ;)
 
It's possible to have the combat logs display the unit type rather than the unit's specific name.

Would also be possible to have them display "Unit Name (Unit Type)"... so you could say "Our Bismark (Battleship) has killed an enemy HMS Hood (Battleship)" *I mean Battlecruiser!* ;)

Even cooler would be "Our Battleship 'Bismarck' has killed the enemy Battleship 'HMS Hood.'" ;)
 
Back
Top Bottom