Announcement

Collapse
No announcement yet.

Problem with merged mod

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

  • Problem with merged mod

    I merged some mods together the way dsplaisted posted here

    The mods are:
    - RealFort
    - TechConquest
    - ForestryMod
    - AbandonRazeCityMod

    Unfortunately the AbandonRazeCityMod doesn't work.
    Can somebody help me with this?
    I attached the python scripts, I would be really happy if somebody can help me
    Attached Files

  • #2
    Because, I think (don't have access to civ, at work still), you have rc = RazeCity.RazeCity() in the globals, and rc = CvEventManager.CvEventManager in the init section.

    Get rid of the definition in the init section.

    Comment


    • #3
      I tried this, but it doesn't work
      I think, it lies in the init section, but how can this be done in the modular style for mod merging. And I must say, this way is really cool

      Comment


      • #4
        Did you try it and then delete the cache?

        It must be this that is causing the problem, because it is looking for the razecity definitions inside the original eventmanager, not the mod.

        Comment


        • #5
          feivelda, I released a new version of the AbandonRazeCity mod. I tried to make it easier to combine mods. I ran into so many problems doing this. It's not perfect. Most of code is now in the CvCustomEventManager.py file which isn't really what dsplaisted had in mind. If you can figure out how to modify it so that it is closer to how dsplaisted said to do it, let me know. I'll go ahead and attach the newer version of my mod.
          Last edited by tywiggins; December 5, 2005, 16:04.

          Comment


          • #6
            So, first, I cleared the cahce every time I was doing a small change, but nothing could help me.
            I'm not sure were the error lies, but I think it is in the init section.

            I will look at your mod, I will post the combined version when all works

            Comment


            • #7
              I tried to merge again, but again the AbandonRazeDemolish mod kills all
              I commented lines of code out and it crashes with ard = AbandonRazeCity.AbandonRazeCity()

              I merged SettlerReligion with it, but I don't know why ard crashes. Anybody out there who can look at the code and fix it?
              Attached Files
              Last edited by feivelda; December 5, 2005, 15:51.

              Comment


              • #8
                I released a new version of my mod again. It should be easier now(Thanks to Bhruic)
                You can download my mod from here

                Comment


                • #9
                  I have attached a modified CvCustomEventManager.py file and my new AbandonRazeDemolish.py file.

                  I have tested all of my code, and it works. While testing, I noticed that when you take over a city, it gives an error about the forestry onimprovement built.
                  Attached Files

                  Comment


                  • #10
                    Ok, thank you.
                    I will test this this afternoon at home.
                    I can't understand the error with the forestry mod. I tried this yesterday with conquering a city and all was fine. What was your circumstances? Where any new planted forest near the conquered city?

                    Comment


                    • #11
                      no, i just used world builder to create a couple of enemy cities close to me so I could raze them. I didn't even play a whole turn, I just was testing all the functions of my mod to make sure they worked correctly.

                      I don't remember the exact wording but it was something like forestry has no attribute __LOG_IMPROVEMENT.

                      So you will probably have to change this line in the Forestry.py file:

                      if (not self.__LOG_IMPROVEMENT):


                      But, I don't understand why the onImprovementBuilt would be triggered when capturing a city.

                      Comment


                      • #12
                        I'm not sure either.

                        But the ForestryMod file should be changed, for sure. The inheritance system is based on the idea of using building blocks. That means if want to add functionality to a particular function, you don't need to duplicate what's already there. You simply call the original function, and then add your code.

                        In this particular case, all of the code from "if (not self.__LOG_IMPROVEMENT):" on is simply duplicating the original function. Simply all of those lines, and it should work properly.

                        Bh

                        Comment


                        • #13
                          I tried yesterday and all seems to be ok.
                          But I wasn't able to fully test the tree nursery, because I started from 4000 BC and when I was able to build tree nurseries I was attacked by 5 enemies

                          Comment


                          • #14
                            Originally posted by Bhruic
                            I'm not sure either.

                            But the ForestryMod file should be changed, for sure. The inheritance system is based on the idea of using building blocks. That means if want to add functionality to a particular function, you don't need to duplicate what's already there. You simply call the original function, and then add your code.

                            In this particular case, all of the code from "if (not self.__LOG_IMPROVEMENT):" on is simply duplicating the original function. Simply all of those lines, and it should work properly.

                            Bh
                            When thinking of this.... I don't think that anybody inheriting from the base class, calling the base method and adding it's own stuff is a good one.

                            For exemple if i have 28 mod... I will end up with some messy code that is near imcomprehensible and that need to be editer either by hand, or automically by a script.

                            When we think that what can be considered as a mod can be as small as something that happen when a city is razed or something like that a user can really have a big number of mod together.

                            What i'am thinking is that we have only one class inheritence once and for all mod and that will provide a service similar to the observer pattern.

                            This class deal with a list of event listeners, that you can register with a method like addListener, and unregister with removeListener.

                            When a call to a specific even is trigered, the new class, call all of the registered listener corresponding method using it's list.

                            Using this way adding or removing a mod (that use only the python event...) is just a matter of adding or removing one line of code for the whole mod, or better, you read the listeners that have to be registered from an initialization file.

                            If you don't want to have to define all methods for all listeners, you can use the instrospection mecanism of python and verify if a specific listener does actualy has a method with the same name defined and call it only in that case.

                            Comment


                            • #15
                              Necromancer!

                              Comment

                              Working...
                              X