War Prizes

mechaerik

Tuturuu!
Joined
Oct 28, 2008
Messages
7,064
Location
Los Angeles
You have seen Slavery modcomps before that give you, well Slaves. But have you seen War Prizes?

This simple Modcomp gives you and the AI a chance to capture Naval Units instead of destroying them upon a combat victory. This means that if your Galley beats someone else's Galley, you might walk away with an extra galley. This works both ways, so they might also get another galley if you lose.

FEATURES
Spoiler :
~~ Barbarians cannot capture the units. They have no chance to.

~~ Only Naval units can capture other naval units. Why add in this line? So ICBMs, TacNukes, and Guided Missiles can't capture units.

~~ Privateers cannot capture or be captured.

~~ The chance to capture is by default 25%.

~~ By default, Captured units start with 50 HP.

~~ UUs CAN be captured. This means you can see Russian Carracks and Byzantine East Indiamen!

~~ All promotions on the unit captured are removed.


I've included a README that goes in detail how to mod the code.

CREDITS
Base Python Code: Frekk. This ModComp is partially based on his Enslavement Modcomp.
Concept/Python Work: mechaerik. I reworked most of the code and came up with the concept.
Help/Python Knowledge: The_J. He pointed me in Frekk's direction and helped write and fix parts of the code



DOWNLOAD:http://forums.civfanatics.com/downloads.php?do=file&id=13083

DOWNLOAD WAR PRIZE MODCOMP WITH SIEGE:
http://forums.civfanatics.com/downloads.php?do=file&id=13088
 
Version History:

War Prizes:

1.2 August 24th (Current Version)
1.1 August 23rd (taken down to fix odds bug)
1.0 August 22nd (taken down to squash a bug with Privateers)

War Prizes with Siege:

1.2 August 24th (Current Version)
1.1 August 23rd (taken down to fix odds bug)
1.0 August 23rd (Taken down to fix parentheses error)
 
This looks like an interesting concept, one I may use somewhere...

How hard do you think it would be to change this so that any unit, or different units other than naval units, can be captured, such as siege units as The Capo mentioned above?
 
How hard do you think it would be to change this so that any unit, or different units other than naval units, can be captured, such as siege units as The Capo mentioned above?

Very easy. Just change this:
Code:
if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):

to this:

Code:
if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_SIEGE")):

then add something similar to the line above it, but replace unitY (which is the losing unit) with unitX.




EDIT: Going through the code made me find a bug that does let privateers capture units. I'll upload the new version right now. I'll also upload one that lets siege be captured.
 
Okay, I'm trying to merge this with RoM's eventmanager, but I lose my interface (which means I'm not adding it correctly.) I had to make a few changes to it, because RoM uses different UNITCOMBAT's than BTS, but otherwise, it is pretty much the same. Any ideas of what I'm doing wrong? Here's what my code is
Spoiler :

Code:
## mechaerik War Prize ModComp START##
		pPlayer = gc.getPlayer(pWinner.getOwner())
		if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
			if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
				if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
					if not (unitX.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
						if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
							if CyGame().getSorenRandNum(100, "Bob") <= 75:
     							iUnit = pLoser.getUnitType()
								newUnit = pPlayer.initUnit(pLoser.getUnitType(), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
								newUnit.finishMoves()
								newUnit.setDamage(50, pWinner.getOwner())
## War Prize Modcomp END##
 
Great work. Is it possible to limit its effects to Age of Sail vessels? Is it possible to make some vessels more apt to claim another (like ship of the line?).

Would you just remove the OR tags from steam and nuclear vessels?
 
@Aforress Try this:

Spoiler :
Code:
## mechaerik War Prize ModComp START##
		pPlayer = gc.getPlayer(pWinner.getOwner())
		if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
			if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
				if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
					if not (unitX.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
						if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
							if CyGame().getSorenRandNum(100, "Bob") <= 75:
							iUnit = pLoser.getUnitType()
								newUnit = pPlayer.initUnit(pLoser.getUnitType(), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
								newUnit.finishMoves()
								newUnit.setDamage(50, pWinner.getOwner())
## War Prize Modcomp END##
 
@Aforress Try this:

Spoiler :
Code:
## mechaerik War Prize ModComp START##
        pPlayer = gc.getPlayer(pWinner.getOwner())
        if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
            if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
                if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_WOODEN_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_STEAM_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_DIESEL_SHIPS")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NUCLEAR_SHIPS")):
                    if not (unitX.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
                        if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
                            if CyGame().getSorenRandNum(100, "Bob") <= 75:
                            iUnit = pLoser.getUnitType()
                                newUnit = pPlayer.initUnit(pLoser.getUnitType(), pWinner.getX(), pWinner.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
                                newUnit.finishMoves()
                                newUnit.setDamage(50, pWinner.getOwner())
## War Prize Modcomp END##

That code doesn't work... Does it have something to do with the parenthesis? Yours was missing some originally, so I added some, but maybe I was wrong to do that.
 
Does it have something to do with the parenthesis? Yours was missing some originally, so I added some, but maybe I was wrong to do that.

!! You are right. I've uploaded a new version which fixes the parentheses error. Perhaps something on my end was wrong, but the ModComp works now, perhaps you should try making it again with the new version.
 
I just tested, you have your capture percentages backward. You mentioned that ships have a 25% chance of capture, but the python you wrote gives a 75% chance of capture. I checked. To test, I set the code to 0:
Code:
if CyGame().getSorenRandNum(100, "Bob") <= 0:

and according to your readme, that would give 100% chance of capture, but it didn't. It made it so ships were never captured. I tested this on 20-30 ships.
 
This modcomp seems a bit similar to the UnitAllegiance-modcomp :)

I just looked at that modcomp. It's outdated, correct? Anyways, It seemed interesting, but I would have made changes to it. When your units surrendur (or defect), the enemy should just accept them immediately. I would make them POW. (It's different with ships, you can just kill the crew and take the ship itself.) I know if the enemy defected to me, I wouldn't believe them. After all, if they can defect once, they can defect again. Oh, and the civic "Nationalism" should have made all units 100% loyal.

But I digress...
 
Top Bottom