Announcement

Collapse
No announcement yet.

Clerics, Corporate branch and so on...

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

  • Clerics, Corporate branch and so on...

    The discussion about the use of clerics, teleevangelist and corporate branch started in the strategy forum

    but really has to be part of this one, since we're talking about modifying.

    To adjust the money given by selling indulgences to the city size is rather easy, some slic does it:
    Code:
    HandleEvent(IndulgenceSaleMade) 'newsellindulgence' post{
    	AddGold(unit[0].owner, (city[0].population*5));
    	AddGold(city[0].owner, -(city[0].population*5));
    }
    Worked in my testing, so far... Just adds that amount of gold to the already generated one defined in the const.txt

    Now what I'm looking for:
    I'd like to replace the "5" with a factor according to the state of the city, unconverted, converted or converted to other faith like in the const.txt.
    Any idea where I get the state of the city?

  • #2
    Re: Clerics, Corporate branch and so on...

    Originally posted by mapfi
    Any idea where I get the state of the city?
    I dont think we can
    "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
      could I continously create the data with global arrays? But that would probably take up too much memory...

      Just another slic question, in the above code - should I put the two owners into user-defined variables before I use them in the function? There's soemthing in the documentation but I'm not sure if it's still valid since I see other modmakers using it also this way.

      Comment


      • #4
        You can do, but you don't need to. Often it's easier for long code to put them into use-defined variables, but for something like that, what you have is fine.

        I guess if you kept track of every conversion and reformation it might be possible, but the easiest way would be to have city arrays.
        I don't know if we can use city arrays, or only int arrays.
        Concrete, Abstract, or Squoingy?
        "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

        Comment


        • #5
          Originally posted by mapfi
          Just another slic question, in the above code - should I put the two owners into user-defined variables before I use them in the function? There's soemthing in the documentation but I'm not sure if it's still valid since I see other modmakers using it also this way.
          Unfortunatly sometimes you need to do it, ones I used something like this in a self defined function and the game crashed this way, in other situations you will get this way DebugSlic=Yes errors, I started to debug these, too.

          But if nothing happens and it does what you wants then it is fine.

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

          Comment


          • #6
            Re: Clerics, Corporate branch and so on...

            Originally posted by mapfi
            Now what I'm looking for:
            I'd like to replace the "5" with a factor according to the state of the city, unconverted, converted or converted to other faith like in the const.txt.
            Any idea where I get the state of the city?
            I like your approach. If we can't get the state of the city, maybe make the const.txt value more important and the city size less important, perhaps zero for Other, five for Unconverted, and ten for Converted, (or even zero, ten, and twenty), and use a factor of "3" (or "2") instead of "5."
            "...your Caravel has killed a Spanish Man-o-War."

            Comment


            • #7
              Not a bad idea if we just can't get that stupid city state...

              I was also thinking about working on conversion: If the just converted city is the capital one could argue that you also might convert the civilizations leader, which then would proclaim the new religion as state religion (like it was done with christianity in old rome). Either all or maybe each city with a given probability would then also be converted.
              The values for the clerics would have to be adjusted though, maybe lower the conversion factor and maybe not making the whole converting process too probable. But all in all rather easy slic and some txt adjustements.

              What do you think?

              Comment


              • #8
                Yeah it did not hit me that we can keep stored in global variable wich cities were converted.

                And this idea may lead to a completely new feature.
                Religion.
                Probably controled by messagebox. Wich i dont know how far we can go. Yet, this is a major addition!
                "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


                • #9
                  Big project lurking around and attacking out of nowhere!

                  and I was just starting to get into this stuff...

                  Comment


                  • #10
                    Hasn't Locutus already worked on the concept of religion for his ctp3-mod?

                    Comment


                    • #11
                      hehehe

                      As i think.
                      Besides storing wich cities were converted you would also store the player who converted.
                      Everyturn the player who converted takes a small percentage of gold from the converted civ according to the city's population and an extra if he converted the capitol. (plus the gold from sell indulgences is bigger).
                      Every time a city is converted the city owner gets a choice to join the convertor religion. If he dont accept he still keeps losing its money (note he can still reform the city).

                      If he accepts all of his cities get converted to the other player religion (this will cause unhapppiness in all cities that werent converted and increase the happiness in those that were converted). The number of gold taken by the other civ drasticly decreases and the player with the new religion can sell indulgences to other civs and get the same amout as if it was converted by him.

                      I dont think it will be a problem to teach the AI how to use it.
                      "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


                      • #12
                        Some thought were given to its mod but i think they went too far away from reality.
                        And nothing was said when or how he was going to make. This can be the kick to start all of what he wanted.
                        "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
                          Could you test this code Mapfi or anyone?

                          It follows the first idea of only changing the money from conversion and sell improvements.
                          It should add one gold per population of the converted cities to the player who convert these city.
                          It also re-calculates the sell indulgences. Giving one gold per civ in a city if the city is converted by the cleric owner. And 1 gold for every 5 pop if the city isnt converted. And 1 gold per 10 pop if the city isnt converted.

                          If it works we can move on to next stage: Giving identity to the religions.

                          Any comments?

                          Code:
                          ////////////////////////////////////////////////////////////////////////////
                          // 1) Religion Code
                          ////////////////////////////////////////////////////////////////////////////
                          
                          city_t ConvertedCity[];
                          int_t ReligionOwner[];
                          
                          int_t ReligiousCount;
                          
                          int_f GetCityConvertor(city_t tmpCity) {	// if GetCityConvertor = 0, means city is not converted
                          int_t tmpPlayer;
                          int_t i;
                          	if(CityIsValid(tmpCity)) {
                          		for(i = 0; i <= ReligiousCount; i = i + 1) {
                          			if(tmpCity == ConvertedCity[i]) {
                          				tmpPlayer = ReligionOwner[i];
                          			}
                          		}
                          	}
                          	return tmpPlayer;
                          }
                          
                          
                          HandleEvent(ConvertCity) 'StoreConvertedCity' pre {
                          city_t tmpCity;
                          int_t i;
                          	if(CityIsValid(city[0]) && IsPlayerAlive(player[0])) {
                          		for(i = 0; i <= ReligiousCount; i = i + 1) {	
                          			if(city[0] == ConvertedCity[i]) {	
                          				ReligionOwner[i] = 0;		// Erase old owner 
                          			}
                          		}
                          		ConvertedCity[ReligiousCount] = city[0];
                          		ReligionOwner[ReligiousCount] = player[0];
                          		ReligiousCount = ReligiousCount + 1;		// Store city and player who converted
                          	}
                          }
                          
                          HandleEvent(BeginTurn) 'ConvertorTakesTheMoneyPerTurn' post {
                          int_t SinfulCiv;
                          int_t PriestCiv;
                          int_t theTenth;
                          int_t i;
                          	SinfulCiv = player[0];
                          	for(i=0; i < player[0].cities; i = i + 1) { 	 
                          		GetCityByIndex(SinfulCiv, i, city[0]);	
                          		PriestCiv = GetCityConvertor(city[0]);
                          		if(PriestCiv != 0) {
                          			theTenth = city[0].population;	// How much it will be? 1 gold per pop per turn?
                          			AddGold(SinfulCiv, theTenth);
                          			AddGold(PriestCiv, - theTenth);
                          		}
                          	}
                          }
                          
                          HandleEvent(SellIndulgencesOrder) 'ConvertorTakesTheMoneyFromIndulgences' pre {
                          int_t SinfulCiv;
                          int_t PriestCiv;
                          int_t ConvertorCiv;
                          int_t theTenth;
                          army_t GodsArmy;
                          location_t tmpLoc;
                          	GetCityByLocation(tmpLoc, city[0]);		//
                          	PriestCiv = GodsArmy.owner;			//
                          	ConvertorCiv = GetCityConvertor(city[0]);
                          	SinfulCiv = City[0].owner;
                          	if(ConvertorCiv == PriestCiv) {		// If city is converted by the cleric owner
                          		theTenth = city[0].population;		// How much gold he gets? 1 gold per  pop 
                          		AddGold(SinfulCiv, theTenth);
                          		AddGold(PriestCiv, - theTenth);
                          	}
                          	elseif(ConvertorCiv == 0) {			// if City is not converted
                          		theTenth = 1 + city[0].population/5;	// How much gold he gets? 1/10 gold per pop 
                          		AddGold(SinfulCiv, theTenth);
                          		AddGold(PriestCiv, - theTenth);
                          		
                          	}
                          	elseif(ConvertorCiv != PriestCiv) {		// if city is coverted by another civ religion
                          		theTenth = 1 + city[0].population/10;	// How much gold he gets? 1/20 gold per pop 
                          		AddGold(SinfulCiv, theTenth);
                          		AddGold(PriestCiv, - theTenth);
                          	}
                          }
                          EDIT: A small mistake that would ruin everything was find. The code above is now correct.
                          Teh correct version
                          Last edited by Pedrunn; August 7, 2002, 07:32.
                          "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


                          • #14
                            well, you got me started there! I'll list the changes:
                            • included new function for checking if city is already in the array
                            • erased validity checks when debugging (i don't know if those are necessary - you tell me - but when I was looking for mistakes they came in my way
                            • erased counters, because the .# gives the actual size of the array
                            • took a while till I spotted that: ConvertedCity[ROwnerCounter] = player[0];, should be ReligionOwner of course
                            • included Reformation of city by owner
                            • erased the part of the converted cities giving gold, since that is already done by the regular game, we could, however, make adjustements here
                            • took IndulgenceSaleMade as event
                            • changed minus signs in sell indulgence, you subtracted gold from the seller
                            • changed the values in sellindulgences, a tenth of pop is not going to make much difference


                            It worked in my testing, so far... Thanks a lot for getting me going!

                            note: we should of course set the values of the sell indulgence event in the const.txt to zero, to make it clearer what the total effect actually is and where it's defined, same if we want to change the converted cities paying gold -> 2nd note: in the game this is 0.2 times the gold production of the city - so not what you had in mind here, but we can easily access the cities gold production via slic if we want to make any changes there

                            Code:
                            ////////////////////////////////////////////////////////////////////////////
                            // v.1 Religion Code by Pedrunn
                            // v.2 by mapfi
                            ////////////////////////////////////////////////////////////////////////////
                            
                            city_t ConvertedCity[];
                            int_t ReligionOwner[];
                            
                            
                            int_f GetCityConvertor(city_t tmpCity) {	// if GetCityConvertor = 0, means city is not converted
                            int_t tmpPlayer;
                            int_t i;
                            	if(CityIsValid(tmpCity)) {
                            		for(i = 0; i < ConvertedCity.#; i = i + 1) {
                            			if(tmpCity == ConvertedCity[i]) {
                            				tmpPlayer = ReligionOwner[i];
                            			}
                            		}
                            	}
                            	return tmpPlayer;
                            }
                            
                            int_f CheckforCity(city_t tmpCity) {	//if City is already in array returns place, otherwise next free array place
                            int_t i;
                            int_t num;
                            num = ConvertedCity.#;
                            	for(i = 0; i < ConvertedCity.#; i = i + 1) {
                            		if(tmpCity == ConvertedCity[i]) {
                            				i=num;
                            		}
                            	}
                            	return num;
                            }
                            
                            HandleEvent(ConvertCity) 'StoreConvertedCity' post {
                            int_t i;
                            	i = CheckforCity(city[0]);
                            	ConvertedCity[i] = city[0];
                            	ReligionOwner[i] = player[0];
                            }
                            
                            HandleEvent(UnconvertCity) 'StoreUncovertedCity' post {		//reformation by city owner
                            int_t i;
                            	i = CheckforCity(city[0]);
                            	ConvertedCity[i] = city[0];
                            	ReligionOwner[i] = 0;
                            }
                            
                            HandleEvent(IndulgenceSaleMade) 'ConvertorTakesTheMoneyFromIndulgences' post {
                            int_t SinfulCiv;
                            int_t PriestCiv;
                            int_t ConvertorCiv;
                            int_t theTenth;
                            	PriestCiv = unit[0].owner;
                            	ConvertorCiv = GetCityConvertor(city[0]);
                            	SinfulCiv = city[0].owner;
                            	if(ConvertorCiv == PriestCiv) {			// If city is converted by the cleric owner
                            		theTenth = city[0].population*5;		// How much gold he gets? 1 gold per pop times 5
                            		AddGold(SinfulCiv, - theTenth);
                            		AddGold(PriestCiv, theTenth);
                            	}
                            	elseif(ConvertorCiv == 0) {			// if City is not converted
                            		theTenth = city[0].population*3;		// How much gold he gets? 1 gold per pop times 3
                            		AddGold(SinfulCiv, - theTenth);
                            		AddGold(PriestCiv, theTenth);
                            		
                            	}
                            	elseif(ConvertorCiv != PriestCiv) {			// if city is coverted by another civ religion
                            		theTenth = city[0].population;		// How much gold he gets? 1 gold per pop 
                            		AddGold(SinfulCiv, - theTenth);
                            		AddGold(PriestCiv, theTenth);
                            	}
                            }

                            Comment


                            • #15
                              Originally posted by mapfi
                              • included new function for checking if city is already in the array
                              • erased counters, because the .# gives the actual size of the array
                              I dont think this will give any advantage. But for sure you a much experienced programmer than i am (my very first code only has two/three months).

                              Originally posted by mapfi
                              • took a while till I spotted that: ConvertedCity[ROwnerCounter] = player[0];, should be ReligionOwner of course
                              You got me few minutes before i had edited that post where i fixed this bug. I also changed the cod in a way that it only has one count (instead of for city and other for the player).

                              Originally posted by mapfi
                              • included Reformation of city by owner
                              I did forgot that, dindnt i?

                              Originally posted by mapfi
                              • erased the part of the converted cities giving gold, since that is already done by the regular game, we could, however, make adjustements here
                              Yet i have added that because i plan to pop messages box every turn (without show() function for sure) where it says how much gold was lost/gained by the civ. Yet we didnt made religious so important to have this messaging poping out. (I also plan to add other information in this message box about trade and others features)

                              Originally posted by mapfi
                              • took IndulgenceSaleMade as event
                              I hadnt seen this event befor. It sure looks to be trustful to work than SellIndulgences orders. Other than i dont see much of a difference
                              • changed minus signs in sell indulgence, you subtracted gold from the seller
                              [/quote]

                              Ooops

                              Originally posted by mapfi
                              • changed the values in sellindulgences, a tenth of pop is not going to make much difference
                              I was going to start a discussion about that. This value was just temporary (thats why i create a whole new variable in the code so that was easier to edit.

                              Originally posted by mapfi
                              It worked in my testing, so far... Thanks a lot for getting me going!
                              Glad to hear this. This is enough for us to work with yor code and to move on to stage two. Although i may need to get used to the .# wich i had never seen it before. ( as i said i am not much of experienced programmer)

                              Originally posted by mapfi
                              note: we should of course set the values of the sell indulgence event in the const.txt to zero, to make it clearer what the total effect actually is and where it's defined, same if we want to change the converted cities paying gold
                              Thats what i had in mind
                              Originally posted by mapfi
                              -> 2nd note: in the game this is 0.2 times the gold production of the city - so not what you had in mind here, but we can easily access the cities gold production via slic if we want to make any changes there
                              Sure thing. This is also good if we will want to implement the message box idea.
                              Last edited by Pedrunn; August 7, 2002, 08:07.
                              "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