War Prizes

Now Updated to fix the odds!

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...

Yeah it seems odd. Still, killing the crew on the ships is the rationale I place behind losing the promotions on the unit when captured. It's more the crew that's trained, not the ship, right?
 
Now Updated to fix the odds!



Yeah it seems odd. Still, killing the crew on the ships is the rationale I place behind losing the promotions on the unit when captured. It's more the crew that's trained, not the ship, right?

Yeah. Anyways, I included this mod in my modmod pack for Rise of Mankind, (I credited you.). It seems to work fine now.
 
Download it and it works great. Would you be open to adding a text pop up when a ship is captured? Something like "We've taken an enemy ship as a prize!" and "One of our ships has been taken as a prize!" if you or the enemy wins and gets a prize out of the deal?
 
Ummm.... I don't know how to do that. It may be a simple modcomp, but I struggled with it.
 
Try putting this after the last line:
Code:
if (playerX.isHuman()):
	CyInterface().addImmediateMessage("We've taken an enemy ship as a prize!", "")
elif (playerY.isHuman()):
	CyInterface().addImmediateMessage("One of our ships has been taken as a prize!", "")

This is untested and I'm a complete noob, but it should work. If you want a full blown window, then you'll have to ask someone who knows how. :D
 
No, I don't want a window. That may gt annoying if you have large stacks of naval units fighting.

Thanks for the code, I'll test it now.
 
Hey Flintlock,

I can't get the message part you wrote to work. Where does it have to be in relation to the last line? Tabbed over, far left, etc.? Does that even matter?
 
It should just look like this:
PHP:
## mechaerik War Prize ModComp START##
		pPlayer = gc.getPlayer(pWinner.getOwner())
		pPlayerLoser = gc.getPlayer(pLoser.getOwner())
		if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
			if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):
				if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):
					if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
						if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
							if CyGame().getSorenRandNum(100, "Bob") <= 25:
								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())
								if (pPlayer.isHuman()):
									CyInterface().addImmediateMessage("We've taken an enemy ship as a prize!", "")
								elif (pPlayerLoser.isHuman()):
									CyInterface().addImmediateMessage("One of our ships has been taken as a prize!", "")
		## War Prize Modcomp END##

I changed the code to not use playerX and playerY, but there still could be some syntax errors.
 
It should just look like this:
PHP:
## mechaerik War Prize ModComp START##
        pPlayer = gc.getPlayer(pWinner.getOwner())
        pPlayerLoser = gc.getPlayer(pLoser.getOwner())
        if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
            if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):
                if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):
                    if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
                        if not (unitY.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_PRIVATEER")):
                            if CyGame().getSorenRandNum(100, "Bob") <= 25:
                                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())
                                if (pPlayer.isHuman()):
                                    CyInterface().addImmediateMessage("We've taken an enemy ship as a prize!", "")
                                elif (pPlayerLoser.isHuman()):
                                    CyInterface().addImmediateMessage("One of our ships has been taken as a prize!", "")
        ## War Prize Modcomp END##
I changed the code to not use playerX and playerY, but there still could be some syntax errors.

I just tried those new lines, but it didn't work for me. (lost my UI.) Here's what my code looks like:

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") <= 15:
                                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())
                                if (pPlayer.isHuman()):
                                    CyInterface().addImmediateMessage("We've taken an enemy ship as a prize!", "")
                                elif (pPlayerLoser.isHuman()):
                                    CyInterface().addImmediateMessage("One of our ships has been taken as a prize!", "")
## War Prize Modcomp END##
 
Just add instead of the already suggested:
PHP:
CyInterface().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("TXT_KEY_WEHAVECAPTUREDSOMETHING",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
CyInterface().addMessage(pLoser.getOwner(),false,20,CyTranslator().getText("TXT_KEY_WEHAVELOSTSOMETHING",()),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), pLoser.getX(), pLoser.getY(), True,True)
 
What do I need to do to include this with BUG 4.0? They've removed the CvEventManager from the python files and spread it's old functions over several files...
 
What do I need to do to include this with BUG 4.0? They've removed the CvEventManager from the python files and spread it's old functions over several files...

