Announcement

Collapse
No announcement yet.

Anyone available to do some modding scripts?

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

  • Anyone available to do some modding scripts?

    Maybe the incorrect word, but in Call To Power a few good folks donated a little (or a lot) to make me some scripts for SLIC

    Then I would tweak as i needed.

    What I had was like a granary and it produced "X" public works for each POP Count.


    What i was wondering here was if it is possible to have such to maybe produce (spawn) a unit of choice for a building of choice, as in CIV III Conquests, when ya made a scenario you could spawn a Calvary every "X" turns say for a Barracks


    Ok, thanks in advance if it is possible!

    Gramps
    Hi, I'm RAH and I'm a Benaholic.-rah

  • #2
    You'd like a building to spawn a unit every X turns?
    Do you use vanilla/warlords/BtS? There might be some python commands that don't work the same in all versions.
    Clash of Civilization team member
    (a civ-like game whose goal is low micromanagement and good AI)
    web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

    Comment


    • #3
      That looks farily simple actually. There are certainly nicer ways to do it, but create a directory for your mod, and put a .py file there, something like:
      Mods\GrandpaTroll\Assets\Python\GrandpaTrollEventM anager.py

      In that file (beware tabs/whitespaces), write something like this:
      -Edit - I'll attach the file in a moment, I wanted to put plain text but with the tabs gone it's useless-...
      -Edit 2- I'll attach it if I can make it work...
      Last edited by LDiCesare; May 25, 2008, 14:28.
      Clash of Civilization team member
      (a civ-like game whose goal is low micromanagement and good AI)
      web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

      Comment


      • #4
        BTS Full Version

        So I put the py file there, would this be on hotepad?

        In addition, say I choose a World Builder map made by me, would this go in my Mods folder?

        Currently I have my world Builder map in the Scenario (public files(

        Ok, appreciate this!

        Gramps
        Hi, I'm RAH and I'm a Benaholic.-rah

        Comment


        • #5
          It's something like this. You have one py file that you can edit with notepad/wordpad/whatever text editor (just beware the whitespaces and tabs - they are important)
          Warning: It doesn't work for some reason.
          But the structure is simple: put the directory in the mods folder and go advanced/Load a mod (or modify the shortcut to start as "C:\Program Files\Jeux\Sid Meier's Civilization 4\Beyond the Sword\Civ4BeyondSword.exe" mod=\Grandpa)

          I don't get why hasBuilding is not found yet...

          Basically I just added these lines to the file:
          self.spawnRate = 2 in the __init__ function, and in
          onBeinGameTurn:
          if ( iGameTurn % self.spawnRate == 0 ):
          self.spawnUnits()

          def getNumPlayers(self):
          iCount = 0
          for i in range( gc.getMAX_CIV_PLAYERS() ):
          if ( gc.getPlayer(i).isEverAlive() ):
          iCount = iCount + 1
          return iCount

          def spawnUnits( self ):
          unitID = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUni tInfos(),'UNIT_WARRIOR')
          buildingID = CvUtil.findInfoTypeNum(gc.getBuildingInfo,gc.getNu mBuildingInfos(),'BUILDING_BARRACKS')
          # Loop through all players' cities
          for iPlayerLoop in range(self.getNumPlayers()):
          pPlayer = PyPlayer(iPlayerLoop)
          apCityList = pPlayer.getCityList()
          for pCity in apCityList:
          city = pCity.GetCy()
          if( city.hasBuilding( buildingID ) ):
          pPlayer.initUnit( unitID, city.getX(), city.getY(), UnitAITypes.NO_UNITAI )

          If you remove the hasBuilding (and the tab on the following line), you'll get a unit spawned per city every 2 turns.
          I must check why I can't find hasBuilding and it'll be done.
          Attached Files
          Last edited by LDiCesare; May 25, 2008, 14:56.
          Clash of Civilization team member
          (a civ-like game whose goal is low micromanagement and good AI)
          web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

          Comment


          • #6
            OK, it's just isHasBuilding instead of hasBuilding. I reattach it below, but you can just edit the above file too.
            Sorry it took that long for something I called fairly simple, but I almost deleted my Mods folder in the process of making the zip...
            So, use notepad or something like that, change the spawnRate to what you'd like, and the UNIT_WARRIOR/BUILDING_BARRACKS accordingly.
            I suppose it's possible to have some gneric code and make the xml files specify which building should spawn what and how often, but that would be more complicated.
            Hope it works for you.

            And yes it should work with whatever map you may like.
            Attached Files
            Last edited by LDiCesare; May 25, 2008, 15:14.
            Clash of Civilization team member
            (a civ-like game whose goal is low micromanagement and good AI)
            web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

            Comment


            • #7
              Thanks so much!

              Just curious, I select Mode and then i can pick a scenario? (thats where my homemade map is)


              Appreciate this so much!

              Gramps
              Hi, I'm RAH and I'm a Benaholic.-rah

              Comment


              • #8
                C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets\XML\Buildings\CIV4BuildingClassInfos. xml

                If I go here i can find the correct building lingo? (as in how I should define the building ID)



                C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets\XML\Units\CIV4UnitInfos.xml


                For Units I would go here to get correct unit namer?


                Thanks in advance

                Gramps
                Hi, I'm RAH and I'm a Benaholic.-rah

                Comment


                • #9
                  Yet another question, please bear with me.


                  I make a mod folder names say Grandpa01 (for first Mod)

                  Now I have a notepad and do I put all commands on that one notepad (with a space between last command that closes it and the start of the next command)


                  or do I need one for each change I make?


                  One more inquiry, do I have to name the notepad anything or will it auto read when i load my mod?


                  I really do appreciate this wonderful help as I love to mod games, nothing super special mind you, just for my individual please!


                  Peace

                  Gramps
                  Hi, I'm RAH and I'm a Benaholic.-rah

                  Comment


                  • #10
                    Just curious, I select Mode and then i can pick a scenario? (thats where my homemade map is)
                    I think so. Loading a mod shouldn't prevent you from loading a scenario that's compatible with it.

                    C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets\XML\Buildings\CIV4BuildingClassInfos. xml
                    C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets\XML\Units\CIV4UnitInfos.xml
                    Actually that's CIV4BuildigInfos and CIV4UnitInfos (the Class thing serves to distinguish unit and civ-specific units). Usually you have stuff like UNIT_WARRIOR and UNIT_CLASS_WARRIOR. I haven't tested what UNIT_CLASS_WARRIOR gives instead of UNIT_WARRIOR. I suspect it won"t work but it might give you a regular warrior or the UU (quechua) instead depending on the civ.


                    Now I have a notepad and do I put all commands on that one notepad (with a space between last command that closes it and the start of the next command)


                    or do I need one for each change I make?


                    One more inquiry, do I have to name the notepad anything or will it auto read when i load my mod?
                    I'm not sure if I get you correctly. The mod requires a certain structure. Namely, you need it to be in Mods directory, have its name, have an assets directory like in the zip I attached. Inside this Assets, you have a Python directory and can add an XML directory if you want to mod units for instance.
                    All the .py files you'll write will be read if I'm correct, so you can make as many files as you like and call them as you want, but they have to be consistent. For instance, the CvEventManager.py defines all the reactions to events like new turn, so you'd better put everything event related inside.
                    You can look at the structure of existing mods (Charlemagne for instance is not too complex) to understand better. Just avoid those like Rhye's or FfH as they are too complex to browse for a beginner.
                    Clash of Civilization team member
                    (a civ-like game whose goal is low micromanagement and good AI)
                    web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                    Comment


                    • #11
                      ok, thanks
                      Hi, I'm RAH and I'm a Benaholic.-rah

                      Comment


                      • #12
                        what are your overall evil plans GT ???
                        anti steam and proud of it

                        CDO ....its OCD in alpha order like it should be

                        Comment


                        • #13
                          Originally posted by Addled Platypus
                          what are your overall evil plans GT ???
                          I love modding

                          I wamt to make a large long game, and then put all AI on Deity, and no peace with any AI, and have fun vonquering them.


                          In Call To Power I have it down pat with the SLIC on how to do such things as adding PW, spawning units (similiar to what happens with CIV III Conquests in the scenario area.

                          Gramps
                          Hi, I'm RAH and I'm a Benaholic.-rah

                          Comment


                          • #14
                            Originally posted by LDiCesare

                            I'm not sure if I get you correctly. The mod requires a certain structure. Namely, you need it to be in Mods directory, have its name, have an assets directory like in the zip I attached. Inside this Assets, you have a Python directory and can add an XML directory if you want to mod units for instance.
                            All the .py files you'll write will be read if I'm correct, so you can make as many files as you like and call them as you want, but they have to be consistent. For instance, the CvEventManager.py defines all the reactions to events like new turn, so you'd better put everything event related inside.
                            You can look at the structure of existing mods (Charlemagne for instance is not too complex) to understand better. Just avoid those like Rhye's or FfH as they are too complex to browse for a beginner.
                            I was wondering if it would be as easy as this from Call to Power SLIC


                            }

                            trigger 'AddSILOPW' when(g.player) {
                            SetPlayer(1, g.player);
                            i=0;

                            while (i < player.1.cities) {
                            SetCityByIndex(1, player.1, i);
                            if (CityHasBuilding(city, "IMPROVE_SILO")) {
                            SetPW(player.1, player.1.publicworkslevel + 22 * city.population);
                            }
                            i = i + 1;
                            }
                            }

                            trigger 'MakeCities' when (city.built) {
                            AddPops(city.1,1);
                            }
                            trigger 'LOQ_MoreSettlers' when (g.player > 0) {
                            if (g.year == 0) {
                            i = 0;
                            SetUnitByIndex(1, g.player, 0);
                            while (i < 25) {
                            CreateUnit(g.player, UnitType("UNIT_SETTLER"), unit.1.location, 1);
                            i = i + 1;
                            }
                            } else {
                            DisableTrigger('LOQ_MoreSettlers');
                            }


                            The top code gives extra public works and the bottom gives extra settlers at start
                            Hi, I'm RAH and I'm a Benaholic.-rah

                            Comment


                            • #15
                              The code snippet I put above shows how to create units. It's a bit more complex than PW because you must create them somewhere, is slightly more lengthy because you have to loop through players yourself but is basically the same.

                              For starting units, you can do it more easily in civ4 than CtP because you just need to change some xml file (can't remembre which) if I'm right.
                              Clash of Civilization team member
                              (a civ-like game whose goal is low micromanagement and good AI)
                              web site http://clash.apolyton.net/frame/index.shtml and forum here on apolyton)

                              Comment

                              Working...
                              X