Announcement

Collapse
No announcement yet.

Exchange city

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

  • #31
    I'm gonna look into this into more detail tonight, hopefully I'll be able to address all your issues tomorrow...
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #32
      I almost got it to work myself but the computer did not like the find get nearest city command.

      I will tell you what I was going to do anyway I was going to find the nearest city every time a barbarian moved and then match the city over the captured one to find the owner

      As you may be a ware there are a few errors already in your script so to save you time here is were they are

      if (IsHumanPlayer(LOQ_oldCityOwner) {

      needs to be changed to

      if (IsHumanPlayer(LOQ_oldCityOwner)) {

      and

      if (LOQ_capturedCity.owner = 0) {

      should be

      if (LOQ_capturedCity.owner == 0) {

      that was it with the errors if you could help me with the find nearest city bit I may be able to sort it.

      any way I am here will Friday and then its Christmas
      "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
      The BIG MC making ctp2 a much unsafer place.
      Visit the big mc’s website

      Comment


      • #33
        I ran the code (after fixing the typos you already mentioned) and had no problems whatsoever with it: it (seemed to) work exactly as advertised. Could you explain in more detail what exactly goes wrong according to you?

        As far as nearest city goes, I'll post a bit more about that tonight, don't have much time now. What exactly did is wrong with it? Did you get an error while using it or does it just not do what it should or whatever?
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #34
          right when the barbarians capture one of my cities .
          I don't get the message box up .

          when I look at the code I notes that the city is changed to barbarian and then you take the city owner which at this time is now barbarian. so it does not work.

          it loads up ok just the function it is meant to do does not work.
          it just sends the barbarian money around in a circle.
          "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
          The BIG MC making ctp2 a much unsafer place.
          Visit the big mc’s website

          Comment


          • #35
            Actually, as you can see in this event:
            Code:
            // when a city is captured, store old owner
            HandleEvent(CaptureCity) 'LOQ_BarbCaptureCityPre' pre {
            	LOQ_capturedCity = city[0];
            	LOQ_oldCityOwner = city[0].owner;
            }
            the owner is stored PRE, so before a city is captured. I used the same code to store the old owner of a captured city for the Militia code of the MedMod (and Cradle and Alex and whatever) and it works just fine there. Executing the code on my system, like I said before, also works perfectly. Perhaps you forgot to #include the file or something silly like that (happens to the best of us)? In any case, you can check if the code is actually being executed by putting in an addition messagebox somewhere with "Message(1, 'GotHere') and make a messagebox that displays a simple text message ("Got Here" ). If this doesn't work in the game, the code obviously isn't being executed at all, otherwise you have a very weird problem

            I'm afraid I didn't get around to looking into the GetNearestCity function (I'll try again tonight but no promises) but I seem to vaguely remember it being bugged. If that is the case, you could try cycling to all cities of all players and store the city with the smallest distance to the location you need. Something roughly like this:

            Code:
            nearest = 9999999999;   // rediculously large number
            for (i = 0; i < 32; i++) {
              player[0] = i;
              for (j = 0; j < player[0].cities; j = j + 1) {
                  GetCityByIndex(i, j, tmpCity);
                  if (SquaredDistance(currentLoc, tmpCity.location) < nearest) {
                     nearest = SquaredDistance(currentLoc, tmpCity.location);
                     nearestCity = tmpCity;
                  }
               }
            }
            PS I use SquaredDistance instead of Distance because it's (slightly) faster (obviously, since Pythagoras is used to calculate distance).
            Last edited by Locutus; December 20, 2001, 08:20.
            Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

            Comment


            • #36
              All I know is that every time they nick one of my cites they don't offer it me back I will try to put in a dumb msg box. and will get back to your tomorrow. not that it will do much good were braking up tomorrow at 12 GMT so I will talk more after the holidays.
              "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
              The BIG MC making ctp2 a much unsafer place.
              Visit the big mc’s website

              Comment


              • #37
                i am back. with all the new threads and stuff I am like a kid in a toy shop

                got it working and started to mod it. I need a bit of help with Teleporting the barbarians out of the city can you help locutos.
                "Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
                The BIG MC making ctp2 a much unsafer place.
                Visit the big mc’s website

                Comment

                Working...
                X