No announcement yet.

Religion Code for SAP - BETA

  • Filter
  • Time
  • Show
Clear All
new posts

  • Religion Code for SAP - BETA

    Pedrunn and I have worked in the past two months on a possible implementation of the concept of religion. The code as I stands now is fully playable. It is an addition to the Super Apolyton Pack, so you need to have that installed before. There's also a German translation coming with it.
    For more information read the readme or if you want to know before you download the 250kb read here:
    Creation Thread

    There's a few reasons why this is still called a BETA:
    - even though I did much play testing there might still be some bugs, please play with debugslic=yes and report (you might get an error from SAP, but it's rather unlikely and we'll be able to tell...)
    - I tried to balance the system, but especially AI behaviour or values of happiness/tenths might need some adjusting, feel free to suggest
    -the GL could be adjusted a little

    This zip has been updated on Oct 22 - the LogRegardEvent works now. Thanks Peter!
    Attached Files
    Last edited by mapfi; October 22, 2002, 12:41.

  • #2
    If you already downloaded the zip before Oct 22, you can just replace the religion.slc with the following one:
    Attached Files
    Last edited by mapfi; October 22, 2002, 12:39.


    • #3
      hey ive downloaded the file to look at the read me and it looks very very cool although i dont play SAP nor have it installed im thinking about getting it just to try this..

      A few things, i wasnt quite clear on what Religiouns are included in the mod.

      I have a massive post ready for the "Best of both worlds" thread. One of my ideas was to have specific diplomatic proposals between specific government types (eg. monarchy [offer Royal Marriage]) anyway the same would be good between nations of the same religioun

      i had another point but cant remember it . anyway it sounds great keep up the good work and I look forward to viewing other ppls feed back
      Oxygen should be considered a drug
      Tiberian Sun Retro
      My Mod for Tiberian Sun Webmaster of


      • #4
        I guess the readme doesn't make it clear. Since we're using the ingame religion coded stuff the religions are defined by their civ. You'll have like the American, Dutch,... religion.
        We could of course give them another name and let you choose one. But we decided against this because for one there's a problem with getting the strings in the messages then and for the other the game allows only as many religions as players. You could use the government settings to set a religion instead but that'd be a totally different approach and would mean to start from scratch.


        • #5

          Here's the file I mentioned.

          I did two things:

          1) I set "tmpPlayer" to "player[0]" rather than "g.player". I never use "g.player" if "player[0]" is available via the event. Here "player[0]" is passed through the BeginTurn event and is the player who is beginning his turn.

          2) I was still getting 'wrong type of argument' errors so I checked the values of "tmpplayer" and "i" and found that "i" was taking the value "32". I don't know why it was, but when I changed "33" to 'preference("NumPlayers")' the crashes stopped. You'll have to verify that it's still doing what you want it to do, but evidently that's what was causing the crashes.
          Attached Files


          • #6
            32? There is a if IsPlayerAlive(i) before those lines, and 32 shouldn't be alive unless you have set the number of players real high.

            I didn't know that one - Now this should do the trick actually - the only thing that could come in the way would be the creation of a new civ - What player number will that civ get? If it can be higher than NumPlayers then I'll have to find a workaround.
            Thanks a lot Peter.


            • #7
              int_t players;
              if(preference("MaxPlayers") > preference("NumPlayers")){
                 players = preference("MaxPlayers");
              } else {
                 players = preference("NumPlayers");
              If you use MaxPlayers, you have to check if each one is alive before doing anything with it. But you're doing that anyway, so it's all good.
              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


              • #8
                thanks - but why would I have to use this? So far I was just going through 1 to 33 since 34 is the max player in ctp2 (isn't it) and check if they were alive. That's why I can imagine how Peter got 32... here's the part of the code that's making those troubles:
                	if (tmpPlayer != i && IsPlayerAlive(i) && i > 0) {
                		if(PlayerReligion[i] == 0) {
                			if (PlayerCityCount(i) > 0) {
                				GetCityByIndex(i, 0, FirstCity);
                				PlayerReligion[i] = GetCityReligion(FirstCity); //if city has no religion -> default is owner number
                				PlayerNum = PlayerNum + 1;
                		elseif(tmpReligion != PlayerReligion[i]) {
                			player[3] = i;
                			LogRegardEvent(player[3], player[0], -2, 0, ID_NONE, 0);
                		else {
                			player[3] = i;
                			LogRegardEvent(player[3], player[0], 5, 0, ID_NONE, 0);
                //VOID LogRegardEvent(int, int, regardDelta, regardEventType, ID_string, Delta_what)
                //regardDelta is the amount to increase the first player's regard towards the second by. 
                //The Regard Event Types are ScenarioEvent, MilitaryPowerEvent, MilitarySafetyEvent,
                DiplomacyEvent, GoldEvent, KnowledgeEvent, & ProductionEvent. So "0" is probably the null event type. 
                //ID_string is a string used in the Diplomacy intelligence screen.
                //Delta_what has, I think, something to do with turns. For example,
                		// Make the Allies like each other
                		//LogRegardEvent(2, 3, 1000, 0, ID_WW_BLANK, turnMax);      
                //where turnMax is the number of turns in the WW2 scenario. It doesn't seem to make the change recur though.
                Last edited by mapfi; October 22, 2002, 09:29.


                • #9
                  Hehe, I think I got it - I thought the maximum of players was 34 (including the barbarians), so I'd the player numbers would go up to 33. No clue where I got that. Now I read in the FAQ by Martin, that it only goes up to 29 players. I think he means it as number in the userdata.txt but actually I think it's opponents without barbarians which would be what my testing like Peter did showed: IsPlayerAlive() returns true for 32 and 33, even though they are certainly not alive. Unless the game take the player number modulo 31 minus 1... wicked!
                  I'm updating the code in the first post. Thanks again for your help, guys.
                  Last edited by mapfi; October 22, 2002, 12:36.


                  • #10
                    The maximum number of players is theorically 32, so indices 0 to 31. Non-existant player numbers (>31, and maybe <0 as well) return true by default (which is stupid but that's SLIC ).
                    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery


                    • #11
                      Oh, so you tell me that now after we had to find out ourselves!!!... But in that case the FAQ needs to be adjusted since the number in the userdata.txt can be set to 31 then and not only up to 29. Because that's what it makes you think now the way it's worded.
                      Anyway - Locutus thanks.


                      • #12
                        Actually if I tried to start a game with more then 29 players then all the players above index 28 where Barabarian and I wasn't able to reload such a game, so the FAQ don't need to be updated until you proove the opposite or offer a fix. I remember vage a comment by player1 about the issure, but that was a little bit to short and I didn't examined it.

                        Civ2 military advisor: "No complaints, Sir!"


                        • #13
                          Well, I just started a game with NumPlayers set at 32 and it worked okay: I had a game with 1 human, 30 AIs and 1 Barbarian civ. I did have a problem with reloading savegames, but that doesn't take anything away from the fact that the theoretical limit is 32 civs. Whether or not that works in practice remains to be seen (I didn't bother to find out if I could circumvent the reload bug somehow), but when programming SLIC, the theoretical limit is the one you'll have to work with. Although the existing info in the FAQ doesn't need to be changed, it might be useful to add an addendum...
                          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery


                          • #14
                            Why isnt this mod in the database?
                            I thought it was but just checked the database and it isnt!

                            "Kill a man and you are a murder.
                            Kill thousands and you are a conquer.
                            Kill all and you are a God!"
                            -Jean Rostand


                            • #15
                              Originally posted by Pedrunn
                              Why isnt this mod in the database?
                              I thought it was but just checked the database and it isnt!

                              Probably, because mapfi did not submitted it to the Apolyton Directory. That is the last step that the creator of a mod has to do if he whishes to have the mod in the Apolyton directory, there might be some people who don't liek it if they did not gave permission.

                              Civ2 military advisor: "No complaints, Sir!"