[MOD] More Naval AI

I second the motion for an improved diplomacy. Howsoever, I'm not volunteering since I lack any programming skills. I'd - nonetheless - very much appreciate if someone would be so kind to step forward to put some work into that. :D
 
Looks like there might be a spot in doImprovementUpgrade() where PrereqCiv is not being checked. I'll fix it for the next release and you'll have to let me know if that solves the problem.
Since the Citadel of Light was basically just a copy of the Citadel improvement, it had the <bOutsideBorders>1 tag. This is what lets forts be built outside of cultural borders in vanilla civ, and Kael reused it to allow improvements to upgrade without needing to be worked by a city (which I think would probably have been better as a separate tag).

I'm thinking that PrereqCiv was being checked, just not as I expected. The presence of the civ was still a prereq, but combined with <bOutsideBorders>1 things outside their borders (even within other player's borders) upgraded the same as things within. Citadels of Light were not restricted to Malakim territory, but I never actually saw the Citadels upgrade when there was not a Malakim player present in the game.

This opens up some potentially interesting mechanics, like making it so that Entropy Nodes could turn into Hellfire while the Infernals are around or so that the presence of a Sheaim civ could cause Bradeline's Well to close and turn the Paradise of Nemora into the Deadlands. I'm not so sure that they are interesting enough for me to actually use them though. Those are probably things that are best left to less predictable events or restricted to scenarios where python would work better.


