Announcement

Collapse
No announcement yet.

How to give a promotion to a class or type of unit ?

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

  • How to give a promotion to a class or type of unit ?

    Scrolling through the various modding tutorials and reference sheets, I have found many XML commands with some comments (I am sincerely sorry for the author, and I apologize, but I don't remember who wrote this ). I am very interested in using the two following ones :

    PHP Code:
    UnitCombatPromotions- if non-empty, contains free promotions that all units of a selected combat type receiveFormat to fill is as follows:

        
    XML:
        <
    UnitCombatPromotions
           <
    UnitCombatPromotion
              <
    UnitCombat>UNITCOMBAT_ARCHER</UnitCombat
              <
    UnitPromotion>PROMOTION_COMBAT1</UnitPromotion
        </
    UnitCombatPromotion
        </
    UnitCombatPromotions


    The above would give all archery units a free Combat I promotion.

    UnitClassPromotionssimilar to above. If non-empty, contains free promotions for all units of a selected unit class to receiveFormat as follows:

        
    XML:
        <
    UnitClassPromotions
                    <
    UnitClassPromotion
                       <
    UnitClass>UNITCLASS_AXEMAN</UnitClass
                       <
    UnitPromotion>PROMOTION_SHOCK</UnitPromotion
                    </
    UnitClassPromotion
        </
    UnitClassPromotions


    That would give all Axeman-class units Shock
    The problem is that I don't know what XML file(s) I have to change or in which file(s) I have to add the following lines. I don't even know if I have to create a new file.

    Can someone help me... please !

    Last edited by Tamerlin; September 6, 2007, 06:12.
    "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

  • #2
    These commands are used in events. Maybe somewhere else, too.

    Comment


    • #3
      Originally posted by Risa
      These commands are used in events. Maybe somewhere else, too.
      Thanks Risa !

      That means I would have to create an event... and a trigger.

      It is getting far more complicated than I imagined.

      Is there another way ?

      If not, can someone give me some hints about events ?

      "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

      Comment


      • #4
        About the author of the quoted XML commands, I have to give back to Caesar what belongs to Caesar : the author is Solver.
        "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

        Comment


        • #5
          I imagine those are in the normal unit class files; however it's possible it's event related also (though I thought events were python). Solver will undoubtedly be around. It should certainly be possible without events, though; look at unit classes that get automatic promotions (such as Tanks or Marines) for examples.

          I believe those come from the Civ4Unitsomething xml files - i'm at work so I can't check specifics but it should be in the xml folder for Units, in the general unit class file. There will be a section for each unit class, and probably an empty spot for that specific tag; just change

          to

          blah blah blah

          if that's the same tag that it uses; it's probably not, if that's the event code. Do a 'find' for 'marine' and see how the marine gets its free promotion, then copy that to whatever unit you are making.

          The easiest way to mod is to just look at the xml files ... hunt around, you have to have a bit of experimenter in you

          Make sure you create a mod and don't edit the original files
          <Reverend> IRC is just multiplayer notepad.
          I like your SNOOPY POSTER! - While you Wait quote.

          Comment


          • #6
            Yep, that is from my event modding guide. And the file in question is the event description file - Civ4EventInfos.xml. The real question is, what do you want to do? Mod events or what?

            And it's nice to see you CtP2 folks drop by
            Solver, WePlayCiv Co-Administrator
            Contact: solver-at-weplayciv-dot-com
            I can kill you whenever I please... but not today. - The Cigarette Smoking Man

            Comment


            • #7
              Thank you snoopy369, I will have to give more attention to your post to understand it all (I am somehow programming blind and it takes me some time to understand such things) but I appreciate your help. And yes, I will not tweak the original files and I will try to make a real mod this time.

              Nice to hear from you Solver. I knew you would poke around.

              What do I want to do ? Always the same thing, give all units (player and AI players) the possibility to use roads and railroads in ennemy territory.

              There are AFAIK two ways to achieve (I am sure there are a lot more possibilities) :

              - Give all units (to the exception of units like animals) the Commando promotion

              - Add the bEnemyRoute command to all units in the CIV4UnitInfos.xml with the possibility to set it to 0 or 1

              What I want is something that can be done easily without having to give a free promotion to each unit in the CIV4UnitInfos.xml. I would like it to be easy to implement because I would like to use it with every mod and scenario.

              I am still found of CtP2 but I must admit that, contrary to Civ3 (IMO of course), Civ4 is really a good game... in spite of its antediluvian combat system.

              No stacked combat... how is it possible in the 21st century.
              "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

              Comment


              • #8
                Thank you snoopy369, I will have to give more attention to your post to understand it all (I am somehow programming blind and it takes me some time to understand such things) but I appreciate your help. And yes, I will not tweak the original files and I will try to make a real mod this time.

                Nice to hear from you Solver. I knew you would poke around.

                What do I want to do ? Always the same thing, give all units (player and AI players) the possibility to use roads and railroads in ennemy territory.

                There are AFAIK two ways to achieve this (I am sure there are a lot more possibilities) :

                - Give all units (to the exception of units like animals) the Commando promotion

                - Add the bEnemyRoute command to all units in the CIV4UnitInfos.xml file with the possibility to set it to 0 or 1

                What I want is something that can be done easily without having to give a free promotion to each unit in the CIV4UnitInfos.xml file I would like it to be easy to implement because I would like to use it with every mod and scenario.

                I am still found of CtP2 but I must admit that, contrary to Civ3 (IMO of course), Civ4 is really a good game... in spite of its antediluvian combat system.

                No stacked combat... how is it possible in the 21st century.
                "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                Comment


                • #9
                  Well, Dale does have a stacked combat mod But really, Civ4's combat, though one-on-one, is much better than previously.

                  Anyway, yeah, the two ways you describe are probably the most straightforward ones. Given Python and SDK, there's a huge amount of ways to do it of course, but adding a free Commando promotion to everyone is the easiest thing to do. No SDK modding or anything required.
                  Solver, WePlayCiv Co-Administrator
                  Contact: solver-at-weplayciv-dot-com
                  I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                  Comment


                  • #10
                    Originally posted by Solver
                    Well, Dale does have a stacked combat mod But really, Civ4's combat, though one-on-one, is much better than previously.
                    Much better yes, but not really the best.

                    Anyway, yeah, the two ways you describe are probably the most straightforward ones. Given Python and SDK, there's a huge amount of ways to do it of course, but adding a free Commando promotion to everyone is the easiest thing to do. No SDK modding or anything required.
                    The problem with the first method (adding the promotion to each unit) is that it does not work as easily with the mods and scenario (I tried). The Civ4UnitInfos.xml must also be worked again with each patch or add-on modifying the original Civ4UnitInfos.xml file.

                    This is why I would prefer adding a command like bEnnemyRoute to the unit schema. The problem is that I don't know nor how to do it nor anything about SDK and Python.
                    "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                    Comment


                    • #11
                      I actually like the Civ4 combat a bit better... CtP2 combat, while great, has a few problems tat I have no idea how they could be resolved.

                      And I thought you knew C++? Adding a field to the schema is really easy. I think there was even a tutorial on the matter somewhere.
                      Solver, WePlayCiv Co-Administrator
                      Contact: solver-at-weplayciv-dot-com
                      I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                      Comment


                      • #12
                        Originally posted by Solver
                        I actually like the Civ4 combat a bit better... CtP2 combat, while great, has a few problems tat I have no idea how they could be resolved.
                        Some people are still working on it but the community is rather small. The quality of Civ4 has detracted some modders from CtP2. IMO, the two games are really different (more macro management in CtP2, for example) and the two can be played alongside. This is my two cents of an opinion and I know that I like the two for very different reasons.

                        The Final Frontier scenario is one of those reasons (though I have not yet tested it... time, time, always the lack of time, so many more important things to do).

                        And I thought you knew C++? Adding a field to the schema is really easy. I think there was even a tutorial on the matter somewhere.
                        Unfortunately I know nothing about programming, I have used HTML rather extensively though I don't think it can be considered as a programming skill.

                        I am looking for tutorials on the subject for a few days now and I have not yet found. The problem is that I am certainly not looking where I should... but I keep on.
                        "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                        Comment


                        • #13
                          I have tried to implement something but it seems too easy... and more troubling again it seems to work.

                          I have "created" a mod called "Enemy Roads" for which I have modded two files :

                          1 - In CIV4UnitSchema.xml

                          I have added a line between two lines (bEnemyRoad) :

                          PHP Code:

                          <ElementType name="bIgnoreTerrainCost" content="textOnly" dt:type="boolean"/>
                          <
                          ElementType name="bEnemyRoute" content="textOnly" dt:type="boolean"/>
                          <
                          ElementType name="bNukeImmune" content="textOnly" dt:type="boolean"/> 
                          ... and another line lower in the same file :

                          PHP Code:

                          <element type="bIgnoreTerrainCost"/>
                          <
                          element type="bEnemyRoute"/>
                          <
                          element type="bNukeImmune"/> 
                          2 - In CIV4UnitInfos.xml

                          I have added the corresponding new field between the two other fields :

                          PHP Code:
                          <bIgnoreTerrainCost>0</bIgnoreTerrainCost>
                          <
                          bEnemyRoute>0</bEnemyRoute>
                          <
                          bNukeImmune>0</bNukeImmune
                          If I am right I just have to select 0 or 1 for each unit. For now, 0 is selected for all units.

                          I have runned the game and selected the brand new mod which loaded without any error and the name "Enemy Roads" appears in the higher right part of the screen. From the window I can now launch a solo game, select a scenario and (among other possibilities) unload the mod. By the way, does this mean I can launch a scenario from BtS and use the features from my mod ?

                          It all seems to work fine but once again it appears to be too easy. Do I have to change another file, if not several. Won't there be a conflict with other files like those managing promotions ?
                          "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                          Comment


                          • #14
                            Yeah, you got the schema part right, the problem is that it doesn't do anything yet You need to make some C++ changes in the SDK and recompile it.
                            Solver, WePlayCiv Co-Administrator
                            Contact: solver-at-weplayciv-dot-com
                            I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                            Comment


                            • #15
                              Originally posted by Solver
                              Yeah, you got the schema part right, the problem is that it doesn't do anything yet You need to make some C++ changes in the SDK and recompile it.
                              I knew it couldn't be so simple...

                              Unfortunately the second part is out of my reach. Too bad.
                              "Democracy is the worst form of government there is, except for all the others that have been tried." Sir Winston Churchill

                              Comment

                              Working...
                              X