War Prizes

Yeah, that wouldn't really work well. As it stands, this is just a simple 1 file python modcomp, and most people would like it better that way, rather than more complicated SDK.
 
Hmmm ... this looks like a good addition to my mod.

How to I add it to my mod ? Are their any instructions, which files do I change etc. etc.

do I simply add the section between
Code:
## mechaerik War Prize ModComp
in the exact same section as in my CvEventManager.py

Also can I make minor changes to suit my mod as I have unit combat armor
 
I believe that that is all you need. Search the file for the word "mechaerik", I commented all the changes with that.

Making minor changes is easy. An example was given here.
 
I'm trying to merge it with my 2 mods in my signature. The other mods I have in it are AirCombat Experience/Mine Warfare at the moment. The game loads fine, but nothing is every captured during combat.

Does it have problems with BUG? I plan on mergig with RevDCM in the future.
 
BUG changes the Event Manager, it basically gets rid of it (actually it splits it up into many, many files IIRC).
 
What would I need to change to make the event text display the unit type that is captured? I thought it was just Unit.getname() put after the text in eventmanager.py, but that didn't work. Then I tried changing the civilopedia text to %s3_unit (or something), but that didn't work either.
 
Hi,

I am trying to find out how to add this mod to RevolutionDCM. Can someone point me to a good tutorial or explain to me how this can be done?

Many Thanks,

Spellbinder
 
Here is the mod adopted for BUG 4.4 installed as standalone. I removed the barbarian if statement, so now barbarians will capture your ships:

Spoiler :

WarPrizes.py:
PHP:
## War Prizes

from CvPythonExtensions import *
import CvUtil
import PyHelpers
import CvAdvisorUtils
import CvTechChooser
import BugCore
import BugUtil
import CvEventInterface

gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
PyCity = PyHelpers.PyCity
PyGame = PyHelpers.PyGame

class WarPrizesEvent:

	def __init__(self, eventMgr):
		self.eventMgr = eventMgr
        	eventMgr.addEventHandler("combatResult", self.onCombatResult)
			

	def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
## mechaerik War Prize ModComp START##
		pPlayer = gc.getPlayer(pWinner.getOwner())
		pPlayerLoser = gc.getPlayer(pLoser.getOwner())		
		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().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("TXT_KEY_WEHAVECAPTUREDSOMETHING",()),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
							elif (pPlayerLoser.isHuman()):
								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)  
## War Prize Modcomp END##

War Prizes.xml:
PHP:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="WarPrizes" 
	 name="WarPrizes"
	 module="WarPrizes"
	 author="-" 
	 version="-" 
	 date="-"
	 url="-">	
	
	<events module="WarPrizes" class="WarPrizesEvent"/>

	<gameutils/>
       	
</mod>




 
Here is the mod adopted for BUG 4.4 installed as standalone. I removed the barbarian if statement, so now barbarians will capture your ships:

Spoiler :

WarPrizes.py:
PHP:
## War Prizes

from CvPythonExtensions import *
import CvUtil
import PyHelpers
import CvAdvisorUtils
import CvTechChooser
import BugCore
import BugUtil
import CvEventInterface

gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
PyCity = PyHelpers.PyCity
PyGame = PyHelpers.PyGame

class WarPrizesEvent:

	def __init__(self, eventMgr):
		self.eventMgr = eventMgr
        	eventMgr.addEventHandler("combatResult", self.onCombatResult)
			

	def onCombatResult(self, argsList):
		'Combat Result'
		pWinner,pLoser = argsList
		playerX = PyPlayer(pWinner.getOwner())
		unitX = PyInfo.UnitInfo(pWinner.getUnitType())
		playerY = PyPlayer(pLoser.getOwner())
		unitY = PyInfo.UnitInfo(pLoser.getUnitType())
## mechaerik War Prize ModComp START##
		pPlayer = gc.getPlayer(pWinner.getOwner())
		pPlayerLoser = gc.getPlayer(pLoser.getOwner())		
		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().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("TXT_KEY_WEHAVECAPTUREDSOMETHING",()),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
							elif (pPlayerLoser.isHuman()):
								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)  
## War Prize Modcomp END##

War Prizes.xml:
PHP:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="WarPrizes" 
	 name="WarPrizes"
	 module="WarPrizes"
	 author="-" 
	 version="-" 
	 date="-"
	 url="-">	
	
	<events module="WarPrizes" class="WarPrizesEvent"/>

	<gameutils/>
       	
</mod>





Cool! :cool:
 
one more tweak. adopted from my basic expanded mod...siege units can be captured. Add after the first IF statement above. Also, I tweaked the message code.
Spoiler :

Code:
		if (unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_SIEGE")  or unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_RECON") or unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_HELICOPTER") or unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_NAVAL") or unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_AIR") or unitX.getUnitCombatType() != gc.getInfoTypeForString("UNITCOMBAT_BIOLOGICAL")):
			if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_SIEGE")):
				if CyGame().getSorenRandNum(100, "") <= 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().addMessage(pWinner.getOwner(),false,20,CyTranslator().getText("TXT_KEY_MISC_WARPRIZES_SUCCESS",(pLoser.getName(),)),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_BLUE")), pWinner.getX(), pWinner.getY(), True,True)
					elif (pPlayerLoser.isHuman()):
						CyInterface().addMessage(pLoser.getOwner(),false,20,CyTranslator().getText("TXT_KEY_MISC_WARPRIZES_FAILURE",(pLoser.getName(),)),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), pLoser.getX(), pLoser.getY(), True,True)
 
What would I need to change to make the event text display the unit type that is captured? I thought it was just Unit.getname() put after the text in eventmanager.py, but that didn't work. Then I tried changing the civilopedia text to %s3_unit (or something), but that didn't work either.

Not sure if you still need this, but I managed to get it to display the type of unit correctly for my SETI Program wonder.

unitX = PyInfo.UnitInfo(Unit.getUnitType())
Then unitX.getDescription() is the code u need to stuff into the text code

In fact, this method is used commonly in the default BTS eventmanager.
Look at onCombatResult for example
 
Not sure if you still need this, but I managed to get it to display the type of unit correctly for my SETI Program wonder.

unitX = PyInfo.UnitInfo(Unit.getUnitType())
Then unitX.getDescription() is the code u need to stuff into the text code

In fact, this method is used commonly in the default BTS eventmanager.
Look at onCombatResult for example

in my post above about capturing seige weapons "pLoser.getName()" works.
 
Platyping, Could you please enter the code in here and highlight if possible?

Code:
		pPlayer = gc.getPlayer(pWinner.getOwner())
		pPlayerLoser = gc.getPlayer(pLoser.getOwner())
		if not (gc.getPlayer(pWinner.getOwner()).isBarbarian()):
			if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_MELEE")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_GUN")) or (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_ARCHER")):
				if (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")) or (unitY.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_SIEGE")):
					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())
 
Top Bottom