I decided to change <bOutsideBorders>1 to <bOutsideBorders>0 for the Citadels of Light, and it stopped showing up where it was not wanted. At first I was a bit annoyed that I had to build forts within a city radius and work Citadels instead of more productive tiles if I wanted them to upgrade, but then I realized I could instead use Python. I had originally intended the Citadel of Light to be a replacement rather than an upgrade of a normal Citadel, so I just added a few lines of code to CvEventManager.py under def onImprovementBuilt(self, argsList) and have it working just fine. I still left it as an upgrade too, so citadels near enough to captured cities to be worked can upgrade without needing python to check the whole map every turn. (I did the same for the Grigori's unique Farm upgrade, the Homestead.)

I'm happy enough with how I have it working now and do not particularly care whether or not you fix it so it could work as I had expected before.



While we are on the subject of Citadels, do you happen to know much about the LSystem? As I mentioned in Modders Guide to FfH2 thread, I have not had much luck trying to use CIV4PlotLSystem.xml to give the improvement unique art (that of the Bannor and Calabim palaces) for different religious eras. I could use python to switch them with appropriate looking replacements but it does not seem worth it unless I decide to give them significantly different abilities.
In CivilizationInfos I see that you have all of the disciples listed as possible units for the Barbarian civ. I think this might be causing some issues.
By issues do you just mean those units spawning, or something more serious?

The basic disciples were still blocked, but I guess I forgot about things like Radiant Guards which had their state religion prereq moved to python so that I could override it for overcouncil members once the Enlist the Radiant Guard Resolution has passed. I have blocked them too now. I went ahead and blocked the priests and high priests too, although the state religion prereqs should be enough. (I am considering letting priests be built but not have access to their spells without the right state religion.)

I would personally prefer allowing the Barbarians to build Disciples of Acheron and Sons of the Inferno in cities with the Cult of the Dragon present, rather than using python to generate them them as in vanilla FfH2. Is there any way to allow this while still preventing them from spawning before the religion is founded, or when the game option should prevent it from being founded?

One way I just thought of would be to give those units Cult of the Dragon State religion prerequisite and use python to force the Barbarian State to adopt said state religion when Acheron is built. (Every other leader would still have a -100 weighting towards it and so never be able to adopt it.) Is that a possibility? What kind of problems would a barbarian state with a state religion cause?




----------

I recently decided that I would like to make Lord of the Balors a sort of regicide game, where killing the Avatars of each of the Demon Lords would kill the player and hand over all of their units and cities to the Barbarian state.

Currently the code im ScenarioFunctions.py is like this:
Spoiler :
Code:
	def onUnitKilled(self, pUnit, iAttacker):
		if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_WB_LORD_OF_THE_BALORS):
			if pUnit.isAvatarOfCivLeader():
				if not pUnit.isImmortal():
					if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_INFERNAL'):
						bPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())
						pPlayer = gc.getPlayer(pUnit.getOwner())
						py = PyPlayer(pUnit.getOwner())
						for pLoopUnit in py.getUnitList():
							newUnit = bPlayer.initUnit(pLoopUnit.getUnitType(), pLoopUnit.getX(), pLoopUnit.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
							newUnit.convert(pLoopUnit)
						for pyCity in py.getCityList():
							pLoopCity = pyCity.GetCy()
							bPlayer.acquireCity(pLoopCity,False,False)
						pPlayer.setAlive(False)
Do I need to be worried about it causing any problems?

Note that I am using the Always Open Borders game option, all the Infernal players are at peace with the Barbarian State, all the other players are at war with them, and that every player is set to PermanentWarPeace with every other player which can be changed only by the temptation events that can give a human player temporary peace with a demon lord.


In my tests so far it seems to be working fine, except when the avatar is killed by a unit with Basium's Malleus Vindex equipment. There is code in def onCombatResult(self, argsList): that causes units killed by units with that promotion to loose their immortality and gain a promotion that prevents them from being resurrected until the equipment is destroyed. I assumed that the problem was that the unit was still considered immortal when it was killed but lost its immortality before being resurrected in its capital. However, removing the if not pUnit.isImmortal():conditional from the code I posted did not seem to change things.

Spoiler :
Code:
	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())


		iGodslayer = gc.getInfoTypeForString('PROMOTION_GODSLAYER')
		iAvatar = gc.getInfoTypeForString('PROMOTION_AVATAR')
		iMalleus = gc.getInfoTypeForString('PROMOTION_MALLEUS_VINDEX')
		iVBind = gc.getInfoTypeForString('PROMOTION_VINDEXBIND')
		iNetherblade = gc.getInfoTypeForString('PROMOTION_NETHER_BLADE')
		iNBind = gc.getInfoTypeForString('PROMOTION_NETHERBIND')
		iImmortal = gc.getInfoTypeForString('PROMOTION_IMMORTAL')
		iLife = gc.getInfoTypeForString('PROMOTION_LIFE3')


		if pWinner.isHasPromotion(iGodslayer):
			pLoser.setHasPromotion(iImmortal, False)
			pLoser.setHasPromotion(iLife, False)
			while pLoser.isImmortal():
				pLoser.changeImmortal(-1)
		elif pLoser.isHasPromotion(iGodslayer):
			pWinner.setHasPromotion(iImmortal, False)
			pWinner.setHasPromotion(iLife, False)
			while pWinner.isImmortal():
				pWinner.changeImmortal(-1)
			if pWinner.isHasPromotion(iAvatar):
				pWinner.kill(False, pLoser.getOwner())
		if pWinner.isHasPromotion(iNetherblade):
			pLoser.setHasPromotion(iNBind, True)
			pLoser.setHasPromotion(iImmortal, False)
			pLoser.setHasPromotion(iLife, False)
			while pLoser.isImmortal():
				pLoser.changeImmortal(-1)
