Announcement

Collapse
No announcement yet.

[MOD] Airbase

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

  • [MOD] Airbase

    I've been trying to work out the best way to add airbases to the game.

    So far, I've worked out a way to allow airbases to be built in your own territory, but this isn't really what I wanted.

    I wanted to be able to build them on unclaimed territory or even in other friendly nations territory. But still need to do more work, to find the best way to do that.

    If anyone is interested in adding the ability to build them in their own territory to their game (I'm not sure if the AI will build them as well, but there is no reason that they wouldn't be able to if they decided to) then I'm including the files. (unzip them in your My Documents\My Games\Sid Meier's Civilization 4 folder)

    Once you have researched Flight then your workers will be able to build a airbase (in your own territory). It is far from perfect because it basicaly creates a improvement (with the graphics of a fort), and also creates a new unit on that plot (the airbase unit which can't move and uses the graphics of the carrier). But I think its better than nothing.

    Edit: for the lastest version, download tywiggins version (found later in this thread).
    Last edited by MW2; November 22, 2005, 04:33.

  • #2
    Good one!

    I noticed this missing as well, I used them often in civ3, I think that engineers should of at least had this option implimented.

    good luck, I look forward to the final version.

    Comment


    • #3
      I got this to work for you. I made quite a few changes.

      1. I created a new unit, "Army Engineer". It can only build Airbases. It has about the same combat abilities as "Infantry", but can't attack. It has 2 moves. It takes 175 hammers to build.

      2. The unit "Air Base" can no longer be built by cities. I also changed it so bombers can use the air bases, and increased the cargo capacity to 20, as well as some minor changes.

      3. I removed your "Air Base" improvement. The Army Engineer's build orders tell it to instantly build a road. (I made it build a road, because you can only build roads, railroads in territory outside your cultural borders, and railroads require coal)

      4. Whenever a Road gets built on a tile that has an Army Engineer(I couldn't find a way to require the Army Engineer to do it, but there has to be one present), the first Army Engineer in the stack is killed(if there is more than one), an "Air Base" unit is created, a fort is created, and the road is changed into a railroad. This is all done instantly.

      5. I also made it into a mod. Extract it into your C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Mods folder, then you can load it in the game.
      Last edited by tywiggins; November 19, 2005, 02:07.

      Comment


      • #4
        Thanks, I had thought about using roads somehow, but couldn't see a way for it to work correctly

        One problem I can see by having a quick look through your changes is that if a AI builds a Army Engineer and then if it uses that to build a airbase (or even if it places it on the same plot as one of its workers who then builds a road), the human player will end up getting the airbase not the AI. (the airbase is always given to the activeplayer)

        Changing it so that it gives the airbase to whoever is the owner of the Army Engineer rather than just the active player will be better but is still not perfect as it will still be given to the wrong player if a worker from a different nation builds a road in the same plot as a Army Engineer from some other nation; It will end up with the Army Engineer's nation getting a airbase in that plot.
        Last edited by MW2; November 18, 2005, 08:32.

        Comment


        • #5
          Are you sure? I'm almost certain that getActivePlayer will get the player id of whoever's turn it is. If I'm correct, then we should check to see if the owner of the army engineer is the activeplayer. If I'm wrong, then we also need to find the currentplayer some other way.

          I guess I will test this out in hotseat mode to find out for sure.

          Comment


          • #6
            Ok. I made a small change to it, and it works much better. The way I had it before the change, a worker from another civ could build a road on the same tile as your Army Engineer and would get the Airbase.(Your Army Engineer would be lost if he didn't have any of his own on that tile)

            Now, whenever you build a road(whether by the workers build road order, or by the Army Engineer's build airbase order), it will check to see if you have an Army Engineer on that tile. If you do it will create the airbase and kill your first Army Engineer. If you don't it will just build the road.

            I have now tested this in singleplayer mode, and in hotseat multiplayer mode. It works as expected.
            Last edited by tywiggins; November 20, 2005, 06:10.

            Comment


            • #7
              I'm not sure exactly what getActivePlayer does, at first I thought it did what you think...gets the player who turn it is.

              But from looking through the code from the mods included with the game and also some of the mods that have been posted. It seems like it gets the active human player, if there are more than one human then it will change but if there is only one then it will always return that one.

              I haven't checked fully to see if this is the case, am mainly going by the coments in the included mod.

              One example from those mods is

              if gc.getGame().getActivePlayer() == iPlayer:

              With a comment saying...check if the player is a human player.

              I don't think playing the game in hotseat mode would tell, because it would still change between the human players.


              It does seem a bit strange if that does just returns the human player, as there is also the .isHuman() function.

              Comment


              • #8
                Okay, you may be right. I just tested it some more in singleplayer mode. I got an open borders treaty with an ai civ. I then put an Army Engineer of mine on one of their tiles that would get a road soon. When the road was built it triggered the event and gave me an Airbase. This isn't terrible, but it really shouldn't happen(getActivePlayer() has to be returning the human player in a singleplayer game) I also gave the ai civ some of their own Army Engineers on tiles without roads in their own territory. They used them to build roads, and the event didn't get triggered. (I guess I will have to find a different way to get the current player id).

                So it seems you were right. I just got an idea that should fix the singleplayer problems.

                Comment


                • #9
                  I changed the attachment in my previous post to the new version.

                  Changes in this version:

                  1. You can now only create airbases on a tile if there isn't already an airbase there, and if there is no units from another civ there.

                  2. building an airbase no longer gives you a railroad.

                  I tried about everything I could think of, but had to settle for this solution.
                  Last edited by tywiggins; November 20, 2005, 01:29.

                  Comment


                  • #10
                    Ok. Now it is working great. I finally found a function that does what I want.

                    I believe that the only bug in the attached file is that your own workers can trigger your Army Engineers to build the airbase. Which isn't so bad. Other civs can no longer trigger your Army Engineer to build the airbase, which was a problem.

                    I have tried to create a new route type that only the Army Engineer can build, but it crashes the game everytime you build it. (Also crashes whenever I place it using worldbuilder)
                    I think the problem is that there are no graphics for it.

                    I would also like to be able to airlift land units into/out of airbases.
                    Attached Files
                    Last edited by tywiggins; November 20, 2005, 20:05.

                    Comment


                    • #11
                      Hello, i saw your mod airbase where you landed a carrier as an improvement and had a Eurika moment. looking at your files i was able to identify and i think understand all xml instances

                      the python one is what tells the ai that it can land an ait unit there i would guess. i do not know python so have to ask.

                      the reason i am asking is that i would like to be able to have a unit (say Great Prophet) build a unit (Missionary). if that requires Great Prophet build a "temple" improvement on a tile that spreads religion that would be fine too. I am trying to understand if i can just build a unit or if i have to build an improvement to do that

                      if i have to build an improvement can it build units repeatedly (Say build a "War Factory" that could build "armor")?

                      thank you for your help

                      Comment


                      • #12
                        userqwerty, I sent you a private message to reply to your questions. It's quite a bit off topic.

                        Comment


                        • #13
                          MW2, what do you think of the changes?

                          Comment


                          • #14
                            Originally posted by tywiggins
                            MW2, what do you think of the changes?
                            I haven't had time to test your lastest version yet. I hope that I get time either tonight or tomorrow night and will let you know.

                            But from the sound of it, you have fixed all the problems I can think of right now.

                            One thing I can think of, that we might want to think of ways to change (but it isn't related to your changes, just a side effect of using the road building)...is that a airbase could be built on a enemies plot.

                            Maybe its good that they can be built there, as the airbase is a unit, the enemy can always attack it and destroy it.

                            However thats okay if they are your enemy but when you have just open borders with someone, it will still allow you to build a airbase on their land and they wouldn't attack it.

                            Maybe there should be a test about who owns the land and what type of relationship they have with the engineer's civilization, before the airbase it built.

                            Comment


                            • #15
                              Maybe we should make the airbase not be able to fight. And make it so it can be captured. Maybe we should also increase the cost for the army engineer to 500. These changes would force you to make more strategic decisions as to where to build your airbases.

                              I just made the above changes(No python required, so it didn't take long). I also made it so the army engineer could get captured. I also made the army a national unit, so you can only have 1 at a time.

                              If you have open borders with a civ, you can rebase your aircraft in their cities, so I see no problem with being able to build airbases in their territory.

                              If/when open borders were cancelled all units except the airbase will be removed, making it easily captured.


                              Test both files, and let me know what you think. But, I like the new changes
                              Attached Files

                              Comment

                              Working...
                              X