War Prizes

@Affores: Could you try to print the bool value from the option check into the logs or add a message ingame with it?

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

:yup: me too.
 
to be honest, this modcomp makes the game a lot easier vs AI players.
 
to be honest, this modcomp makes the game a lot easier vs AI players.

How? The AI and the Player have exactly the same odds of capturing a ship? How is it good for the player?

@The_J, and mechaerik.
I'll try both your suggestions.
 
because the AI don't know about this. the AI will continue suicide attacks with bad odds and lose their units.

there is imo only one time where the AI has advantages from this: when the AI is already more powerful than you (better units = techleader).

This modcomps strengthens the powerful even more.
 
I haven't had AI suicide itself, it only fights when the odds are in its favor. Also you can reduce the percentage to 10 percent or so to decrease the odds of taking the ship, it becomes a flavor thing at that point.
 
mechaerik,
If I may offer a suggestion for this modcomp; There are times when this modcomp produces unrealistic or strange results. Consider this scenario:

The AI has a galley with .5hp/2hp
I attack it, win and recieve a "war prize" galley, with 1hp/2hp.

The galley I received is twice the health of the one I attacked. That means during the battle, it magically healed. (I know, I know. In reality, that ship sunk, and a new ship was generated with 50% health.)

But really, a check should be preformed. If the enemy ship, before the attack has >=50% health, continue as normal. If the enemy ships before the attack has <50% health, the new ships health should be at least the same health as the old ship before the battle, to avoid strange results.
 
Hmmm.... good point. Perhaps I should lower the health to 1/4 instead of 1/2 and make it so only units with above 1/3HP can be captured.

Any thoughts on this?

And did what I say work in your previous post?
 
I added it into Blood and Iron and this modcomp works great. I've modified it to better suit the needs of the mod though - now nearly all land units can capture, but only certain units (early tanks, armored cars, artillery) can be captured. I also made the odds much less that this ever happens (5%) and cut down the HP of captured units (5%) so you pretty much have to take them back and heal them in your territory. So far with testing it seems to be working pretty well. Don't know if it will throw things too far in the human player's favor for B&I though, there's not too many kinds of units so both sides are fairly evenly matched (until the invention of tanks or the discovery of stormtrooper tactics).

Thanks again guys!
-Smitty
 
And did what I say work in your previous post?

Oh, I have not gotten it to work. Your suggestion, I'm afraid, didn't work. I'm going to double check my SDK, but I'm pretty sure if it was that, I would have gotten an exception...
 
Hmmm.... good point. Perhaps I should lower the health to 1/4 instead of 1/2 and make it so only units with above 1/3HP can be captured.

Any thoughts on this?

You should just get the unit health, and re-apply the half of it.

but only certain units (early tanks, armored cars, artillery) can be captured.

:hmm: why not also late tanks?
 
:hmm: why not also late tanks?

Because Blood and Iron focuses on WW1 - there are no late tanks!

I meant early to mean 'WW1 era tanks.' There are two types of tanks in the mod - 'tanks' (meaning the 1st generation - Mark IV, A7v, etc) and 'light tanks' (2nd generation - Renault FT17, LK.II, Whippet MkA, etc). Both types can be captured, as they often were during the actual war.
 
Presumably it would need a different set of code...but as an extension of this would it be feasible to have it so that if land troops capture a port with ships in, there would be a chance to capture the ships
 
Yeah, I had thought about that even before I released it... but The_J wasn't sure it could be done, so I abandoned it.
 
Because Blood and Iron focuses on WW1 - there are no late tanks!

Ah, sorry, i missunderstood the post.

Presumably it would need a different set of code...but as an extension of this would it be feasible to have it so that if land troops capture a port with ships in, there would be a chance to capture the ships

Yeah, I had thought about that even before I released it... but The_J wasn't sure it could be done, so I abandoned it.

Did i really say, that it can't be done :think:?
It can be done, but needs a dirty hack in onCombatResult, because the ships are already destroyed when you capture the city.
 
Here's the PM from the conversation:

The_J said:
mechaerik said:
Awesome! Thanks. Is there a way to make it so that they can be captured after you capture a city (i.e; not all naval units in the city are destroyed)?

mmhh...i'm not sure.
Depends on several things.
- Could be attached to onCityAcquired/andKept/razed, but i guess, this is to late, because the ships are then probably already destroyed.
-> Would have to be attached to onCombatResult. Would need a check, how many defenders are in the city (if there's a city), and then you would have to grab every ship, and let the dices roll for it.
Maybe a bit complicated, and more a type of hack.

If you want to try it, you'll need the Python API. If you don't want, i'll maybe try it after my current request.


I suppose the "I'm not sure" is what led me to believe you didn't know if it could be done. I checked zebra9's BtS API, but I don't even know what i'm looking for.
 
mmmhh...okay, in the PM i was wrong at this point :D :blush:.

Like said, you can't do this, when you've already entered the city, because the ships are then already destroyed, so you have to check after onCombatResult, if you've now defeated the last defender, and that code is really ugly:

Spoiler :
PHP:
	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())
