Announcement

Collapse
No announcement yet.

Loosing Trade routes

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

  • Loosing Trade routes

    I am playing the Apolyton Pack with GoodMod on gigantic map.

    I have noted something strange with the trade-routes. I wanted to change a route to a more profitable one. But when I canceld the trade-route the caravan was lost. Just as if they had been pirated in good old CTP1.

    Acording to the manual you should be able to reuse caravans.
    You can always cancel a current trade route to free up caravans if you want to initiate a route somewhere else. To do this, simply select the route and
    click the Break Route Button.
    When I do this my caravan count simply decreases.
    Visit my CTP-page and get TileEdit and a few other CTP related programs.
    Download and test SpriteEdit development build.

  • #2
    You lose one caravan each time you cancel a route so its probably better to defend the route instead of cancelling any.

    edit: got it right this time
    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
    CtP2 AE Wiki & Modding Reference
    One way to compile the CtP2 Source Code.

    Comment


    • #3
      @#%!!!!!!

      Well I guess I'll just have to change my taktics, unless this could be changed with slic. It doen't make sence that you loos your caravans by changing their destination. I mean if a shipping company lost half of it's ships everytime it changed a route, I shure wouldn't like to be a silor.
      Visit my CTP-page and get TileEdit and a few other CTP related programs.
      Download and test SpriteEdit development build.

      Comment


      • #4
        Yeah it doesnt make much real life sense, but in gameplay terms it makes you defend a trade route from pirates. Also the more caravans a trade route uses the less harm it does to cancel it, obviously, so dont cancel a 1 caravan trade route because you wont get any caravans from it.
        Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
        CtP2 AE Wiki & Modding Reference
        One way to compile the CtP2 Source Code.

        Comment


        • #5
          Peronally I'd prefere a system where there was a certain chance of loosin a caravan when the route is pirated. This way youd still want to defend the traderoute, especially if the chance was cumulative.

          Furthermore if it was impossible to break a traderoute being pirated, or carried a penalty in lost caravans, you'd have even more incentive to defend your caravans.

          But I guess I'll just have to live with it, as I have no slic-knowledge.
          Visit my CTP-page and get TileEdit and a few other CTP related programs.
          Download and test SpriteEdit development build.

          Comment


          • #6
            That should give the lost trader back.

            Code:
            HandleEvent(KillTradeRoute)'MG_GiveTradeUnitBack'post{
            	city_t MGCity;
            	unit_t MGUnit;
            	location_t MGLoc;
                GetCityByIndex(g.player, 0, MGCity);
            	if(HasAdvance(g.player, ID_ADVANCE_TRADE))
            		if(CityIsValid(MGCity)){//Creates an additional Caravan unit near your first city
            			CreateUnit(g.player, UnitDB(UNIT_CARAVAN), MGCity.location, 2, MGUnit);
            		}
            		else{//Creates the Caravan unit somewhere else
            			CreateUnit(g.player, UnitDB(UNIT_CARAVAN), MGLoc, 2, MGUnit);
            		}
            	}
            	elseif(g.player, ID_ADVANCE_GLOBAL_ECONOMICS)){
            		if(CityIsValid(MGCity)){//Creates an additional Z-Freight unit near your first city
            			CreateUnit(g.player, UnitDB(UNIT_Z_FREIGHT_TRANSPORT), MGCity.location, 2, MGUnit);
            		}
            		else{//Creates the Z-Freight unit somewhere else
            			CreateUnit(g.player, UnitDB(UNIT_Z_FREIGHT_TRANSPORT), MGLoc, 2, MGUnit);
            		}
            	}
            }
            Disclaimer: Untestested, untried, maybe buggy.

            You can find this code in the attachment of this post. Just download the attachment unzip it into your ..\ctp2_data\default\gamedata\ folder and open there the file GM1_APOL_script.slc and add this line to the end of the file:

            #include "GiveTraderBack.slc"

            And make shure that the file ends with a blanc line.

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

            Comment


            • #7
              Thanks Martin,

              I tried your code, (there were two minor errors) but unfortunately it does not work.

              I have experimented a bit with it, and the function is called whenever a trade unit is destroyd, but the new trade unit is not created.

              Btw. It should create caravans regardless of tradelevel as they are single route units.
              Visit my CTP-page and get TileEdit and a few other CTP related programs.
              Download and test SpriteEdit development build.

              Comment


              • #8
                The event handler is called but are you shure that the if else statements will ever be true?

                To determine if the if statement is true you could insert a piece of code like this:

                PlaySound("SOUND_ID_ELEPHANT");

                The sound id must be a valid sound from the sound.txt otherwise - silence.


                I hope you played with the /reloadslic ceremony, that will make things easier as you don't have to reload CTP2 every time you want to test another piece of code.

                For the rest of the code you could replace CreateUnit function by the CreateUnit event. So just replace the line with the CreateUnit function with.

                Event:CreateUnit(g.player, MGCity.location, MGCity, UnitDB(UNIT_CARAVAN), 1);

                In the else statement it should be:

                Event:CreateUnit(g.player, MGLoc, 0, UnitDB(UNIT_CARAVAN), 1);

                If this doesn't work I will take a look on this tommorow. I hope this is not as difficuilt as teaching slaves to uprise properly.

                If you are searching for more slic stuff you could take a look into the Apolyton CTP2 Modification Section.

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

                Comment


                • #9
                  Martin the Dane,
                  I often change trade routes to take advantage of new diplomatic situations and to get the most profitable trade routes i can. Unfortunately it will always cost you one caravan to do so, so i make sure i have one of my cities building any extra i need before i make the change to the better trade route - a bit annoying i know, but you can plan for it atleast.
                  I think the most annoying thing is the way your routes are automatically plotted and how DUMB those routes are sometimes(like right through enemy territory ). I don't think that can be Slic-ed, unfortunately.
                  'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

                  Bush's Republican=Neo-con for all intent and purpose. be afraid.

                  Comment


                  • #10
                    child of Thor:
                    Thanks for the tip, I guess that that's the only way.

                    Martin:
                    I have tested your slic quite extensively. From a programmers perspective I can't se why it's not working.
                    If I replace UNIT_CARAVAN with UNIT_HOPLITE a hoplite is created whenever I cancel a traderoute, so the "CreateUnit" function get's executed.

                    I have also tried to replace the function with the event, but here I get an "int_t expected" error, and a crash (I think it was parameter 1).
                    Visit my CTP-page and get TileEdit and a few other CTP related programs.
                    Download and test SpriteEdit development build.

                    Comment


                    • #11
                      Update

                      After posting the above I had an idea: what if I passed g.player as an int_t? I modified the code a bit, and now it works.

                      The code is as follows:
                      Code:
                      HandleEvent(KillTradeRoute) 'MG_GiveTradeUnitBack' post{
                      	city_t MGCity;
                      	unit_t MGUnit;
                      	location_t MGLoc;
                      	int_t MGplay;  // g.palyer must be passed to the event as an int_t
                      	MGPlay = g.player;
                          GetCityByIndex(g.player, 0, MGCity);
                      
                      	if(HasAdvance(g.player, ID_ADVANCE_TRADE)){
                      		if(CityIsValid(MGCity)){//Creates an additional Caravan unit near your first city
                      			Event:CreateUnit(MGPlay, MGCity.location, MGCity, UnitDB(UNIT_CARAVAN), 1);
                      		}
                      		else{//Creates the Caravan unit somewhere else
                      			Event:CreateUnit(MGPlay, MGLoc, 0, UnitDB(UNIT_CARAVAN), 1);
                      		}
                      	}
                      }
                      Visit my CTP-page and get TileEdit and a few other CTP related programs.
                      Download and test SpriteEdit development build.

                      Comment


                      • #12
                        Ok here is the updated version of GiveTraderBack.slc as a .zip file with explanations etc.

                        Edited to remove the attachent, just grab the one two posts down.
                        Visit my CTP-page and get TileEdit and a few other CTP related programs.
                        Download and test SpriteEdit development build.

                        Comment


                        • #13
                          Originally posted by Martin the Dane
                          After posting the above I had an idea: what if I passed g.player as an int_t? I modified the code a bit, and now it works.
                          Yeah I thought players are just ints but I just saw this in the slic documentaion:

                          player.owner - An integer version of the player.

                          This means int != player.

                          Glad to hear that it works now.

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

                          Comment


                          • #14
                            Oops! guess I was a bit premature with declaring that it worked. I found out that it caused the capital not to produce any thing in the turn where the traderoute was canceled.

                            Luckely this was easily corrected, I just renoved the inermost if sentences and acociated variables, so now the whole stuff is as follows:

                            Code:
                            HandleEvent(KillTradeRoute) 'MG_GiveTradeUnitBack' post{
                            	location_t MGLoc;
                            	int_t MGplay; // g.player must be passed as a int_t
                            	MGPlay = g.player;
                            
                            	if(HasAdvance(g.player, ID_ADVANCE_TRADE)){
                            		Event:CreateUnit(MGPlay, MGLoc, 0, UnitDB(UNIT_CARAVAN), 1);
                            	}
                            }
                            Disclaimer: This has not been tested for unforseen bugs, but it does give back the lost trader
                            Attached Files
                            Visit my CTP-page and get TileEdit and a few other CTP related programs.
                            Download and test SpriteEdit development build.

                            Comment


                            • #15
                              u know, i think it adds to the gameplay to lose caravans when routes r broken,
                              it also is like a merchant losing his job (or not)

                              Comment

                              Working...
                              X