[B]		elif pWinner.isHasPromotion(iMalleus):
			if (pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_UNDEAD')) or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON')) or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_UNHOLY_TAINT')) or pLoser.getReligion() == gc.getInfoTypeForString('RELIGION_WHITE_HAND') or pLoser.getReligion() == gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS') or pLoser.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL') or pLoser.getReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS') or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEATH1')) or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DIMENSIONAL1')) or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_ENTROPY1')) or pLoser.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON_POSSESSED'))):
				pLoser.setHasPromotion(iVBind, True)
				pLoser.setHasPromotion(iImmortal, False)
				pLoser.setHasPromotion(iLife, False)
				while pLoser.isImmortal():
					pLoser.changeImmortal(-1)[/B]



		elif pLoser.isHasPromotion(iNetherblade):
			pWinner.setHasPromotion(iImmortal, False)
			pWinner.setHasPromotion(iLife, False)
			while pWinner.isImmortal():
				pWinner.changeImmortal(-1)
			if isWorldUnitClass(pWinner.getUnitClassType()):
				pWinner.setHasPromotion(iNBind, True)
				pWinner.kill(False, pLoser.getOwner())

				gc.getPlayer(pWinner.getOwner()).AI_changeAttitudeExtra(pLoser.getOwner(),-1)

		elif pLoser.isHasPromotion(iMalleus):
			if (pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_UNDEAD')) or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON')) or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_UNHOLY_TAINT')) or pWinner.getReligion() == gc.getInfoTypeForString('RELIGION_WHITE_HAND') or pWinner.getReligion() == gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS') or pWinner.getReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL') or pWinner.getReligion() == gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS') or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEATH1')) or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DIMENSIONAL1')) or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_ENTROPY1')) or pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON_POSSESSED'))):
#				pWinner.setHasPromotion(iVBind, True)
				pWinner.setHasPromotion(iImmortal, False)
				pWinner.setHasPromotion(iLife, False)
				while pWinner.isImmortal():
					pWinner.changeImmortal(-1)



I'm also considering leaving the units and cities under the same player's control and simply changing the victory conditions so that only the units need to be killed, but I suspect that the same.
Edit: I just realized that if I use that approach I could instead change out all those lines counting how many Infernal players are alive to using pPlayer.getUnitClassCount(iDemonLord) to see if the units still exist.

I realize that this post is pretty specific to my modmod, so it may be better to reply to it in that thread.
 
Original FFH2 scenarios don't work with Naval AI mod installed? This is the only mod I've installed over vanilla FFH2 and before that, I could start scenarios, now I get an error message.
If that's the case, do I have to reinstall the whole thing from scratch if I want to play the scenarios? :/
 
Original FFH2 scenarios don't work with Naval AI mod installed? This is the only mod I've installed over vanilla FFH2 and before that, I could start scenarios, now I get an error message.
If that's the case, do I have to reinstall the whole thing from scratch if I want to play the scenarios? :/

Loading scenarios from the scenario screen as Kael intended does not work, but most of them will work just fine with this modmod if you open them directly from the files found under Assets\XML\Scenarios.

The exception is Lord of the Balors, in which you are immediately defeated before the game even starts. The problem seems to be caused by BUG no understanding how to deal with the empty player/team 3 slot.

(In my modmod I fixed it by adding Einion Logos to the game. That seemed easier than shifting players 4 through 11 down one place, especially considering that ScenarioFunctions.py frequently refers to the various players by their numbers.)

I believe that Tholal says he has fixed this compatibility issue too, but has not released an update since he did so.
 
Hi.
Is it possible that the Puppet State feature doesn't work sometimes? In my first Game with more naval AI, I have no option to make a puppet state (I have feudalism!) when conquering an enemy city (which he himself founded).
 

Attachments

yes, I'm sure. I also checked again in the game settings: the puppet state feature ist active, also revolutions. Is there another likely explanations what could have done wrong or does it just not work in my installation?
 
legendary, are u interested in using Naval AI for Multiplayer?

-> either vs. or comp stomp
 
I realize that this post is pretty specific to my modmod, so it may be better to reply to it in that thread.

And it will require some brainpower and time to look at the code. Not sure when I'll be able to look into that for you.

The exception is Lord of the Balors, in which you are immediately defeated before the game even starts. The problem seems to be caused by BUG no understanding how to deal with the empty player/team 3 slot.

