Thread Tools
Old August 8, 2002, 14:19   #31
Hermann the Lombard
Prince
 
Local Time: 01:33
Local Date: November 1, 2010
Join Date: Jun 1999
Location: Hoboken, NJ, USA
Posts: 894
Quote:
Originally posted by mapfi
Not a bad idea if we just can't get that stupid city state...
And to think I'm usually trying to get *out* of City State to a higher form of government...

Quote:
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).
I was thinking about that when (in Succession Game V) we converted the city of Mecca. Just something about that...
__________________
"...your Caravel has killed a Spanish Man-o-War."
Hermann the Lombard is offline  
Old August 8, 2002, 18:19   #32
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by mapfi

Yep, if you look in that little piece of code I wrote you'll find I solved that by using a global variable to count the called events. There might be something better, though.
But i gave a fast look in the code. and i thought i did exacly what you did (unless the captureCity event). But i will do a deeper look into it, now.

Quote:
Originally posted by mapfi
That's my aim too,
I have noticed the minute i saw the LeaderReligion[]. Although i have seen those religions listed above.

Quote:
Originally posted by mapfi
Quite sure, tested it, but try it out in the game yourself.
I will. sorry, but I still dont believe. . Anyone else has acould share us this information?

I forgot to attach the text (Oops)
Attached Files:
File Type: txt religion_str.txt (1.3 KB, 6 views)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 9, 2002 at 00:06.
Pedrunn is offline  
Old August 9, 2002, 00:25   #33
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Mapfi. I have tested and debugged the slic.

The loop is gone thanks to you. I would had stopped my work here if it werent for you.

Everything is working just the way i wanted . Except for two things.
1) the UnconvertCity event. It doenst work. In my code i was suposed to get a message what it doenst happen. I think it iseither was one of my mistake (which i dont think so since i gave it a look and did not found anything) or this event has bug in it (I am kind of paranoid with this since my pillaging problem in my city expansion code).

2) The message wich asks if you want to convert all cities appear many times in the game since we used this event as function several time in the game. I suggest we change the message trigger event to another convert event. there is one event called ConvertCityOrder and, as you will see in the code i attached here, i used ConvertCityUnit, but it is 1:30 AM here. I didnt test this modification yet but i do need some sleep
I hope you can give a look at it today as you said you could.