I hear that, i dont like it either when they do stuff like that, just makes it more difficult for the ones that dont know exactly how to use python, no offense to the ones that do know it, cause it might be EASIER to THEM, but not for us middle people.:( Just cant leave well enough alone. Alot of python people are doing this in modcomps now, and i dont like it either. Just leave everything in CvEventManager and things would be fine.(my opinion).
 
I hear that, i dont like it either when they do stuff like that, just makes it more difficult for the ones that dont know exactly how to use python, no offense to the ones that do know it, cause it might be EASIER to THEM, but not for us middle people.:( Just cant leave well enough alone. Alot of python people are doing this in modcomps now, and i dont like it either. Just leave everything in CvEventManager and things would be fine.(my opinion).

Yeah, while I have no choice in the matter. Modmoder's don't get to decide what directions a mod takes (or doesn't take), we just go along with it. So I do need this fixed.
 
I hear that, i dont like it either when they do stuff like that, just makes it more difficult for the ones that dont know exactly how to use python, no offense to the ones that do know it, cause it might be EASIER to THEM, but not for us middle people.:( Just cant leave well enough alone. Alot of python people are doing this in modcomps now, and i dont like it either. Just leave everything in CvEventManager and things would be fine.(my opinion).

Yeah, I understand. I'm a modder too.

What do I need to do to include this with BUG 4.0? They've removed the CvEventManager from the python files and spread it's old functions over several files...

Well, I did a quick test, just dropping my CvEventManager into BUGs Python folder, and it worked fine.
 
@mechaerik, The_J, & Frekk - This modcomp looks awesome!!!!! I've been looking for something simple like this for a long time for Blood and Iron. I plan to add it in that you have a chance (smaller than 25%, more like 15%) that you can capture tanks if they lose! Awesome!
 
mechaerik, My ever helpful friend,

I'm trying to turn this into a game option. I already made the nessecary SDK changes, but I cannot seem to get the python to work. My code doesn't get any errors, but in game it makes no differance wiether the option is checked or not, I still get War Prizes. Could you look at my code and tell me what I'm messing up?

Code:
## mechaerik War Prize ModComp START##
		[B]if CyGame().isOption(GameOptionTypes.GAMEOPTION_WAR_PRIZES):[/B]
			pPlayer = gc.getPlayer(pWinner.getOwner())
			pPlayerLoser = gc.getPlayer(pLoser.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") <= 15:
									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())
									CyInterface().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("We've taken an enemy ship as a prize!",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
									CyInterface().addMessage(pLoser.getOwner(),false,20,CyTranslator().getText("One of our ships has been taken as a prize!",()),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), pLoser.getX(), pLoser.getY(), True,True) 
									return
## War Prize Modcomp END##
 
mechaerik, My ever helpful friend,

I'm trying to turn this into a game option. I already made the nessecary SDK changes, but I cannot seem to get the python to work. My code doesn't get any errors, but in game it makes no differance wiether the option is checked or not, I still get War Prizes. Could you look at my code and tell me what I'm messing up?

Code:
## mechaerik War Prize ModComp START##
		[B]if CyGame().isOption(GameOptionTypes.GAMEOPTION_WAR_PRIZES):[/B]
			pPlayer = gc.getPlayer(pWinner.getOwner())
			pPlayerLoser = gc.getPlayer(pLoser.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") <= 15:
									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())
									CyInterface().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("We've taken an enemy ship as a prize!",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
									CyInterface().addMessage(pLoser.getOwner(),false,20,CyTranslator().getText("One of our ships has been taken as a prize!",()),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), pLoser.getX(), pLoser.getY(), True,True) 
									return
## War Prize Modcomp END##


Just an absolute shot in the dark here, but try moving the

PHP:
if CyGame().isOption(GameOptionTypes.GAMEOPTION_WAR_PRIZES):

with the other if statements.

@mechaerik, The_J, & Frekk - This modcomp looks awesome!!!!! I've been looking for something simple like this for a long time for Blood and Iron. I plan to add it in that you have a chance (smaller than 25%, more like 15%) that you can capture tanks if they lose! Awesome!

I'd be honored if you put this in B&I.
 
Top Bottom