(In my modmod I fixed it by adding Einion Logos to the game.)

Is that the most appropriate civ to add for that scenario? I just picked one at random.

Hi.
Is it possible that the Puppet State feature doesn't work sometimes? In my first Game with more naval AI, I have no option to make a puppet state (I have feudalism!) when conquering an enemy city (which he himself founded).

Since the Kuriotates only have 1 leader, there is noone else for you to setup as a Puppet.
 
@Tholal
Thank you very much for looking into it! I was thinking that there might be one of these minor leaders (like Anangantios for the Illians or Hafgan the Purger for the Clan) for the Kuriotates as well. It seems that there isn't (which is a pity). Or don't they work for the puppet state feature?

@Tasunke
well, generally I like playing FfH in MP. Yet, at the moment i can't find the time to play as regularly as is required for decent MP, so I'm sticking to SP for now. But thank you for asking ;)
 
My code seems to be working fine now (after switching to check that the avatar is alive rather than when it is killed), so you should probably focus your efforts elsewhere.


Can you think of a better choice than the Elohim to join the Lord of the Balors Scenario?

Both dwarven civilizations were busy being hit hard by the Hippus. The Khazad are too isolationist to hep anyway, and the Luchuirp had to deal with Auric. (The Bannor were hit even harder by Auric, but that was after Capria's army left.) Cassiel was too busy sacrificing himself to Auric to save his people. Cardith Lorda and Os-Gabella are busy waking their dragons and trying to stop Auric from waking Drifa. Tasunke was busy serving Auric, and then being served to Drifa. Hannah the Irin seems to have no interest in saving the world, and her religion is already taken by Keelyn. Falamar is too busy in The Dead Lands trying to stop Tebryn Arbandi from destroying the world. (Rhoanna is also keeping him busy, in bed.) Depending on the events of The Splintered Court, either elven civilization may be joining him.

The Lord of the Balors comes after The Wages of Sin (with The Radiant Guard just in between them), in which the Elohim were leading the war effort against the Infernal. Due to summoning Basium (which Einion strongly opposed), the Elohim are the least damaged by the war and in the best shape to continue fighting. Ethne the White dies by the Netherblade, so she could not go to the Fane, but Einion could. Einion is the leader of an order of monks who are quite adept in spiritual warfare. He may nor care for wars in general, but fighting demons and freeing the innocent souls they unfairly claimed seems appropriate enough.

The Pedia articles portray the Elohim as making peace with the Infernal once, but must have been before the events of Wages of Sin; Dain the Caswallawn is sent to convince a still-living Ethne the White to change her mind. The peace treaty also resulted in Einion's wife's brutal death, which was actually Valledia the Even's fault but which was blamed on the Infernal. It seems unlikely that the Elohim would wish to suffer a similar peace treaty with the Infernals again. Basium probably would not let them anyway. Einion despises Basium, but might well agree to join him in the Fane if only to make sure that the archangel fights there instead of places where he could do more collateral damage to the innocent. I like to think that Einion is glad to see Basium go to hell at the and not bother the mortal world again.
 
Ethne the White dies by the Netherblade, so she could not go to the Fane.

The peace treaty also resulted in Ethne's wife's brutal death

Ethne is homosexual ? Not that I have something against homosexuality per se, but it seem extremely akward in a medieval setting, even a fantastic one. If, say, Perpentach were homosexual I wouldn't bat an eyelid, but here I wonder if you didn't mistype the name.
 
I obviously intended to write Einion instead of Ethne.

It too easy to make that kind of mistake when both of a civilization's leaders names start with the same letter and are of identical length (in pixels, not letters).

I am fairly certain that the young queen Ethne never married.

Einion Logos technically killed his own wife, in an act of mercy. She had been tortured past the point any a mortal should have been able to bare, but her body was unable to die and her soul unable to escape until Einion dispelled the rune that the sorcerer Sammuel had inscribed on her. This Amurite necromancer had been convicted and sentenced to death for performing unapproved experiments that bore a strong resemblance to the ritual that Alexis used to become the first vampire. Valledia the Even pardoned his crime in exchange for him doing it again on Einion's wife, in order to frame the Infernals and drag the Elohim back into the war.

A strictly homosexual Perpentach would make the birth of Keelyn harder to explain, although considering how many minds are contained within his it would be odd if he had only one sexual affiliation.


Anyway, this discussion does not really have anything to do with this modmod.
 
so where do the elohim spawn?

I think its Malakim -- Balseraph -- Mercurian (at the moment)
 
I still remember back when Magister kept on mentioning his fabled mod in every post he made but never came around to posting it, so who would have guessed that after most other modders have abandoned this forum, it would be you that remained to add content? And I cant tell you how excited I was when I saw that Tholal has included revolutions and better AI in his own modmod, which happened to be my most favorite features of my second favorite Civ mod.

After returning to Civ after about two years of stopping and coming back to see the forums abandoned by most, I only expected to see others like me who just wanted updates or fixes to their game setup strolling through the dead thread. I was expecting to be rather sad to read the optimistic posts of those who dreamed big and later had to leave without fullfilling what they had proclaimed and it was sad, I admit, for the most part but you two had been keeping the mod that meant so much to me back in the day alive. I want to sincerely thank you (Tholal) and MagisterCultuum for continuing to work on this amazing mod, FFH, with your own modmods. THANK YOU!:thanx:
 
yea, I'd agree that its cool FFH2 mods are still being publicly released ;)
 
Could you change the AI so that it will no longer refuse to accept mana when it already has one source of that type? And also remove the block that prevents them from trading you any mana if you already have a source?

It is probably better to check the <bModifierPerBonus>1 tag rather than hard code it for BONUSCLASS_MANA. I see that some mana types do not have this tag, but I don't think there would be any problem with changing that.

(I'm currently playing Lord of the Balors and I have a lot of extra Life mana which I would like to gift to Basium, since the Basium unit have life affinity in my modmod. I find it really annoying that he won't take it even as a gift, and would really prefer if he would give me some extra fire mana for it.)

------

Edit:
I just got a python error
Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 962, in handleInput

  File "CvBUGMilitaryAdvisor", line 1195, in handleInput

  File "CvBUGMilitaryAdvisor", line 618, in showStrategicAdvantages

  File "CvBUGMilitaryAdvisor", line 707, in fillStratAdvGrid

  File "CvBUGMilitaryAdvisor", line 750, in addStratAdvUnits

  File "UnitUtil", line 377, in getKnownTrainableUnits

  File "UnitUtil", line 413, in canAnyCityBuildUnit

  File "UnitUtil", line 451, in canCityBuildUnit

ArgumentError: Python argument types in
    CyCity.isHolyCity(CyCity, int)
did not match C++ signature:
    isHolyCity(class CyCity {lvalue})
ERR: Python function handleInput failed, module CvScreensInterface

I believe it is caused by a line in UnitUtil.py under def canCityBuildUnit(unitInfo, city, eAskingTeam, checkBonuses=True): where you used city.isHolyCity(eReligion) when you meant city.isHolyCityByType(eReligion)
 
I'm very excited of this modmod, especially because of the improved AI and the Revolution/PuppetState Addon! I just tried the MagisterModMod (also a very exciting enhancement of ffh, thank you both very much!)
I experienced one oddity: I always play with the wildlands option activated, which should lead to more animals, especially in the start phase of the game. But in my recent tryout of the MagisterModMod i came across no animals in the first ~70 rounds. And coming to think of it in my previous "vanilla more naval AI" game with the same option activated I also just came across 2 elefants, but no bears, wolfs, tigers, spiders... Is there maybe a bug?
Becauce I had the experience in both games I think the reason might be in this modmod
 
Back
Top Bottom