Thread Tools
Old June 4, 2002, 09:20   #1
azalae
Chieftain
 
Local Time: 11:56
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 42
D'oh questions
This is my first time writing SLIC so bear with me and my silly questions .

Q1
How to add building(s) to a newly founded city? I thought Dale's WAW mod hase this feature, so I browse through the files but so far no luck. Probably I miss it somewhere.

Anyway, I tried to write my own SLIC (no pain no gain), and it didn't work (the pain).

Code:
HandleEvent(CreateCity) 'The_Doh_Function' post {
int_t		thePlayer;
location_t	theLocation;
city_t		theCity;

	thePlayer = player[0];		// <= do I really need this?
	theLocation = location[0];	//	and this?
	theCity = city[0];

	Event:CreateBuilding(theCity, BuildingDB(IMPROVE_SHRINE));
}
Q2
The GrantAdvance() event has 3 arguments: GrantAdvance(player, int1, int2), right?. Which int argument is the advance? I wrote "GrantAdvance(player,AdvanceDB(SomeAdvance),0)" and it worked. Can I always leave the third argument or does it do anything?
azalae is offline  
Old June 4, 2002, 10:09   #2
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: 03:56
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
A1: Take a look into the unit.txt and search the for the the entry of the urban planer. You will notice that this unit has a list of SettleBuilding entries. So whenever an urban planer builds a city (also in the original game) than the specified buildings are added to the city. So actual no slic is here required. But one thing you have to consider is that if you get a city from a ruin than you won't get the extra buildings. For the original game it doesn't matter, because all ruins should be opened in the modern age already. BTW also the starting size of this city is dertermined in this unit entry.

A2: Actual I don't know, but I guess the first one is the advance and the second one might be the reason of giving the advance. You have to note there is an event called GrantAdvance and a function called GrantAdvance. From the official Activion slic documentation the event has tree arguments and the function has two. BTW did you really wrote:

"GrantAdvance(player,AdvanceDB(SomeAdvance),0)"

Or rather:

"Event:GrantAdvance(player,AdvanceDB(SomeAdvance),0 )"

If you used the first from then you called the function, if you used the second form then the event. It is interesting if you used the first form, because that would mean the GrandAdvance function has an undocumented optional third argument.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old June 4, 2002, 10:14   #3
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 22:56
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Well will not give you Slic tips since i am just too green too.

But as a modder the best is to add this line in the settler data in the unit.txt.
Code:
   SettleBuilding IMPROVE_SHRINE
__________________
"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 June 4, 2002, 10:22   #4
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 22:56
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
You beat me for some minutes.
But now is my time to ak
How many reasons there are?
What they are?
And their respective numbers?
__________________
"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 June 4, 2002, 12:56   #5
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: 03:56
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by Pedrunn
You beat me for some minutes.
But now is my time to ak
How many reasons there are?
What they are?
And their respective numbers?
Hey stop I just guessed.

What are the possible reasons or better conditions to give a civ an advance.

The first one is the common one: You got enough science points to pay the advance with it so you gain it.

Another possibility to gain an advance is to enter a goody hut.

Next one is stealing it with a spy.

Then you can gain an advance during diplomacy negotiations.

And you can steal an advance if you conquered an city. (I think this is broken in CTP2 )

So that are five conditions to give an advance to an civ. Of course there is also the possebility to give it vea slic.

I can't you tell anything about the numbers, Presuming the third argument contains something usefull. In most cases these last arguments, especial these undocumented ones, do nothing. And if the third argument would be a reason to give the advance than it would doesn't matter if you use any number, because in the end it doesn't matter how the civ gained the advance, it only matters that the civ gained the advance.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old June 4, 2002, 13:42   #6
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 22:56
Local Date: October 31, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by Martin Gühmann
Hey stop I just guessed.
(I hope )

There is also a reason in AddHappyTime and other slic functions. I thought there could exist some sort of known general list of reasons to use in slic.
__________________
"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 June 4, 2002, 14:59   #7
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
A1. You don't need the lines you questioned

Quote:
And you can steal an advance if you conquered an city.
It is possible to SLIC this, and I was considering it for a while. But because HasAdvance(...) has to use the advance name (as in ID_ADVANCE_...) then it makes it hugely long code to write, and my patience is not that generous...
__________________
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
Immortal Wombat is offline  
Old June 4, 2002, 22:38   #8
azalae
Chieftain
 
Local Time: 11:56
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 42
aahhhh
So, that's the way Thanks a lot guys.

Martin Gühmann,
This is the way wrote it: Event:GrantAdvance(thePlayer, AdvanceDB(ADVANCE_STONE_WORKING), 0);
I'll try the non-event function now, just to see what's the difference.

Hmm gain an advance when conquering a city. Interesting. Can't we just use integers instead of those constant strings? I mean AdvanceDB is just to convert strings (ADVANCE_SOMETHING) into its integer index (some number), isn't it. I thought it's just to make it easier to read (and write) the SLIC. But we don't really need to know the exact advance, we just want a random advance the enemy has that we don't.

First Draft:
Code:
HandleEvent(CaptureCity) post {
int_t	currentPlayer;
int_t	losingPlayer;
int_t	theAdv;
	currentPlayer = g.player;
	losingPlayer = player[0];	// <= Q: refer to which player?

	for (theAdv = 0; theAdv < advance.#; theAdvance = theAdvance + 1) {
		if ((HasAdvance(losingPlayer,theAdv) && (!HasAdvance(currentPlayer,theAdv))) {
			GrantAdvance(currentPlayer,theAdv);
			// Next to do: MSG>"Your scientists managed to salvaged some interesting
			//	research data after the occupation of the city, advance[theAdv].name".
		}
	}
}
If we want a random one, we can always create a list of those qualifying advances (ones they have that we don't) and randomly select one from it.

Anyway, I haven't test the code, so don't sue me .

Q: Which player does player[0] refer to? The previous owner of the city OR the conquerer?

Edit: If player[0] refers to current player too, then can we try handling AttackCity event (or some other relevant events) to extract the previous owner?

Last edited by azalae; June 4, 2002 at 22:46.
azalae is offline  
Old June 5, 2002, 16:44   #9
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
theAdv cannot be an integer, it doesn't work, otherwise it would be that simple. theAdv does have to be a string in the HasAdvance function.
__________________
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
Immortal Wombat is offline  
Old June 7, 2002, 02:59   #10
azalae
Chieftain
 
Local Time: 11:56
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 42
D'oh
azalae is offline  
Old June 7, 2002, 05:22   #11
J Bytheway
Call to Power PBEMCall to Power II Democracy GameCTP2 Source Code Project
Emperor
 
J Bytheway's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Jul 2001
Location: England
Posts: 3,826
Quote:
Originally posted by Immortal Wombat
theAdv does have to be a string in the HasAdvance function.
But that's only in the HasAdvance function, right? Not in any of the places where you use AdvanceDB.
J Bytheway is offline  
Old June 7, 2002, 13:29   #12
Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
 
Local Time: 01:56
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
Quote:
Q: Which player does player[0] refer to? The previous owner of the city OR the conquerer?
player[0] is the player who captures the city. If you run the handler pre- before the in-game code that captures the city - you can get the player who's about to lose the city with city[0].owner. In a post CaptureCity handler, player[0] is city[0].owner.
Peter Triggs is offline  
Old June 7, 2002, 19:05   #13
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 02:56
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Only in HasAdvance is it neccessary, correct. It might not even work in the other functions, which need the DB index as an integer
__________________
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
Immortal Wombat 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 21:56.


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