What about in-game unit customisation?

snarko said:
It's not an ideal solution, but you should be able to remove the spear upgrade if you get the sword upgrade using CyUnit.setHasPromotion(spearpromotionindex#, False)
Hold on now there, are you saying we can switch off promotions when you get another promotion? If so, can you explain it a tiny bit more?

Please!

Pretty please!

I've been trying to work out phython enough to do that for quite a while now. It'll put the number of things I have to work out for what I want to do down to 1 :D
 
The Great Apple said:
However, it seems to me that this idea falls short when you want a choice between two very similar promotions. For example, if I wanted to equip my guy with either a spear OR a sword, with no possablilty of both, then this method doesn't work - your guy could end up with both a spear and a sword.

No, it still works just fine, IF the weapons fall in a simple hierarchy. That is, if Sword > Spear, then think of Spear as Combat I and Sword as Combat II. Your unit would start off with two promotions; one would replace his default wooden club with a Spear, and the second would replace the spear with a Sword. And, as Snarko said, there's probably a simple way to toggle off the display of the promotion.

The two big problems with this sort of system for Civ4:
1> Graphical. All of the units in an upgrade chain would be the same core unit, really, although you could use differing graphics depending on the number of promotions the unit starts with. But still, there'd be no way to tell an offensive unit from a defensive one without seeing its promotions. Even if you allowed players to read the enemy units' promotions, it's still not something you can get from a casual glance at the units.
2> Weapons aren't quite so linear in this game. In SMAC, the weapons followed a simple progression, each more powerful than the one before. (Except for the Psi attack, that is, and the Resonance Laser/Bolt in SMACX.) So, which is better: a sword, an axe, or a mace? Now, if you can remove promotions, or make them mutually exclusive (i.e., you can upgrade from Spear to (Sword OR Axe OR Mace), but once you choose one the other two are blocked) then it's still workable.
 
While this is a great idea, you can't say that a spear is more powerful than a sword.

I would rather wield a spear than a sword if I had to attack a horse.

What you should do instead is do it in terms of metal type and type of spear/sword/etc
 
The Great Apple said:
Hold on now there, are you saying we can switch off promotions when you get another promotion? If so, can you explain it a tiny bit more?

Please!

Pretty please!

I've been trying to work out phython enough to do that for quite a while now. It'll put the number of things I have to work out for what I want to do down to 1 :D

You can't switch them off afaik, but you can remove them if the unit have them.
To test it so I wasn't lying to you here's what I added to CvEventManager under onUnitPromoted:

if iPromotion == 0 and pUnit.isHasPromotion(24):
[tab]pUnit.setHasPromotion(24, False)
[tab]pUnit.setLevel(pUnit.getLevel() - 1)
elif iPromotion == 24 and pUnit.isHasPromotion(0):
[tab]pUnit.setHasPromotion(0, False)
[tab]pUnit.setLevel(pUnit.getLevel() - 1)

What this does is check if the unit have promotion 24 (city garrison I) and just got promotion 0 (combat I). If it does then it'll remove city garrison I and level down the unit so it'll get back the lost promotion. The unit can then be given a new promotion the next turn.

Same thing but in reverse in the elif.

If you want it to be able to get a new promotion the same turn add pUnit.setPromotionReady(True)

This is far from prefect. You could swap the unit between promotions each turn, giving it combat I one turn and then city garrison I the next. You would however miss out on a promotion to be able to do so since you need to have one ready to be able to make the switch.
 
Couldn't you make it so that certain "upgrade" promotions (like weapon type, etc) would just cancel out any previous promotions of the same type and add its own special bonus? You could even add a new promotion attribute for the type, like unit types. For example if you had a foot soldier unit, and added promotions for bronze weapons and iron weapons, you give both promotions the weapon attribute and add some code that will disable any previous promotions with that attribute. So when you give your bronze weapon soldier the iron weapons promotion, it just cancels out the bronze weapon bonuses.
 