###Capture Palace Art Start####		
                iX = pLoser.getX()
                iY = pLoser.getY()                        
                myplot = CyMap().plot(iX,iY)
                if myplot.isCity()==True:
                        pCity = myplot.getPlotCity()
                        if pCity.isCapital():
                                iPlayer = pCity.getOwner()
                                pPlayer = gc.getPlayer(iPlayer)                        
                                WinnerPlayer = gc.getPlayer(pWinner.getOwner())
                                iThisTeam = WinnerPlayer.getTeam()
                                ThisTeam = gc.getTeam(iThisTeam)
                                NumDef = 0
                                for i in range (gc.getMAX_PLAYERS ()):
                                        CurPlayer = gc.getPlayer(i)
                                        iCurTeam = CurPlayer.getTeam()
                                        if iThisTeam ==iCurTeam:continue
                                        if ThisTeam.isAtWar(iCurTeam):                                                
                                                CurDef = myplot.getNumDefenders(i)                                                
                                                NumDef = NumDef+CurDef
                                                if NumDef >=2:
                                                        break                                
                                if NumDef<=1:
                                 Now all are killed....


If done that for another mod, and i really don't like this code.
 
mechaerik,

I thought you might want to hear about an interesting game I saw with War Prizes. I was testing out some changes in my modmod, and had set the war prizes chance to 100%. I had forgotten about this, and set the AI to autoplay for 2k turns. When I came back a few hours later, the game was in AD 1951, but the AI was significantly farther behind than normal, I'm assuming because of all the extra naval units. Basically, that change meant that Naval units couldn't be killed, only change hands which lead to, as I watch some of the turns play out, very interesting never-ending naval combat. I'm guessing there was 2 naval units for every land unit. This is not exactly what I had in mind (I usually set the chance to 15%, as War Prizes is more of a flavor thing to me.) Anyways, War Prizes, when set to 100% capture odds definitely leads to a significantly different game, one that I never envisioned.
 
mechaerik,

I thought you might want to hear about an interesting game I saw with War Prizes. I was testing out some changes in my modmod, and had set the war prizes chance to 100%. I had forgotten about this, and set the AI to autoplay for 2k turns. When I came back a few hours later, the game was in AD 1951, but the AI was significantly farther behind than normal, I'm assuming because of all the extra naval units. Basically, that change meant that Naval units couldn't be killed, only change hands which lead to, as I watch some of the turns play out, very interesting never-ending naval combat. I'm guessing there was 2 naval units for every land unit. This is not exactly what I had in mind (I usually set the chance to 15%, as War Prizes is more of a flavor thing to me.) Anyways, War Prizes, when set to 100% capture odds definitely leads to a significantly different game, one that I never envisioned.

Something like that would be insane on Archipelago maps.
 
mmmhh...okay, in the PM i was wrong at this point :D :blush:.

Like said, you can't do this, when you've already entered the city, because the ships are then already destroyed, so you have to check after onCombatResult, if you've now defeated the last defender, and that code is really ugly:

Spoiler :
PHP:
	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())
###Capture Palace Art Start####		
                iX = pLoser.getX()
                iY = pLoser.getY()                        
                myplot = CyMap().plot(iX,iY)
                if myplot.isCity()==True:
                        pCity = myplot.getPlotCity()
                        if pCity.isCapital():
                                iPlayer = pCity.getOwner()
                                pPlayer = gc.getPlayer(iPlayer)                        
                                WinnerPlayer = gc.getPlayer(pWinner.getOwner())
                                iThisTeam = WinnerPlayer.getTeam()
                                ThisTeam = gc.getTeam(iThisTeam)
                                NumDef = 0
                                for i in range (gc.getMAX_PLAYERS ()):
                                        CurPlayer = gc.getPlayer(i)
                                        iCurTeam = CurPlayer.getTeam()
                                        if iThisTeam ==iCurTeam:continue
                                        if ThisTeam.isAtWar(iCurTeam):                                                
                                                CurDef = myplot.getNumDefenders(i)                                                
                                                NumDef = NumDef+CurDef
                                                if NumDef >=2:
                                                        break                                
                                if NumDef<=1:
                                 Now all are killed....


If done that for another mod, and i really don't like this code.

Couldn't the check be done in the onUnitKilled function. Looking at the SDK code this should be called for the ships in the cities when they are captured. I will test this tonight if I get a chance.
 
Couldn't the check be done in the onUnitKilled function. Looking at the SDK code this should be called for the ships in the cities when they are captured. I will test this tonight if I get a chance.

I looked at onUnitKilled and the problem is that it doesn't tell you what unit caused the unit to be killed. Looking at the SDK code there is you could just use the <Capture></Capture> tags already in the CIV4UnitInfos.xml. All you would need is to add a precent chance to capture tag with that and update the code to set the damage to what you want. It's not an all python mod, so that wouldn't work for everyone, though.
 
Top Bottom