Announcement

Collapse
No announcement yet.

MM2 PW Repair code.

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

  • MM2 PW Repair code.

    I incorporated Wouters MM2 PW repair code into a Cradle mod.

    It worked fine for over 100 turns then I suddenly noticed that I was getting a lump sum of pw every turn of over 1000 points which defeated the purpose of the code.

    I checked it by commenting the code out again then back in again and it was definitely the MM2 PW repair code.

    Wondering if anyone else had the same problem in MM2.

  • #2
    I gather no one has had this problem in Med Mod or has not noticed it then??

    Comment


    • #3
      I can't remember the last time I played MedMod. It's hardly ever mentioned around here anymore so I don't think there's a lot of people playing it now.

      Comment


      • #4
        That wasn't the case when I last played the MedMod (though granted, that was a while ago) and that certainly shouldn't happen based on the code. Unless you have weird negative numbers for MapHP or ShieldCost in Units.txt, the SLIC code can only decrease the amount of PW a player has, not increase it.

        Are you sure it's not because you're setting your HP value higher than usual to compensate for the extra PW demand?

        If so, try disabling the SetHP lines of the SLIC code(there should be 2 of them: one following the second if statement and one as last line in the block following the elseif), see if you still get too much PW then? (The effect of this change will be that you're units are still repaired normally, but the cost is not deducted from your PW reserve.)
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #5
          Also, post the SLIC file with your version of the code, something may have gone wrong incorporating it in Cradle.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #6
            I havnt done anything wierd re hit points or stuff like that. As I said it seems to go fine for about 100 or more turns then suddenly I start getting PW as if I was an AI

            I'll try attaching the file but I remember having trouble doing this sometimes.
            Attached Files

            Comment


            • #7
              Would be interresting to know.

              I had a look at the file, but nothing jumping into my eye.

              Unless it isn't a rounding problem somewhere.

              Stankarp, do you actually have damaged units in your cities?

              Comment


              • #8
                Gilgamensch, thats a point. Early in the game, the code definitely works on damaged units in cities. Its hard then and you count every PW. I found I banished damaged units to the country so I could build a road.

                However, later when I had a fair bit of PW I was not checking so closely but since I am at war with someone always, I assume that I had damaged units. I am trying it again so I will pay closer attention this time and report.

                I wonder if Locutus could extend the code to Fortresses and watch towers because its unrealistic that units repair instantly in those tile improvements. It actually makes going to war very hard because the AI gets plenty pw so its units repair faster than yours, whereas as it stands normally, they heal at the same rate.

                Comment


                • #9
                  I don't see any PW related problems, either. But I found this problem:

                  Code:
                  	if (IsHumanPlayer(tmpPlayer) && notEnough == 1) {			// if not enough pw and player is human
                  		player[5] = tmpPlayer;
                  		Message(1, 'MM2_NotEnoughPW_M');				// give message that more pw is needed
                  	}
                  The meassage is always sent to player 1, not a good idea if you play Network games or if you play a scenario and you use another player then player 1, or you selected another player in our playtest built.

                  This code is better:

                  Code:
                  	if (IsHumanPlayer(tmpPlayer) && notEnough == 1) {			// if not enough pw and player is human
                  		player[5] = tmpPlayer;
                  		Message(tmpPlayer, 'MM2_NotEnoughPW_M');				// give message that more pw is needed
                  	}
                  Another thing you could do, is to insert an player[5] = tmpPlayer; before a member of player[5] is used. The current version of CTP2 has the behaviour to forget the value of an array member if you set it yourself.

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

                  Comment


                  • #10
                    Thanks Martin.

                    Still testing the current setup again to see if it happens again and check if I have damaged units in cities at the time.

                    Comment


                    • #11
                      Update.

                      On turn 125, I noticed I suddenly had 553 pw when I had been struggling with under 100 each turn. I had only managed to build roads to connect cities, not one mine, farm etc.

                      I turned off pw production, checked and found I had no damaged units in cities, ended turn and next turn I had 1411 PW. It seems like I suddenly start getting an AI's quota of pw. I had captured 3 cities, disbanded one, but hadnt captured one for 20 turns.

                      Mystery deepens.

                      Comment


                      • #12
                        I did a further check.

                        I commented out the repair slic file in script.slic, went back into the game, ended another turn and received another 800+ PW. I hit reload slic and ended turn and the extra pw did not happen again. I retried the exercise with and without any pw production and the results were the same. Until I reloaded slic I kept getting the extra PW. Reload slic and it stopped.

                        It has to be something in the repair slic code that is triggering it or establishing an association with PW_Cheat.slic.

                        Comment


                        • #13
                          Just to recapture:

                          No damaged units, but PW being given.
                          You removed all/partial repair-slic? and it worked..... strange.......

                          How many units complete do you have? Maybe an overrun somewhere? Is it the only slic you are using?

                          Comment


                          • #14
                            At turn 125, I start getting 800+ pw if I am using the repair code, whether I have damaged units or not. If I hit reload slic which comments out the repair code slic file, then it stops.

                            I might try and just isolate the repair code into a separate file as it actually had 6 functions originally and I cut out several but there may be values, integers etc left in that are causing a problem.

                            I would really like to get this going ok as a lot of people, like Hex have been looking for ways to balance the game. Making war with the repair code means you commit a lot more resources or fight at a big disadvantage. Can only be good for play balance.

                            Comment


                            • #15
                              I am using many slic files including a couple of special ones written for me by Pedrun, such as advance from city capture and a new supply unit.

                              Comment

                              Working...
                              X