1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Svaltafar vs. Ljosafar

Discussion in 'Civ4 - Fall from Heaven' started by DarkxL0rd, Mar 17, 2010.

  1. DarkxL0rd

    DarkxL0rd Chieftain

    Joined:
    Mar 26, 2008
    Messages:
    262
    Location:
    Houston
    Playing a game tonight and I was absolutely determined to create a perm alliance with Faeryl. I was playing as the wood elves. I literally did everything she asked of me. want money? ok. go to war? no problem. switch to Esus? where do I sign. But to no avail. come turn 320 she declares on me. I know this was put in as coding that the elves fight each other, cuz i usually play dark elves and the wood elves declare around the same time in those games every time. How do I turn this off?!!!!! At one point in the game she was friendly toward me, and we were at war!
     
  2. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,942
    Location:
    Seyda Neen, Vvardenfell
    yeah, I agree that kind of scripted stuff sucks :D
     
  3. mahazel

    mahazel Chieftain

    Joined:
    Mar 19, 2008
    Messages:
    243
    Location:
    Kraków
    I read somewhere that when Armageddon counter reach 30 or something they'll declare war on each other (but maybe it's feature from modmod).
     
  4. esvath

    esvath Apprentice of Erebus

    Joined:
    Mar 27, 2008
    Messages:
    1,403
    I don't think that base FfH include specific behaviour code like this (Svart vs Ljos and vice versa). Or does it?

    One thing about Faeryl, she is very much backstabber. She will declare wars with anyone at Pleased (and I modmoded her so she will declare wars with anyone at Friendly too :D)
     
  5. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,942
    Location:
    Seyda Neen, Vvardenfell
    it certainly does have code like that :D
     
  6. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,954
    Location:
    St.Petersburg, Russian Federation
    It's in vanilla FFH and it's 30 AC, right. If it's in python, it should be pretty easy to change. Let me check.

    [EDIT] the code says it's 20 AC, and here it is.

    In CustomFunctions.py there is:

    Code:
    	def warScript(self, iPlayer):
    		pPlayer = gc.getPlayer(iPlayer)
    		iEnemy = -1
    		for iPlayer2 in range(gc.getMAX_PLAYERS()):
    			pPlayer2 = gc.getPlayer(iPlayer2)
    			if pPlayer2.isAlive():
    				iTeam = gc.getPlayer(iPlayer).getTeam()
    				iTeam2 = gc.getPlayer(iPlayer2).getTeam()
    				eTeam = gc.getTeam(iTeam)
    				if eTeam.isAVassal() == False:
    					if eTeam.isAtWar(iTeam2):
    						if CyGame().getSorenRandNum(100, "War Script") < 5:
    							self.dogpile(iPlayer, iPlayer2)
    					if self.warScriptAllow(iPlayer, iPlayer2):
    						if pPlayer2.getBuildingClassMaking(gc.getInfoTypeForString('BUILDINGCLASS_TOWER_OF_MASTERY')) > 0:
    							if eTeam.getAtWarCount(True) == 0:
    								self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    						if (pPlayer2.getNumBuilding(gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_DIVINE')) > 0 or pPlayer2.getNumBuilding(gc.getInfoTypeForString('BUILDING_ALTAR_OF_THE_LUONNOTAR_EXALTED')) > 0):
    							if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
    								if eTeam.getAtWarCount(True) == 0:
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    						if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_MERCURIANS'):
    							if pPlayer2.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
    								self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    						if CyGame().getGlobalCounter() > 20:
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    						if (CyGame().getGlobalCounter() > 40 or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_INFERNAL') or pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_DOVIELLO')):
    							if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
    								if (eTeam.getAtWarCount(True) == 0 and CyGame().getPlayerRank(iPlayer2) > CyGame().getPlayerRank(iPlayer)):
    									if (iEnemy == -1 or CyGame().getPlayerRank(iPlayer2) > CyGame().getPlayerRank(iEnemy)):
    										iEnemy = iPlayer2
    		if iEnemy != -1:
    			if CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iEnemy):
    				self.startWar(iPlayer, iEnemy, WarPlanTypes.WARPLAN_TOTAL)
    It makes elves to fight elves at 20 and evil players to declare war at 40. You can comment the whole thing out to prevent unpredictable wars like that but it would be less fun. Or you could just remove the "elves" part if you want. It does not break saves or something, you can actually make it right during the game (but I'd suggest to relaunch FFH2 just in case, python rarely causes weird things when operating during a running game).

    P.S. If you don't know what to do, better don't try to do it :). Or if you want it really, open CustomFunctions.py in notepad and look for 1192 string. Then remove or better comment out the following strings:
    Code:
    						if CyGame().getGlobalCounter() > 20:
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    
    To comment them out place "#" in front of every string.
     
  7. esvath

    esvath Apprentice of Erebus

    Joined:
    Mar 27, 2008
    Messages:
    1,403
    Oh yeah, found it in CustomFunctions.py under defwarScript.

    Here is the code :
    Spoiler :

    Code:
    						if CyGame().getGlobalCounter() > 20:
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    							if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR'):
    								if (pPlayer2.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR') and CyGame().getPlayerRank(iPlayer) > CyGame().getPlayerRank(iPlayer2)):
    									self.startWar(iPlayer, iPlayer2, WarPlanTypes.WARPLAN_TOTAL)
    


    Just delete this to disable it? Or, maybe, you can play as Ljos and capitulate Svart. I don't think this warScript works on capitulated civs.
     
  8. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,954
    Location:
    St.Petersburg, Russian Federation
    Eh. Esvath :mischief:
     
  9. esvath

    esvath Apprentice of Erebus

    Joined:
    Mar 27, 2008
    Messages:
    1,403
    Woops... Sorry double post with Deon :D
    (that doesn't count as double post, does it? So what we call? Ninja'ed?) :lol:
     
  10. DaveGold

    DaveGold Chieftain

    Joined:
    Dec 1, 2009
    Messages:
    1,058
    Does Van Gossarm have script to conquer religious cities? I was at +16 friendliness with him, same religion, no red attitude markers, no land border, and he moved his troops to attack me just about the turn he sneaked ahead of me on the military chart. This surprised me since almost all the opponents were pleased or friendly with me and he was the smallest and weakest with just 3 cities. He lasted only ten turns more before he became my vassal of course.
     
  11. Lone Wolf

    Lone Wolf Chieftain

    Joined:
    Dec 4, 2006
    Messages:
    9,865
    Nope. I think so, at least.
     
  12. DarkxL0rd

    DarkxL0rd Chieftain

    Joined:
    Mar 26, 2008
    Messages:
    262
    Location:
    Houston
    So i kept playing the game thinking, "ok I'll just beat her around a bit and then get peace and try again." So we play nice for 20 turns and she declares again! If it was just at 20 AC that's fine. but she seems determined to stay at war even though she has 5 cities compared to my 12 and is vastly out troop'd and out tech'd. Thanks for the responses however, I don't know how to mess with that stuff too well and I don't want to break anything. Someone said something about taking out the "elves" line? How is that done?
     
  13. Earthling

    Earthling Chieftain

    Joined:
    Nov 9, 2008
    Messages:
    8,518
    To be fair, the Svartalfar who refuse to be redeemed and rejoin civilized elven society are despicable traitors unworthy of living amongst the maggots of their dying forests' rotten logs...

    (I actually rather can live with the AI scripted events that bring on set antagonisms/Good vs. Evil etc...and in fact modmoding with a little more prodding to get the AI to more often choose the right religion/civics and so on is/would be very nice, not having RoK and FoL everywhere)
     
  14. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,954
    Location:
    St.Petersburg, Russian Federation
    There're other scripts which are not in Python but in SDK, something like "50 turns passed? I need to declare war", and I think they are there from BTS, because BTS had many things like these.
     
  15. Skyre Noktis

    Skyre Noktis Chieftain

    Joined:
    Apr 28, 2009
    Messages:
    271
    There's nothing like this in the SDK. If they declare on you again after 50 turns, it's because they still think war against you is a good idea for whatever reason (or they were bribed).
     
  16. esvath

    esvath Apprentice of Erebus

    Joined:
    Mar 27, 2008
    Messages:
    1,403
    Well, whenever I play Ljos or Svart, and the other one also exists, I always attack and capitulated it. Then, I force it to convert into my state religion (FOL or Esus, whichever I play). Then, I demand their mana. Mana is nice IMHO :D

    If the diplo modifier is too negative (and the vassal always ask their mana back) then I kill them. As simple as that. No peaceful coexistence between Ljos and Svart :D
     
  17. Deon

    Deon Lt. of Mordor

    Joined:
    Jan 13, 2008
    Messages:
    2,954
    Location:
    St.Petersburg, Russian Federation
    Are you sure? I am almost certain I saw it in CvGameCoreDLL, basically from time to time AI picks a player and declares a war. Maybe it's removed in FFH2 or I saw SDK of another mod, I don't remember, but it was by Firaxis :).
     
  18. Breunor

    Breunor Chieftain

    Joined:
    Jul 2, 2004
    Messages:
    2,388
    Location:
    Earth
    Maybe Monteczuma? He seems particularly crazy. I don't know, just speculating here.

    Best wishes,

    Breunor
     
  19. Skyre Noktis

    Skyre Noktis Chieftain

    Joined:
    Apr 28, 2009
    Messages:
    271
    At the end of CvTeamAI::AI_doWar, it has the code where the AI decides whether to start a war, but it's not completely random by any means. The problem with the scripted Python events is that they force AI civs to declare when they're not ready. It can also lead to war on multiple fronts, which is something the code in the DLL actively tries to avoid, i.e. it'll only start a new war if it's not already fighting one.
     
  20. Arralen

    Arralen Chieftain

    Joined:
    Jan 16, 2008
    Messages:
    69
    Would it be "helpful" if the script would gradually build up anger, instead of outright triggering a war?
    Like e.g. checking the Armageddon Counter every 10 turns, and adding anger level depending on AC, religion, race etc. ... some of the good/neutral guys might panic if the AC gets too high and they're surrounded by evil neighbours ;)

    For the exact values of the thresholds I would look at the Hell Terrain effect, which is what would be most prominently visible to everyone:

    Hell Terrain will only spread to Ashen Veil players lands until the counter hits
    25, then it will start to spread to unowned tiles. At
    50 it will start to spread to other Evil players lands and at
    75 it will start to spread to Neutral lands.


    So e.g. Svaltafar might getting really nervous and think it would be better to unite all elves at AC 50 if they have the "usual" religion, and Ljosafar even only at AC 75 ... and not at 20 ?!

    Sadly, I don't have a clue 'bout Civ scripting, and Python in general, so I don't know if this is feasible.

    The current state, though, is highly annoying and needs to be changed!
    Guess why I dug up this thread!? ;)
     

Share This Page