Can you change units' gfx as a result of promoting them? That would open up a LOT of possibilities....
 
The only way I know how to change the graphic based on upgrades is to force the unit to upgrade into a new unit.
 
snarko said:
The only way I know how to change the graphic based on upgrades is to force the unit to upgrade into a new unit.
Curses. I'm sure it will be workable somehow. I find the trouble is with this sort of thing, is that it's amazingly simple to do something, and when it's in front of you it's obvious, but it's really quite hard to work out how to do it in the first place...

EDIT: Just realised that it depends on how you want to do it. For my purposes, merely changing one man in maybe a squad of 5 to look different is good enough. Civ 4 already supports different meshes in a squad (see the settler), so a slight adaptation of this may be workable.

Thanks very much for explaining the other bit. Everytime somebody explains a bit of Civ-python I understand a little bit more :)
 
Snoopy said:
While this is a great idea, you can't say that a spear is more powerful than a sword.

Sure I can, although it would be an oversimplification. In a 1-on-1 battle, sure, each has its own pros and cons. But we're working on a strategic level, where it's force-on-force. And in that environment, I'd say that a well-trained army of swordsmen was superior to a similarly-trained army of spearmen (see also: Roman legions vs. Greeks, although the Romans probably had a significant experience edge); while their formation holds together, they're at a big advantage, but when they inevitably get flanked, or someone breaks formation, or a lucky hit opens a hole in the wall, what happens?

You're right that the spearmen would have an edge vs. mounted units, which is why pikes and halberds remained in use long after swords had been relegated to cavalry weapons. But, on a practical level, how would you put that into a free-form customization system like we're talking about here? You'd have to maintain separate unit types for each of these categories, which'd greatly reduce the number of upgrade steps you could fit into the system, which brings you right back to the Civ method of pre-packaging the units.

Make the early unit types be "Spear", "Melee", "Archer", and "Mounted". Each gets a +50% bonus versus one of the other types, in a circle: Mounted beats Archer beats Melee beats Spear beats Mounted. Each unit type has its own series of offensive and/or defensive promotions, each of which follows simple rules; Melee, for instance, might go Club-Axe-Sword-Mace for offense (which purely add to attack), and Bronze/Iron/Steel armors for defense. Spear units could use the same defense promotions, but their "offense" promotions (Pike, Halberd) add mostly to defense as well. At the other extreme, Archers get almost no defense but can go further with offense promotions.

Of course, this whole promotion-based system really makes things screwy when you're thinking about the long-term upgrades. For instance, in Civ3, I tweaked things a bit, so that the Swordsman upgrade chain went like this:
Warrior (1/1) -> Swordsman (3/2) -> Medieval Infantry (5/3, at Chivalry, with the Samurai as a UU replacement) -> Marine (6/4amphib, at Navigation; amphibious troops DID exist long before the Industrial Revolution, after all) -> Paratrooper (10/6 amphib drop, at Advanced Flight) -> Power Armor (don't ask).
Now, in that context, how would upgrading work? The only way to get a graphical change between the middle ages and the gunpowder units would be to upgrade the base unit, subtracting a number of promotions in the process (i.e., a Marine is equivalent to a 7-promotion Warrior, so a Medieval Infantry (a 4-promotion Warrior, with two promotions each on offense and defense) would need 3 more promotions to exchange for a 0-promotion Marine, but what do you do with a 6-promotion Warrior if the later upgrades aren't available on your existing "chassis"? You'd have two unusable promotions, unless you had the Barracks do both types of upgrade simultaneously. To get around this, you'd have to allow every unit level to theoretically reach each upgrade, and simply state that 0-4 promotions uses the "low-tech" base unit, 5-9 uses the "gunpowder" base unit, and 10+ uses the "high-tech" base unit. Which, in turn, means that you'd have things like a gun-toting unit with no defense still using the primitive graphics.

Plus, this means you have to code two different types of upgrading into the game engine (not a minor task).
 
Back
Top Bottom