Announcement

Collapse
No announcement yet.

MM2 PW Repair code.

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

  • #16
    Re unit numbers, about 100 altogether but I dont think that has anything to do with it.

    Comment


    • #17
      Originally posted by stankarp
      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.
      Yep, sounds like the best idea in the moment.

      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.
      Can you put the slic for this one in, maybe it has something to do with it.

      And for the number of units: Just to see if there might have been an overrun somewhere.

      Comment


      • #18
        Stankarp,

        Originally posted by Locutus
        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.)
        Have you tried this? (So JUST disabling the two SetHP lines, not the rest of the repair code.) By doing so we can establish if the extra PW you get is actually coming from the repair code or if the repair code is just interfering with some other code (e.g. the pw cheat), which I suspect.
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #19
          Hi Locutus,

          I havnt tried disabling HP as you suggested yet. Will try it now.

          Thanks.

          Comment


          • #20
            OK, Firstly I tried putting the code in a separate file and started again. This time I got to turn 150 odd before it started happening. I lost a city on turn 149, retook it on 150 and got pw from the city capture code. Then next turn it started again, 500 odd pw arrived then next turn nearly 900.

            I was saving every turn so I went back one turn, beefed up the city defences and it did not fall in that turn. However, the extra pw started happening on the same turn anyway. So went the theory that a city captured that gave a slab of pw triggered it happening.

            I disabled the following lines;

            //SetPW(tmpPlayer, (pw - pwCost));

            and

            //SetPW(tmpPlayer, (pw - pwCost));

            relaoded slic and it stopped happening.

            Theories or suggestions anyone. I really wanted this one to work, I think it really adds to the game.

            Comment


            • #21


              This would mean that pw - pwcost would be negative.

              For pwcost to be greater than pw

              But the first problem is, if you don't have damaged units it shall not be happening.



              Can you enable the first one again, which shall just get active if you have enough PW and let us know the result?

              Comment


              • #22
                I tried various things.

                With both lines disabled, I got no bonus PW and full repair of units in one turn.

                With the first line only disabled I got full repair and no bonus PW.

                With the 2nd line only disabled, I got full repair plus bonus PW.

                I tried playing with both lines open and disabling pw_Cheat.slc, the code that gives the AI pw points but I was still getting the extra pw points.

                The conclusion is that something triggers the repair code to give me pw points. It works fine for 100+ turns then after that it starts. The earliest has been turn 110 and the latetst 150.

                What about changing the code so that it only applies to the human player, ie, all ai units in cities heal automatically, since the ai gets lots of pw its academic anyway. I dont know enough about slic to do this yet.

                Comment


                • #23
                  Maybe I should add my observations from GoodMod, I have there the city capture code in and also the pwcheat. If I play with the Barbarians capture a city then I get some of the pw of the victim that is indented, every turn this city generates pw, if I give away this city or let it capture someone else, I still get a pw bonuns even if I shouldn't get anything, I am neither an AI player (well this should be forced by the scenario editor) nor I own any single city (as Barbarian I can have zero cities). And of course this pw repair code is not in my slic database.

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

                  Comment


                  • #24
                    Hi Martin,

                    I have the pw cheat and city capture code as standard but have not noticed getting that sort of pw bonus before. I am using the city capt code that does not give enslavement, only expand empire or bloodbath.

                    I am sure I have not been getting that large a bonus of pw before using this code. Maybe I should check, but when I comment out repair code altogether and play on for another 100 turns and monitor. I have occassionally noticed what I think is a small discrepancy in pw but I am talking 20 to 30 pw a turn, but if I turn off pw production, I dont get any pw. With repair code I am talking 800+ pw per turn wheher I produce pw or not.

                    Can U explain how to make repair code only work for the human player and leave out AI please?

                    Comment


                    • #25
                      "but when I comment out repair code altogether and play on for another 100 turns and monitor"??

                      What I meant was comment out the repair code and play on for another 100 turns and see if the pw situation changes.

                      What Martin said is interesting because MEDMod does not use the PWcheat.slc or the city capture options slc. And lucutus said the pw bonus does not happen in MedMod.

                      Comment


                      • #26
                        I commented out the repair code in script.slic and played another 70 turns. I did not get any extra pw that I am aware off so I was not getting the problem that Martin referred to.

                        I made two copies of the repair file, changed the handlers in the second one and inserted the line-
                        if(!(IsHumanPlayer(player[0])) && (player[0] != 0)) { // not human
                        and a }
                        at the end and the code works only for the ai.

                        I tried-

                        if(IsHumanPlayer(tmpPlayer)){ //ie human player only
                        with the extra } at the end
                        but it did not work for the human player.

                        I am hoping that if I separate the two functions the bonus PW problem might not happen.

                        Can anyone advise the correct peice of code to make something run only for the human player or player 1.

                        Comment


                        • #27
                          For interest, I have attached the slic code for pw from pillage. I dont think any other code would affect pw except for the pw_cheat.slic code already in Cradle.
                          Attached Files

                          Comment


                          • #28
                            I tried to isolate the problem.

                            I started by going back to med mod and played for 175 turns and the pw bonus did not start.

                            I went back to my cradle mod and disabled every file that I found that changed pw, for ai and/or human player and replayed a turn in a game where the pw bonus started after reloading slic. While I had the repair code for the human enabled, I got the bonus pw that turn no matter what I did(changed moves, stopped the building of a wonder due that turn etc).

                            I re-enabled the slic codes and the repair code for the ai and disabled the repair code for the human and the bonus pw did not occur. It has something to do with setPW for the human player after a certain turn in the human version of the repair code while using cradle mod. I cant work it out.

                            I have attached the repair code for the human player, I am not sure it is working for only the human player. Could someone advise how to change it so it only works for the human player please.
                            Attached Files

                            Comment


                            • #29
                              I have nearly solved the problem. I found I had accidentally increased the amount of pw the ai got through pwcheat.slc.

                              I reduced it back to thhe original amount and the problem nearly stoped. Occassionally I get a small amount of pw (5-25 points) and once every 20-40 turns seem to get a bag of up to 500 pw points, unrelated to my city cpaturing. The net effect is that the repair code is now working well enough to use.

                              Thanks for the help and suggestions.

                              Comment


                              • #30
                                Update.

                                Regardless of what I did while I had the code in its original format, sometime after turn 100 I started to get an overflow of pw.

                                I sent it to Peter Triggs and he suggested removing the changes from player[0] to player[5] in the code and tidied it up a bit and it now works. I have played to turn 400 and not had any overflow problem I can detect except for possible a hand full of points occassionally (less than 20).

                                Thanks for Peter's help.

                                Comment

                                Working...
                                X