10 Archers and 5 Catapults.. in 1 unit: Here's how..

Snoopy

Prince
Joined
Aug 4, 2001
Messages
522
Location
New Zealand
ArcherCat.jpg



I've been going through the xml files quite a lot lately, and discovering many wonderful things :D (Thanks Firaxis, u were thinking ahead. :lol: ).


It's all in the UnitInfos XML, go to the Settlers row, find UnitMeshGroup, in there you will see how the Settler unit is created. (remember, there are 3 models to make up the Settler unit, Man, Woman, Child).

Just apply this same coding to another unit, but change the define tags accordingly.

If you want to add more 'men' to the unit, you just simply change the number in iGroupSize.

To create the unit above, this is what it looks like for the Archer row:

UnitMeshGroups.gif



Just recently I have made a few leaps and bounds with the Formations XML file, so I will be working on making them look more lined up.
 
That looks pretty realistic if they can be lined up better.
I would like to create a tank unit with infantry off to the sides.
 
AlCosta, the formations xml file is not that powerful, I highly doubt that will be possible.

So far I have worked out that you can change the position of where ALL the men are standing (but not individually) and a random variation of the direction each man faces on their individual standing spots.
 
Assets\Python\pyUnit\CvUnitController.py

That seems to be where the formation is being programmed? But
Code:
	if iNumAlive > 5:   # We can't handle more than 5 sub-units...
		return 0;

seems to prevent it? Or is this code not even used?
 
Lehawk said:
Assets\Python\pyUnit\CvUnitController.py

That seems to be where the formation is being programmed? But
Code:
	if iNumAlive > 5:   # We can't handle more than 5 sub-units...
		return 0;

seems to prevent it? Or is this code not even used?


Oh, so they call them sub-units.

So what happens if you change the 5 to 100? Will it allow that?
 
Snoopy said:
Oh, so they call them sub-units.

So what happens if you change the 5 to 100? Will it allow that?

I tried changing things, but nothing happened. It may be defunct code.
 
I was thinking of how to use this. Snoopy said "you can change the position of where ALL the men are standing (but not individually)"... but in the screenshot the catapults are clearly all to one side. So, it at least seems to group the units from a single entry together. So, I was thinking, what if you did:

2 Swordsmen
1 Archer
1 Catapult
1 Archer

Would it place the archers on opposide sides of the formation? (I'd try this myself, but I'm at work.) This'd make a pretty nice-looking ancient-era army, actually; a 5-unit pentagon wouldn't look that much like a circle, especially if you could rearrange it so that the swordsmen were always in the front. You could do this with later eras, too; a line of musketmen would have pikemen/halberdiers to cover them, or maybe cannons behind.
 
I have plan to make middle age warband. Every vassalage of king had their own army or better word is warband. It's cool to have knight, crossbowmans and maccemans as your vassallagae army group.

How do you change the size of units? As i remember correctly you did it in another post...
 
Snoopy said:
Oh, so they call them sub-units.

So what happens if you change the 5 to 100? Will it allow that?


In my game at least, that code is not being used as CvUnitInterface (which imports CvUnitController , which is where that code is) is not imported at all. I've confirmed this via the inbuilt python console and the hap debugger.

While it is possible to manually import that module via the console, the ProcessEvent function is still never called. I'm disappointed by this as I had some ideas which needed the ability to process entityevents.
 
Hahaha, that's genious! Firaxis was really thinking ahead when making these (now I can add infantries to my tanks), now I'm beginning to like XML and the whole Python thing even more, although I had sooo much prejudice at first!
 
Back
Top Bottom