Attached Files:
File Type: slc as_pedrunn.slc (13.0 KB, 6 views)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old August 9, 2002, 03:18   #34
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
Isn't there a saying that goes like 'Never make promises you can't keep' ?... Looks like I won't have as much time today as I thought, since we didn't get everything we wanted done yesterday (yes, I'm a student, but I work for an insurance company right now).
But let's have a look at the code:
Code:
ConvertorCiv[ReligiousCount] = city[0];		// Store the converted city
ConvertedCity[ReligiousCount] = player[0];	// and the player who converted
That's never going to work since you're story cities in the int array and vice versa - just switch the two
Code:
return tmpPlayer;	// if GetCityConvertor = 0, means city is not converted
this comment is no longer true, since you're storing the religion when the city is created now, so it will never be 0, what this means for the code I haven't analyzed, though
Code:
void_f AddCityToReligionCount (city_t tmpCity, int_t tmpConvertor) {
this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place

The handling of the ConvertCity event looks fine. If you used it for the 'DoYouWantToConvert' trigger it's clear that the message boxes will appear over and over again, since you're in a loop there too. The problem with the ConvertCityUnit event I see is that I'm not really sure if it determines already the conversion in the game or if there's still a probability check with some constant. Does the Kill() in the code just stop you're event handler or also the event that triggered it? I don't know, really. But if not, then you can't habe the 'DoYouWantToConvert' be 'pre'.

Now for the Reformation, same reasoning with kill() and 'pre' here.

So much for now, work here I come...
mapfi is offline  
Old August 9, 2002, 08:04   #35
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by mapfi


Code:
ConvertorCiv[ReligiousCount] = city[0];		// Store the converted city
ConvertedCity[ReligiousCount] = player[0];	// and the player who converted
That's never going to work since you're story cities in the int array and vice versa - just switch the two
Oops
Quote:
Originally posted by mapfi
Code:
void_f AddCityToReligionCount (city_t tmpCity, int_t tmpConvertor) {
this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place
There ar two reasons i added this funtion. First because it appears many times in the game. Second to make easier to you to
change for that .# if you want. Other than that i am aware that a three lines funtion is a bit unecessary.

Quote:
Originally posted by mapfi
Code:
return tmpPlayer;	// if GetCityConvertor = 0, means city is not converted
this comment is no longer true, since you're storing the religion when the city is created now, so it will never be 0, what this means for the code I haven't analyzed, though
This comment should be erased. As you may see i even took the GetCityConvertor == 0 off the every turn gold and the sell indulgences. Yet you were right about the cities loosing their converted cities when enacting new govs . This means we have to come up with an idea to fix this bad feature. I suggest we make the begin turn event convert all cities in the count again. Or Unless there is a government enacted event wich i think i read somewhere that there isnt. Maybe we will probably
have to edit the create city event (this remind me that i didnt tested this event. And the getCityConvertor == 0 may come back.

Quote:
Originally posted by mapfi
The handling of the ConvertCity event looks fine. If you used it for the 'DoYouWantToConvert' trigger it's clear that the message boxes will appear over and over again, since you're in a loop there too.
I noticed that. and only solved by placing the kill() before the code. Bt i will wait to see how you'll fix this.
This loop thing is much more common than i imagined (As i said before i dont have experience with programming. All I know comes from the Locutus/IW Slic learning texts.
I am getting a bit paranoid with this loop thing. thinking that the pillaging bug may be a loop (but it is such simple code). I think i will send it those to you to.

Quote:
Originally posted by mapfi
The problem with the ConvertCityUnit event I see is that I'm not really sure if it determines already the conversion in the game or if there's still a probability check with some constant. Does the Kill() in the code just stop you're event handler or also the event that triggered it? I don't know, really. But if not, then you can't habe the 'DoYouWantToConvert' be 'pre'.
Now for the Reformation, same reasoning with kill() and 'pre' here.
As far as i know the kill() doesn stop anything. It just closes the messagebox.

Quote:
Originally posted by mapfi
So much for now, work here I come...
Good Luck
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 9, 2002 at 09:32.
Pedrunn is offline  
Old August 9, 2002, 09:05   #36
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
As for the AddCityToReligionCount, it just makes the array bigger by adding cities even they're already in it. That's what bothered me. Furthermore you rely on the GetCityConvertor function to test the whole array until the end even if it already hits the city, so you'll get the exact value. And it might just be, that we can change that. I don't know if slic has a break order though. Anybody?
Code:
tmpplayer = player[0];
religion = PlayerReligion[tmpplayer];
AddCityToReligionCount(city[0], PlayerReligion[player[0]]);
this is in the ConvertCity handler, you can put religion as argument of the function to keep it simple...

Another thing I spotted, in the UnconvertCity handler you assign player[0] = Religion for no apparent reason. ?

Quoting myself:
Quote:
Does the Kill() in the code just stop you're event handler or also the event that triggered it?
That's something I need to know before I start on this again. Anybody?

Hey, it seems like I'm always bickering about your code. It's good and a lot of work, though and so gets us really farther ahead.
mapfi is offline  
Old August 9, 2002, 09:37   #37
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
This line wrongly went inside on one of your quotes in my last post. I fix it. But i am afraid you wont read it again.

"As far as i know the kill() doesn stop anything. It just closes the messagebox."

the player[0] variable is for the messages.

I can only say that i wish i had someone "bickering" every code i make like you do with this one.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 9, 2002 at 09:52.
Pedrunn is offline  
Old August 9, 2002, 10:04   #38
J Bytheway
Call to Power PBEMCall to Power II Democracy GameCTP2 Source Code Project
Emperor
 
J Bytheway's Avatar
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: England
Posts: 3,826
Quote:
Originally posted by mapfi
I don't know if slic has a break order though. Anybody?
I don't think so, but if you put the loop in a function of its own then you can use return to get out of the function and thus break the loop.

Quote:
Quoting myself:
That's something I need to know before I start on this again. Anybody?
AFAIK the kill() will only stop the message box.

IIRC if you want to cancel the event you must return STOP;

Last edited by J Bytheway; August 9, 2002 at 15:48.
J Bytheway is offline  
Old August 9, 2002, 10:32   #39
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
Well, your UncovertCity handler was pre, so the result is, that whatever you program with your messageboxes it will still unconvert the city at the end, so that's why your code doesn't work in that part. Either you change it to post or use that stop order if it works.

player[0], ah yes, in the text part, forgot that...

note: don't get too excited seeing that your code got downloaded twice , that's me, since I got to have it at work and on my laptop.

well, i'll see if I can find the time to work on something tonight or tomorrow...

Last edited by mapfi; August 9, 2002 at 11:53.
mapfi is offline  
Old August 9, 2002, 17:04   #40
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by mapfi
note: don't get too excited seeing that your code got downloaded twice , that's me, since I got to have it at work and on my laptop.

Quote:
Originally posted by mapfi
Well, your UncovertCity handler was pre, so the result is, that whatever you program with your messageboxes it will still unconvert the city at the end, so that's why your code doesn't work in that part. Either you change it to post or use that stop order if it works.
...
well, i'll see if I can find the time to work on something tonight or tomorrow...
I will wait to see how it is going to look like before continuing the work in it. Keep me informed of the changes.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old August 10, 2002, 12:19   #41
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
As I said I wanted to give bonuses to the player depending on the religion. What kind of methods do we have to do just that, preferably for each city?
I tried to write into the city variable properties but that seems to be read-only.
I can only think of giving/taking gold of/from the player and city specific to add happiness by the HappinessTimer event. Anything else that you guys know of?

John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.

edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...

Last edited by mapfi; August 10, 2002 at 12:25.
mapfi is offline  
Old August 10, 2002, 13:36   #42
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by mapfi
As I said I wanted to give bonuses to the player depending on the religion. What kind of methods do we have to do just that, preferably for each city?

I tried to write into the city variable properties but that seems to be read-only.
I can only think of giving/taking gold of/from the player and city specific to add happiness by the HappinessTimer event. Anything else that you guys know of?
I posted a request to locutus the best ideas discussed in the best of all worlds thread. They've dicussed a lot about religion and culture but i was too lazy to follow the dicussion and its long posts .

Quote:
Originally posted by mapfi
John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.
Abort() is used only to prevent messages to be sent. It does not affect the code.
(Like text(string), title(string), show(), kill(), button and others it can only be used in message codes.

Quote:
Originally posted by mapfi
edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...
Most of the post i send i have to edit more than two times. And you still find lots of mistakes in them.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old August 10, 2002, 14:49   #43
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 07:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by mapfi
John: of course, return breaks it, why didn't I think of that... thanks. I couldn't find stop in the documentation but abort(). I'll just try.
You could visit Locutus' uni home page. There you can find some Slic1 documentation and the edit plus syntax files. The Slic1 documentation contains some stuff about message boxes that isn't be foound in the documentation found here on Apolyton.

Quote:
Originally posted by mapfi
edit: don't you just hate it when you find dozens of spelling mistakes the moment you posted it...
Fortunatley I find my spelling, grammer and missing words mistakes some months later usually. So I am not too bothered with them. Of course for a readme or strings in a mod it is more important.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old August 10, 2002, 16:12   #44
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 05:33
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Just noticed all this. This is a great idea! I've glanced over the code Pedrunn posted above and here's a few comments;

1) Re the AddCityToReligionCount function:

Quote:
this function is really not necessary, since you've got every city already in the array by default (when it's created), so you just need to store the new religion value in the appropriate place
I agree with Mapfli; I think this is what you want:

Code:
  
void_f ChangeCityReligion (city_t theCity, int_t tmpConvertor) {

int_t i;
city_t tmpCity;

     tmpCity=theCity;
     for(i = 0; i < ReligiousCount; i = i + 1) {
	    if(tmpCity == ConvertedCity[i]) {
              ConvertorCiv[i] = PlayerReligion[tmpConvertor];
	    }
    }
}
Then you can change the following handler to:

Code:
HandleEvent(ConvertCity) 'ConvertCityAccordingToReligion' post {// When a city was converted
int_t i;
int_t tmpplayer;
int_t religion;
	if(CityIsValid(city[0])) {// maybe not necessary, but safe
		
		ChangeCityReligion(city[0],player[0]);							
	}
}
I haven't looked at the other places where you used AddCityToReligionCount, but doing it this way would mean that you'd have to make changes there.

Notice in the above function that I've got two city type variables where you'd think one would be sufficient. This is because of a bug in SLIC:

Quote:
Important note! As this documenation is being prepared, the first patch for CTP2 is about to be released. Unfortunately a bug with functions was discovered too late to fix. Specifically, in some cases, using members of unit, army, city,and location variables that are function parameters may not always work as expected. There is, however, a workaround. Copy the function parameter to a local variable and use that variable instead. Example:

// This version may fail sometimes!
int_f DoesAHumanOwnThisUnit(unit_t theUnit)
{
if(IsHumanPlayer(theUnit.owner)) {
return 1;
}
return 0;
}

// This version should always work
int_f DoesAHumanOwnThisUnit(unit_t theUnit)
{
unit_t copiedUnit;
copiedUnit = theUnit;
if(IsHumanPlayer(copiedUnit.owner)) {
return 1;
}
return 0;
}

The author apologizes for this and promises that if there is another patch it will be fixed. But the above workaround should always work.

2) The 'PlayerHasConverted' message at line 131 is sent to AllButOne via an Alertbox. I don't think you can do this. For one thing AlertBoxes are modal, which means that they must contain at least one button which must be pressed before the game can continue. Your's doesn't have a button. Also, I can't see how you can send an Alertbox to an AI civ: they can't press buttons.

So, I guess you just want to use a messagebox.

3) Do you have DebugSlic=Yes? You must have it turned on while you're debugging your code, otherwise you're bound to end up with lots of errors that you don't know about.

When the next version comes out I'll try to have a more detailed look at it.
Peter Triggs is offline  
Old August 10, 2002, 18:43   #45
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848

I'm pissed off. I've been working on this thing for hours now and it just makes fun of me. Furthermore I kept editing the code and what it looks now to the worse and I didn't save all the different versions. So I'm fed up and need to go to bed. Just some stuff that came up:
  • 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
  • The part Peter posted about the function in function or so is the one I mentioned like in the second or third post. well, it means we gotta rewrite the thing with lots of tmp variables
  • i'm not that sure about convertcityunit event, like you said - it doesn't seem to work. we have to find another solution here - that needs a lot of thinking with logic so I'll do that tomorrow when I've slept enough

That was about Pedrunn's code. Now the other problems I ran into:
  • 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
  • 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...

So, more tomorrow,
mapfi is offline  
Old August 10, 2002, 18:58   #46
Martin Gühmann
staff
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Super Moderator
 
Martin Gühmann's Avatar
 
Local Time: 07:33
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
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.

Quote:
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.

Quote:
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.

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

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old August 11, 2002, 15:48   #47
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
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 shitty 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:
File Type: zip religion.zip (4.7 KB, 7 views)
mapfi is offline  
Old August 11, 2002, 22:13   #48
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
1)Peter, thanks to clarify some thing up. I did not know about that info.
Quote:
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
Quote:
Originally posted by Peter Triggs
Do you have DebugSlic=Yes?
3)No. But I will start turn it on
Quote:
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

