Announcement

Collapse
No announcement yet.

Advance from city capture

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

  • Advance from city capture

    I got an email today in which I was asked the following:

    [...]

    Something else. One feature of CTP1 which was never carried over to Ctp2 was the ability to find an advance in a captured city. I really liked that feature and a number of CTP1 players I spoke to said that they didnt play ctp2 because this feature was missing. Any chance of a mod to change that?

    [...]
    I think we've tried this in the past, haven't we? Why did it never work out? I would like to have this back myself as well...
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

  • #2
    I have tried this myself but the problem is the arguments of the HasAdvance(int_t, advance ID) and the GrantAdvance(int_t, advance DB).

    The ID of an advance does not equal its database number.

    So the real problem is how to interact both functions after that the code will be piece of cake.

    I had already imagined in create a new HasAdvance function that goes like this:
    Code:
    NewHasAdvance(int_t thePlayer , int_t theAdvance) {
    int_t tmpAdvance;
    int_t tmpPlayer;
    	tmpPlayer = thePlayer;
    	tmpAdvance = theAdvance;
    	if(tmpAdvance == AdvanceDB(ADVANCE_ASTRONOMY)
    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ASTRONOMY)) {
    			return 1;
    		}
    	elseif(tmpAdvance == AdvanceDB(ADVANCE_ARCOLOGIES)
    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ARCOLOGIES)) {
    			return 1;
    		}
    	}
    	// ....
    	// for all advances
    	// ....
    	return 0;
    }
    The major problem is that every mod will have to make big changes in this function to fit all of its advances.

    Yet once done. We would just need to write this code:
    Code:
    HandleEvent(CaptureCity) 'GiveThePlayerAdvanceFromCity' pre {
    int_t i;
    int_t sucess;
    	while( sucess == 0 && i < 200) {
    		if(NewHasAdvance(player[1], i) && !NewHasAdvance(player[0], i) {
    			GrantAdvance(player[0], i);
    			sucess = 1;
    		}
    		i = i + 1;
    	}
    }
    done

    PS: Shouldnt this be in the Creation Forum?
    Last edited by Pedrunn; September 6, 2002, 07:12.
    "Kill a man and you are a murder.
    Kill thousands and you are a conquer.
    Kill all and you are a God!"
    -Jean Rostand

    Comment


    • #3
      Ah, yes. Well, that isn't very hard then. It's a lot of work, but it isn't be hard. Modmakers could do this themselves, no need to rely on SLIC-coders for this. All we need now is someone willing to copy-paste the else-if clause 100+ times (per mod) and fill in the right advance names...

      Originally posted by Pedrunn
      PS: Shouldnt this be in the Creation Forum?
      Yes, I accidentally posted it in the wrong forum and notified Ming only seconds after posting the thread, but he doesn't seem to be online. (If only Markos would let me moderate these forums myself...)
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • #4
        Originally posted by Locutus
        (If only Markos would let me moderate these forums myself...)
        I'm actually surprised that you don't have moderation powers for the CTP2 Forums....
        ____________________________
        "One day if I do go to heaven, I'm going to do what every San Franciscan does who goes to heaven - I'll look around and say, 'It ain't bad, but it ain't San Francisco.'" - Herb Caen, 1996
        "If God, as they say, is homophobic, I wouldn't worship that God." - Archbishop Desmond Tutu
        ____________________________

        Comment


        • #5
          No, Markos only gives out modding powers when he thinks they are needed (yes, I know Scenario League has 3 mods, two of whom have never used their modding powers (the third one only once)).

          Oh well, what can you do (besides harassing Ming every other day )?
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #6
            Locutus you should be moderator very strange why your not ?????


            This capture code would be very cool as long as it was a relativly small % chance say 25% or whatever works best.
            Oxygen should be considered a drug
            Tiberian Sun Retro
            My Mod for Tiberian Sun Webmaster of
            http://www.tiberiumsun.com

            Comment


            • #7
              Tell Markos, don't tell me! It's not like Ming and I haven't asked for it (several times each)...

              Yes, I agree, adding a chance element would be nice...
              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

              Comment


              • #8
                Originally posted by SMIFFGIG's
                This capture code would be very cool as long as it was a relativly small % chance say 25% or whatever works best.
                Actual this is the original indented chance I found in my GM1_Const.txt.

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

                Comment


                • #9
                  Hello all, I was the one who emailed Locutus.

                  I have been a gamer for many years and I look for games that are challenging, balanced, streamlined and fun to play.

                  I received Medieval Total War on tuesday and think after 4 days how a couple of concepts in the game just ruin the overall fun. So many games like Civ 3 and MTW seem to to equate difficulty levels with just giving the AI a heap of freebies and let U just suffer. In MTW you can wipe out a small factuin and the computer will just re-activate them later. Not so bad BUT it can just give the faction an overwhelming force out of the blue and just dump it in one or more of your provinces. In other words, no matter what U do, the this army, often bigger than the total army the faction fielded when when it was in play, and with no restriction of support, just is dumped on U.

                  What games need is a balancer to offset what some would say is playing against someone who cheats. Things like the advance from city capture are a nice balancer. In other words there is something the player can do to partially redress the advantages given to the AI.

                  Please dont forget this project and I hope someone is working on the mod to achieve it. if I knew anything about programming, I would be straight into it myself.

                  Comment


                  • #10
                    I tested the code now! Something i hadnt done before. it needed some small changes in syntax and it worked amazingly. We just need someone to compile all advances to it.
                    stankarp, Dont you want to do this? It isnt hard at all. Even if you have any skill in coding. You just need to open the advance.txt found in the folder ctp2 main directory\ctp2_data\default\gamedata\
                    In this file you will find the data for all advances. Then replace the '*' for the advance entry name In the piece of code below. Then copy this piece of code after similar lines of the code.
                    Code:
                     
                    	elseif(tmpAdvance == AdvanceDB(*)) {
                    		if(HasAdvance(tmpPlayer, ID_*)) {
                    			return 1;
                    		}
                    	}
                    I did for the first four advances. Here how it should look like:

                    Code:
                    int_f NewHasAdvance(int_t thePlayer , int_t theAdvance) {
                    int_t tmpAdvance;
                    int_t tmpPlayer;
                    	tmpPlayer = thePlayer;
                    	tmpAdvance = theAdvance;
                    	if(tmpAdvance == AdvanceDB(ADVANCE_ADV_INFANTRY_TACTICS)) {
                    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ADV_INFANTRY_TACTICS)) {
                    			return 1;
                    		}
                    	}
                    	elseif(tmpAdvance == AdvanceDB(ADVANCE_ADV_NAVAL_TACTICS)) {
                    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ADV_NAVAL_TACTICS)) {
                    			return 1;
                    		}
                    	}
                    	elseif(tmpAdvance == AdvanceDB(ADVANCE_ADV_URBAN_PLANNING)) {
                    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ADV_URBAN_PLANNING)) {
                    			return 1;
                    		}
                    	}
                    	elseif(tmpAdvance == AdvanceDB(ADVANCE_ADVANCED_COMPOSITES)) {
                    		if(HasAdvance(tmpPlayer, ID_ADVANCE_ADVANCED_COMPOSITES)) {
                    			return 1;
                    		}
                    	}
                    //	TEMPLATE: where * must be replaced by a advance entry name from the advance.txt 
                    //	elseif(tmpAdvance == AdvanceDB(*)) {
                    //		if(HasAdvance(tmpPlayer, ID_*)) {
                    //			return 1;
                    //		}
                    //	}
                    	// ....
                    	// for all advances
                    	// ....
                    	return 0;
                    }
                    
                    HandleEvent(CaptureCity) 'GiveThePlayerAdvanceFromCity' pre {
                    int_t i;
                    int_t sucess;
                    int_t Conqueror;
                    int_t conquered;
                    	Conqueror = player[0];
                    	conquered = city[0].owner;
                    	while(sucess == 0 && i < 200) {
                    		if(!NewHasAdvance(Conqueror, i) == 1 
                    		&& NewHasAdvance(conquered, i) == 1) {
                    			GrantAdvance(Conqueror, i);
                    			sucess = 1;
                    		}
                    		i = i + 1;
                    	}
                    }
                    Obs: // is comment. nothing after this sign is part of the code.
                    Last edited by Pedrunn; September 14, 2002, 08:42.
                    "Kill a man and you are a murder.
                    Kill thousands and you are a conquer.
                    Kill all and you are a God!"
                    -Jean Rostand

                    Comment


                    • #11
                      Would you like me to write a little application to process any given advance.txt and spew out appropriate SLIC? I could do that really easily.

                      Comment


                      • #12
                        You mean make this repetitive lines for all mods with a couple of clicks?
                        For sure.
                        Last edited by Pedrunn; September 14, 2002, 08:58.
                        "Kill a man and you are a murder.
                        Kill thousands and you are a conquer.
                        Kill all and you are a God!"
                        -Jean Rostand

                        Comment


                        • #13
                          Sorry, but I dont know the first thing about programming and changing codes. When i retire in 9 weeks time I might try to do some corses to give me some basic ideas. until then, please keep up the good work and I eagerly await the mod.

                          Comment


                          • #14
                            Here's a program which will do that and some more...

                            I've no time to write any documentation right now, but the short version is to unzip, put advance.txt into the same directory and run run.bat. You can fiddle with template.txt and run.bat to get different results, such as use units.txt for input. It should all be fairly obvious.
                            Attached Files
                            Last edited by J Bytheway; September 16, 2002, 09:36.

                            Comment


                            • #15
                              It just stops here and I cant anywhere else:
                              Attached Files
                              "Kill a man and you are a murder.
                              Kill thousands and you are a conquer.
                              Kill all and you are a God!"
                              -Jean Rostand

                              Comment

                              Working...
                              X