Announcement

Collapse
No announcement yet.

Clerics, Corporate branch and so on...

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

  • #46
    Originally posted by mapfi
    if you test with debugslic=yes you'll get an array out of bound when you try to write into player[1] in the convertciv trigger
    Yes that is a problem but you could check first if the player is alive.

    Originally posted by mapfi
    where is the ai told that converted cities are something bad? Ihave to turn that off, otherwise my idea with different religions and for each one a colour (unlike Pedrunn's with a native religion to each player) won't work
    strategies.txt just remove the according goal element.

    Originally posted by mapfi
    a newbie to slic question - is player[0] the player who's got the turn or the one defined in the called event? Actually it's pretty clear that it is the first one but a wrong thought like that screwed me up big time today...
    From the slic documentation and the other slic you could think as it is. But DebugSlic=Yes tells me something different, so use it only if the event has a player variable. Unfortunatly in most cases the player is stored as an int and not as a player array. Oh and by the way you saw this in the last tournerment that player[0] is not necessary the same player as the player who has it is his turn. g.player is the player who's turn it is. I guess for the BeginTurn event there are identical but not for the GrantAdvance event.

    Originally posted by mapfi
    So, more tomorrow,
    That is a good idea.

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

    Comment


    • #47
      well, well, well,... I'm lost.

      I tried again and again but can't get it to work the way I'd like, but since Europe has got the most ****ty summer ever, there's really not much other stuff to do ;-) Now be careful when you say you got the best summer at your place because you'll have to have a bed ready for me the very next day
      I put the code in several files in order not to loose the overview. religion.slc has a few explanations right at the start which explain my intentions.

      Problems I ran into:
      • The handler of the createcity event should convert a newly founded city to the state religion of the player. The funny thing is, it works for all ai-players, their cities are converted. When the human player founds one though, the cross appears while the citymanager window is open and dissappears immeadetly when it's closed. Here I'm lost...
      • The handler for the governmentchange uses the event beginturngovernment - seems like this one is called every turn though - nevertheless the code is executed because of the If(CityRel == player[0]) part, but when I take it out, the cities are converted to a random player. I'm beginning to fear the cityarray is not working as it should. But that couldn't be because it worked in the SellIndulgence part without flaws. So it might be the problem of point 5...
      • I said before that I don't trust the convertcityunit event. However, I'm sure now that it works - nevertheless I won't get the message, even if I set probability really high - I think it might have to do something with the floating point values which are converted who knows how. I found something in the language documentation that says they're multiplied by 100 but in the context of DB access.
      • the whole player[0], g.player freaked me out and I intoduced a new global variable to carry over the CityRel. Anyway, I think their's a logical flaw in the ConvertCity handler as Pedrunn and I wrote it before if player[0] is the player argument in the Event, because then the second time the handler is called the stored value isn't the same that the city was just converted to. Does this rubbish I'm writing make sense?...
      • I fear that we're also up against the asynchronous event handling - just for an example what exactly happens if I call ConvertCity(tmpCity, CityRel, 0) when the global variable CityRel is changed by the following code before the event is execute?...

      Have fun looking this through...
      Attached Files

      Comment


      • #48
        1)Peter, thanks to clarify some thing up. I did not know about that info.
        Originally posted by Peter Triggs
        So, I guess you just want to use a messagebox.
        2)Thanks for pointing that up. I will fix it
        Originally posted by Peter Triggs
        Do you have DebugSlic=Yes?
        3)No. But I will start turn it on
        Originally posted by mapfi
        • The handler of the createcity event should convert a newly founded city to the state religion of the player. The funny thing is, it works for all ai-players, their cities are converted. When the human player founds one though, the cross appears while the citymanager window is open and dissappears immeadetly when it's closed. Here I'm lost...
        I will check this one

        Originally posted by mapfi
        • The handler for the governmentchange uses the event beginturngovernment - seems like this one is called every turn though - nevertheless the code is executed because of the If(CityRel == player[0]) part, but when I take it out, the cities are converted to a random player. I'm beginning to fear the cityarray is not working as it should. But that couldn't be because it worked in the SellIndulgence part without flaws. So it might be the problem of point 5...
        All those beginTurn events works like a BeginTurn. I dont knoe the difference among them but i think there must be some sort of timing. Eg. When the turns begin first check gov changes, then the armies moves, the the improvements are created, then... and those begin turns works like that. Athoulgh i am not sure about that.

        Originally posted by mapfi
        • I said before that I don't trust the convertcityunit event. However, I'm sure now that it works - nevertheless I won't get the message, even if I set probability really high - I think it might have to do something with the floating point values which are converted who knows how. I found something in the language documentation that says they're multiplied by 100 but in the context of DB access.
        If we see this dont work we can create a new global variable to prevent messages to appear.
        Something like:
        Code:
        int_t ConversionMessage;
        
        HandleEvent(ConvertCity) 'DoYouWantToConvert' pre {	// also when a city is being converted
        	// Code removed to save post space
        	if (IsHumanPlayer(city[0].owner)) {		// If he is a human player 
        		if(ConversionMessage == 0) {
        			if ((CityCount*10)/TotalCityCount >= 0) {			
        				message(city[0].owner, 'DoYouWantToConvertCiv'); 	
        			}
        		}
        		else{
        			ConversionMessage = 0;
        		}
        	}
        	// Code removed to save post space
        }
        Another variable to follow the ConvertCity function Where Conversion message is previously set to be 1 before the ConvertCity is trigeered
        eg.
        Code:
        ConvertNum = 1;			// avoiding a second conversion in a loop	
        ConversionMessage = 1;		// Dont send the convert Civ Message
        Event:ConvertCity(tmpCity, CityRel, 0);
        Originally posted by mapfi
        • the whole player[0], g.player freaked me out and I intoduced a new global variable to carry over the CityRel. Anyway, I think their's a logical flaw in the ConvertCity handler as Pedrunn and I wrote it before if player[0] is the player argument in the Event, because then the second time the handler is called the stored value isn't the same that the city was just converted to. Does this rubbish I'm writing make sense?...
        the player[0] and local variables did not worked. I just got that message to work correct with g.player.

        Originally posted by mapfi
        • I fear that we're also up against the asynchronous event handling - just for an example what exactly happens if I call ConvertCity(tmpCity, CityRel, 0) when the global variable CityRel is changed by the following code before the event is execute?...
        We need to be careful to this do not happen. But if we do this code properly i think it will natural preventing such error.

        About the AI. Mapfi, i will post here a quick text to teach you how the strategies.txt interacts with goal.txt to work on the AI decisions on its units.

        I will take a deeper look on the code now. But i have seen you did a lot of changes.
        Last edited by Pedrunn; August 11, 2002, 22:21.
        "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


        • #49
          This create City bug really is annoyng. I cant get it to work at all
          My idea was that the city was stored and we could convert it at the beginning of the turn (Begin Turn event). But i cant get this to work either. The funny thing is that most AI cities do get their cities converted.
          At least we know that is possible to convert yourself.

          I told you i was going to tell you how the goals work but i will give you a simpler solution. Open the Goal.txt and look for the Convert CIty goal and increase the value of the PowerBonus to thousands (I set 8,000). this makes the AI crazy to convert. And in the goal Reform set it to thousands negative. This makes the AI avoid converting.
          "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


          • #50
            Instead of banging my head into a wall repeatedly for not finding a solution I thought just a little bit farther ahead.
            -We have to write an event handler for the GiveCity event, which will be mostly the same as the CaptureCity one.
            -What about having settlers found a city with the same religion of their origin? For that we'd use an array of units and one of integers to store the data. We'd have to check the CreateUnit event for the creation of a settler and then check the producing city's religion. Nothing complicated - the only thing I don't now is what unit.type is going to give me and what to compare it to.

            By the way, summer has finally returned in Switzerland. So that means less time in front of the computer and more time at the lake...

            Comment


            • #51
              Originally posted by mapfi
              Instead of banging my head into a wall repeatedly for not finding. a solution I thought just a little bit farther ahead.
              -We have to write an event handler for the GiveCity event, which will be mostly the same as the CaptureCity one.
              Originally posted by Pedrunn
              At least we know that is possible to convert yourself.
              Actually, from my testing yesterday. What i did was use the CreateCity and the BeginTurn to convert the players cities.
              it seems that is exacly the opposite of what i had said. For the AI convert itself when the city is created is not a big deal at all. It is a sucess always. Then i changed the players through the cheat mode to be one of the AI player since it was working nice with them. It did not work. The problem is the human . It looks like the human cant convert itself athoulgh the AI can.
              So this leaves to two options. Forget about converting itself. what is annoying is that we would have to forget the cross for the own player and consider that if the city has no cross it has the owner religon. For that I made this small variation of the GetCityReligion function:
              Code:
              int_f GetCityReligion(city_t tmpCity) {	
              int_t i;
              int_t tmpReligion;
              	for (i = 0; i < allCities.#; i = i + 1) {
              		if (tmpCity == allCities[i]) {
              			tmpReligion = CityReligion[i];
              		}
              		else{
              			tmpReligion = tmpCity.owner;
              		}
              	}
              	return tmpReligion;
              }
              We could try something a bit more complicated. Give the players the religion of players that arent in the game.
              I thought of modifying the colors.txt so that players with numbers more than 32 has the colors of the beggining players. 33 would be blue (color of the first player), 34 would be orange (color of the second player) and so on... When the city is created it is convert to the 32+ player religion with it same color. This is a big thing and i am not very optimistic that will work (can we convert cities by players that arent in the game? There are and Can we change the 32+ players?). What do you think?

              Originally posted by mapfi
              -What about having settlers found a city with the same religion of their origin?
              Bad news for you. the CreateUnit Event gave and still gives me a lot of headache in the city expansion code. I couldnt get it to work. IW told me that this event is bugged.
              "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


              • #52
                Originally posted by Pedrunn
                The problem is the human . It looks like the human cant convert itself athoulgh the AI can.
                He can, I'm sure. E.g. when with the used code you take one of your cities that has been converted by some other player and reform it, so the slic is triggering the convert event to your player color, then it works as it should.
                Originally posted by Pedrunn
                Can we convert cities by players that arent in the game?
                I tested this and as I state in the commentary at the beginning of the code - it doesn't work the color you'll get is the barbarian red, for all different player numbers above the actual ones present.

                If (and for now this seems to be the case) we can't get this to work, what other possibilities do we have?
                • If we keep the idea of defining religions like Budhism and so on, how can we display the religion information by city? A message screen at the beginning of the turn wouldn't be something I call convenient. So just take the religion for the nation? The it will end up to be a form of government with some additional benefits or setbacks but that doesn't really enhance the game in my opinion.
                • If we just give each player his religion things should work out fine, but looking at other threads this isn't exactly what people desire...

                Any other thoughts?

                Comment


                • #53
                  Originally posted by mapfi [list][*]If we keep the idea of defining religions like Budhism and so on, how can we display the religion information by city? A message screen at the beginning of the turn wouldn't be something I call convenient. So just take the religion for the nation? The it will end up to be a form of government with some additional benefits or setbacks but that doesn't really enhance the game in my opinion.
                  How will we define wich civs will start with the pre-defined religions? I know we can say if you are chinese you get taoism and roman Christianity but isnt this the same of each civ has its own religion? The only two differences are that religons will hve a real name and the other different civs will get same religion. If you argue well both may be a problems. For the first difference you can say: "Moonworsship, SunWorship and NatureWorship arent real religions and could branchs of one politheistic religion" or "Christianity can only start after the century 33 AD and Islamism after 622 AD. Get them to start in 4000BC is not real" And for the second having civs with same religion means you will not be able to convert some civs and is a bit unreal that differnt civs start with exacly same religion.
                  But at the end this can be discussed later since we first need to get everything to work. How to define wich civs get wich religions is the last and easuest to do.

                  Originally posted by mapfi
                  • If we just give each player his religion things should work out fine, but looking at other threads this isn't exactly what people desire...
                  I did not participate all that religon dicussion in the Best of All words thread. Still I think this is the best idea but lets leave this for later. Yet it isnt working fine. how can we get cities to convert to its own player owner? Maybe you should try to get them converted with the EndTurn and BeginTurn or other event that happens every turn. Yet I couldnt get the BeginTurn to work but you should try and I will try too (maybe i missed a variable or did something wrong )
                  "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


                  • #54
                    You know what I said in the comment of the code is just what I thought would match what people liked to see and what seemed actually doable at that time. You got my email with the different postings from all kind of threads, right? I wonder very much about Locutus upcoming design document.

                    I promise I'll try a few new ideas I had as soon as possible if not today than tomorrow...

                    Comment


                    • #55
                      I am not totally desconsidering the idea of those religions. I just prefer the way i am writting. I already thought in a way to convert the current way to this pre-defined religion way. To modify this is just a simple but relatively long modification in the 'settingreligion' event and a couple of ones in the text (specially unit.txt and gl_str.txt). As i said i rather finish the code to make this change on the way religions are going to be given. Since the only things really missing are the conversion of the city to its owner and the every turn bonus. After that we may add more stuff but it will be basically playtesting, fixing and balancing

                      I am too very excited to see locutus documentation. Speacially to add more to the religions bonus.

                      Try send the email to this address
                      pbcavalcanti@uol.com.br
                      my apolyton e-mail is broken
                      Last edited by Pedrunn; August 14, 2002, 15:27.
                      "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


                      • #56
                        Mapfi, You were right it is possible to convert itself. The problem really was the CreateCity event. I must have missed something in my last attempt but I got it working with the BeginTurn event.

                        In this new code you cant be atheist city. every turn it checks the religion of the city. if it has no religion it is converted by the city owner.
                        I added some bonus to the code. Every turn the civilization who own a religion gets a gold according to the number of cities converted to this religion that belogs to the player with different religion divided by the number of players who owns this religion.
                        I also added that players with same religion get along easier(+5 regard/ turn) and those with different regard dont (-2 regard/turn).

                        I plan to create a religion level wich say how successful the religion is spreading. From this i plan to add happiness depending on this level. I am also considering to make some buildings avaiable depending on this level. We could do the same with units, advances and wonders. But i will aim at buildings mostly (maybe wonders too)

                        I read your religion ideas compiling. But the more i read it more i did not wanted to use real-life-religion. About 90% of the dicussion was to choose wich religion should be included yet they did not get to a point. And in my point of view those who wrote those ideas did not considered what i think it is most fun. That is to spread your religion through out the world.
                        From the other 10% of the dicussion some idea are implementable (as you can see I included some of them in my plans for the current code). If anyone wants to have it (I think Locutus will) i can change the code to fit the real-life-religions ideas but needs changes in the text files too. For this idea we can add unique advances, units and wonders to the game for each religion. Although buildings can be done too there is a limit that may make impossible to most of the mods. We could make unique clerics too but we dont have enough graphics for this. And they probably would have same abilities.

                        For now here is the code
                        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


                        • #57
                          Sorry for not being around but currently the tournament game is taking up all my free time and as I said summer's back for the last days this year so you'll have to wait till next week...

                          Comment


                          • #58
                            I have bee busy fixing some bugs in the city expasion so the work in the religion code was already stoped. yet i already have a newer version of the code other than the one attached but the debug slic pointed too many errors so i still have a lot of dbuging to do.
                            "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


                            • #59
                              Ok, here's Pedrunn's code, debugged and just a few minor changes - took me long enough as it is

                              Good news: no slic errors

                              Bad news:
                              • the religionlevel has a logical flaw in the code that I can't find. Even when I haven't founded a city yet it rises over 0% when the other players do and after a few turns it doesn't change at all anymore
                              • the logregardevent: Haven't found that one in any documentation - it gives me wrong argument type errors and freezes my computer completely, even Microsofts three button wonder won't work - won't be too difficult to write a code doing the same though if we can't get it to work
                              • the KillPlayer handler won't work yet, no new signs appear

                              Things worth mentioning:
                              • the PlayerCityCount seems to need an argument that was assigned by a real player variable (like tmpPlayer = player[0]), a regular int won't work... so I worked around that when I was able to
                              • writing into player[1,2 or 5 or whatever] always gives slic errors but messages can also display global variables. problem is, we can't have the name of the religion's civ like that, just the player number
                              • found out that we have to test the validity of a city we want to read out of the allCities array before we assign it to a tmp city variable - otherwise slic errors
                              • I disabled all ConvertCity Events other than the ones in the BeginTurn and ConvertCity handler with the justification that under a reformation it takes half a turn to reform everybody... Just makes the code more foolproof when it has less of those events called during the game
                              • the game won't stop when an ai converts my cities - the messagebox appears when it's my turn - not nice but not too grave...


                              The whole code is packed to be an addition to SAP now. Just unzip in your CtP2 folder and you'll get a new option in modswapper - makes it easier to test and in the units.txt I set all the interfering values to 0. Why SAP - no other reason than I know it's behaviour better than the original game's.

                              I might still have another look at it tomorrow but any immediate help would be appreciated.
                              Attached Files

                              Comment


                              • #60
                                Originally posted by mapfi
                                the religionlevel has a logical flaw in the code that I can't find. Even when I haven't founded a city yet it rises over 0% when the other players do and after a few turns it doesn't change at all anymore
                                And you dont have any clue about a fix? Or a variation of the concept? I will try to come up with a solution .

                                Originally posted by mapfi
                                the logregardevent: Haven't found that one in any documentation - it gives me wrong argument type errors and freezes my computer completely, even Microsofts three button wonder won't work - won't be too difficult to write a code doing the same though if we can't get it to work
                                It works i am sure. probably something is wrong with my arguments (my guess is that i should have use 0 in the event type argument instead of 4). here are the info i have about it (from Peter Triggs documentation):
                                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.
                                Originally posted by mapfi [*]the KillPlayer handler won't work yet, no new signs appear[/list]
                                That is really bad new. but i am sure we can make a variation of it using CaptureCity checking how many cities the player has. But i want to be sure that a dead player really converts cities to barbs first.

                                Originally posted by mapfi
                                the PlayerCityCount seems to need an argument that was assigned by a real player variable (like tmpPlayer = player[0]), a regular int won't work... so I worked around that when I was able to
                                We can still use the function Cities(int_t) or even the built in variable player[0].cities. No big deal.
                                Originally posted by mapfi
                                writing into player[1,2 or 5 or whatever] always gives slic errors but messages can also display global variables. problem is, we can't have the name of the religion's civ like that, just the player number
                                it works if we use player[1,2 or 5 or whatever] in the code that triggers the message (not in the code inside the message).
                                And use the player[1,2 or 5 or whatever].civ_name_singular in the message ID.
                                Originally posted by mapfi
                                found out that we have to test the validity of a city we want to read out of the allCities array before we assign it to a tmp city variable - otherwise slic errors
                                We should have done this before to the storage of the city safer anyway.

                                Originally posted by mapfi
                                I disabled all ConvertCity Events other than the ones in the BeginTurn and ConvertCity handler with the justification that under a reformation it takes half a turn to reform everybody... Just makes the code more foolproof when it has less of those events called during the game
                                Good Point. I think this really is for the best.
                                Originally posted by mapfi
                                the game won't stop when an ai converts my cities - the Anywaymessagebox appears when it's my turn - not nice but not too grave...
                                It should stop since it is an alertbox and not a messagebox. I will check this up when i have time.

                                Originally posted by mapfi
                                The whole code is packed to be an addition to SAP now. Just unzip in your CtP2 folder and you'll get a new option in modswapper - makes it easier to test and in the units.txt I set all the interfering values to 0. Why SAP - no other reason than I know it's behaviour better than the original game's.
                                Ok. Not a problem for me.

                                Originally posted by mapfi
                                I might still have another look at it tomorrow but any immediate help would be appreciated.
                                I will look into it too. Tomorrow we talk about a improvements them.

                                PS: The CreateUnit event does work. we can make that idea of settlers settle cities that have the same religion of the city they were built.
                                Last edited by Pedrunn; August 29, 2002, 00:00.
                                "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