Announcement

Collapse
No announcement yet.

Question about AI Modification

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about AI Modification

    I have three questions:

    1) I want to make it where if a trespassing enemy unit is killed within my territory, it is not necessarily an act of war. Especially if the enemy has agreed to remove troops in the past and still is not. This has been a particular problem where one neutral civ had warships blocking my ports. I asked them to leave and they consented, but stayed there while another civ destroyed improvements at will because I could not get my fleet out of port. I did not want to go to war with the neutral civ if I did not have to as we had a trade pact and the two civs together would have been too powerful. Can I edit that parameter somewhere?

    2) Can I put an "Are you sure?" message in for if I accidently attack an allied player's unit by moving into it. I ran into one by accident, and all the work I had done get that player to ally with me was lost when he declared war in outrage.

    3) Also, how do you tell an allied player to move his unit if it is blocking your road? My ally sent troops into my territory (I guess to help defend me), but after the battle, fortified them on my main unit transfer road.

    BTW, I like the Apolyton Pack and the terrain mods. One square island cities were the best in the original game because they could not be attacked until later and they had food, production and commerce. Removing the production from sea spaces and river spaces adds more realism.

    Thanks!

  • #2
    *bump*

    This was probably written when there was noone in the forum. I found it when looking for stuff for the hidden nationality.
    As for the third idea - that's something for diplomacy and i'll just keep my hands of that.
    Nr.2 seems to me as it would be rather easy - if we can check if a unit.owner is allied with the player. Can we?
    Nr.1 Part of it is solved by the slic that automatically removes landunits, can we extend that to naval units?

    Comment


    • #3
      2) You can use this from Peter Triggs notes:
      INT GetEffectiveRegard(int, int) [regard adjusted for being at war]

      INT GetTrust(int, int)

      ---------------
      Azmel2 [Richard Myers]:

      Both attitude [regard] and trust are on a scale from 0 to 1000.
      The break down is as follows:

      0 - 100, hot war (Goals with TargetOwner: HotEnemy)
      101-300, cold war (Goals with TargetOwner: ColdEnemy)
      301-700, neutral (Goals with TargetOwner: Neutral)
      701-900, friend
      900-1000, allied

      The first three also say which goals will be pursued against foreign nations that you have a particular attitude toward. For example, you'll only do HotEnemy goals against foreigners you have a regard of 100 or less with. Going to war will also induce an automatic hotwar regard.
      Trust is on the same scale. An AI will not sign certain treaties or agreements unless trust or regard is above a certain point. That can be redefined using your own diplomatic response logic.
      Do you want me to e-mail some notes Peter Triggs gave me about dilomacy and the Richards Meyer (CTP2 AI Creator) interview?
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #4
        Actual for number one I prefer the modifying of the goals.txt concerning the retreat goal:

        Code:
        GOAL_RETREAT {
          ExecuteIncrementally
          NeverSatisfied
        
          SquadClass:CanAttack
          SquadClass:CanDefend
          SquadClass:HasZoc
          SquadClass:CanCaptureCity
        
          TargetType:City
          TargetOwner:Self
        
          Execute	ORDER_MOVE
         
          ThreatBonus			    0
          EnemyValueBonus		    0
          AlliedValueBonus		    0
          PowerBonus			    0
          DistanceToHomeBonus	    0
          DistanceToEnemyBonus	    0
          ChokePointBonus		    0
          UnexploredBonus		    0
          ObsoleteArmyBonus		    0
          TreaspassingArmyBonus 1200000 //MG from 10000 add to -300000 base priority to a priority of 900000
        
          ThreatenType:None
          ThreatenBonus 0
        
          // no force matching to retreat
          ForceMatch:Special 
        }
        That should make to retreat the AI troops, actual I think I saw this.

        -Martin
        Civ2 military advisor: "No complaints, Sir!"

        Comment


        • #5
          seems like a good thing to have diggen this one out...
          As for nr.1 I just read in another post by Dale, that the automatical retreat of naval units was also done. I never saw it in my gameplay though - is it not included in SAP or GM?

          Comment


          • #6
            Originally posted by mapfi
            As for nr.1 I just read in another post by Dale, that the automatical retreat of naval units was also done. I never saw it in my gameplay though - is it not included in SAP or GM?
            AFAIK Dale removed it, because the AI tried to move through the territory again and again instead of moving around. As the withdraw script is part of DiploMod 3.6 it is in both mods. As Dale did it.

            -Martin
            Civ2 military advisor: "No complaints, Sir!"

            Comment


            • #7
              So you're saying your solution in the goal.txt will work for both types of units?

              Comment


              • #8
                If i understood this correctly:

                TreaspassingArmyBonus - Flat bonus given if squad is trespassing

                Then this bonus is added to the base priority in strategies.txt of this goal. So you have a base priority of -300000 in the strategies.txt. The original value is 10000 that would be just a total priority of -290000 that is still the lowest priority of all goals. The consequence the AI will never consider to execute this goal. Therefore I changed the bonus to 1200000 that will be a total priority of 900000 for the goal retreat if the army is trespassing. This priority is as high as the settle goal. It will effect all military units, units that can attack, can defend, can capture cities and have Zoc. So this will also effect water units maybe accept the transporter, but an empty transporter should be considered as civilian and as it can't pirate your trade routes, it should be ok.

                -Martin
                Civ2 military advisor: "No complaints, Sir!"

                Comment


                • #9
                  Code:
                    SquadClass:CanAttack
                    SquadClass:CanDefend
                    SquadClass:HasZoc
                    SquadClass:CanCaptureCity
                  It will currently work for units that can do all of the above. Ships can't capture, have no ZOCs, and most can't attack, so it won't work for them. Remove those lines and it might though
                  Concrete, Abstract, or Squoingy?
                  "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

                  Comment


                  • #10
                    Only land units get zapped by the withdraw script. I did this because quite often I'd see an AI trespass/zap/trespass/zap/tresspass/etc for the rest of the game, just to get a naval unit through some straights that I controlled both sides of.

                    Comment


                    • #11
                      Couldnt you make the Naval zapping more tolerent than the land one

                      What I mean is could you make it so that the AI had 4 or so turns before they got zapped out of your naval territory this way they would have more time to get through and explore or whatever weird stuff the AI might like to do?
                      Oxygen should be considered a drug
                      Tiberian Sun Retro
                      My Mod for Tiberian Sun Webmaster of
                      http://www.tiberiumsun.com

                      Comment


                      • #12
                        by Martin TreaspassingArmyBonus - Flat bonus given if squad is trespassing
                        Is the definition of tresspassing limited to having withdrawal agreement or also tresspassing borders when having a ceasefire or a peace treaty?
                        Because if the second one is the case Martin's solution would screw up the AI's ability to get onto you.

                        Smiffgig's:
                        I think that should be possible - would have to be tested out if it works in the desired way though.

                        Comment

                        Working...
                        X