Quote:
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.

Quote:
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);
Quote:
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.

Quote:
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.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 11, 2002 at 22:21.
Pedrunn is offline  
Old August 13, 2002, 06:49   #49
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old August 14, 2002, 03:23   #50
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
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...
mapfi is offline  
Old August 14, 2002, 06:42   #51
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
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.
Quote:
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?

Quote:
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
Pedrunn is offline  
Old August 14, 2002, 06:59   #52
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
Quote:
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.
Quote:
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?
mapfi is offline  
Old August 14, 2002, 08:10   #53
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
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.

Quote:
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
Pedrunn is offline  
Old August 14, 2002, 12:18   #54
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
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...
mapfi is offline  
Old August 14, 2002, 15:05   #55
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 14, 2002 at 15:27.
Pedrunn is offline  
Old August 15, 2002, 13:04   #56
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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:
File Type: slc religion.slc (9.7 KB, 3 views)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old August 19, 2002, 07:00   #57
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
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...
mapfi is offline  
Old August 19, 2002, 07:24   #58
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
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
Pedrunn is offline  
Old August 28, 2002, 15:19   #59
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 06:33
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
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:
File Type: zip religion.zip (34.6 KB, 2 views)
mapfi is offline  
Old August 28, 2002, 23:52   #60
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 02:33
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
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 .

Quote:
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):
Quote:
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.
Quote:
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.

Quote:
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.
Quote:
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.
Quote:
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.

Quote:
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.
Quote:
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.

Quote:
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.

Quote:
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.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; August 29, 2002 at 00:00.
Pedrunn is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 01:33.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team