Thread Tools
Old September 13, 2002, 07:42   #1
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
I've got a few q's about modding
1. Is it possible to change the tile improvement thing, to be cheaper when upgrading an improvement? I mean, when having a mine, but you want to upgrade the mine to an advanced mine instead. But because it's upgrading, the price should be slightly lower than the original price (Like having a 25% price cut...) Of course, if the tile is empty (Or has something else, than a mine), the price should be normal...

2. Is it possible to change how slow/fast the time goes by?
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 08:10   #2
Dale
Emperor
 
Dale's Avatar
 
Local Time: 17:54
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
2. Change all the TIME_SCALE values in DiffDB.txt for each difficulty level.
Dale is offline  
Old September 13, 2002, 08:25   #3
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Thx
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 08:29   #4
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
DP. and if you copied the code that was in here try the next post 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; September 13, 2002 at 08:37.
Pedrunn is offline  
Old September 13, 2002, 08:31   #5
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
1) You can add PW to the player who isto simulate the bonus. Here is a code that adds 50 PW to the player if his is building advanced mine over mine and 25 if building a advanced farm over a farm. the temolate for new imrprovent is written there ( // means comment and do not make part of the code
Code:
HandleEvent(CreateImprovement) 'PWBonunWhenBuildingOneSameType' pre {
int_t i;
int_t InitialPw
int_t FinalPW;
int_t OLD_TILEIMP[];
int_t NEW_TILEIMP[];
int_t PW_BONUS[];

OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINE); 
NEW_TILEIMP[0] =  TerrainImprovementDB(TILEIMP_ADVANCED_MINE);
PW_BONUS[0] = 50;

OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_FARM); 
NEW_TILEIMP[1] =  TerrainImprovementDB(TILEIMP_ADVANCED_FARM);
PW_BONUS[1] = 30;

// TEMPLATE obs: * need to be filled

//OLD_TILEIMP[*] = TerrainImprovementDB(TILEIMP_*); 
//NEW_TILEIMP[*] =  TerrainImprovementDB(TILEIMP_*);
//PW_BONUS[*] = *;

	for(i = 0; i < OLD_TILEIMP.#; i = i + 1) {			// Search for all numbers
		if(TileHasImprovement(location[0], OLD_TILEIMP[i]) {	// if tile has tile imp in the data 
			if(value[0] == NEW_TILEIMP[i]) {		// and new improvement has the same number	
				InitialPw = player[0].publicworkslevel;	// Search for previous amout of PW
				FinalPW = InitialPw + PW_BONUS[i];		// Give a 50 PW bonus
				setPW(player[0], FinalPW);		// and set the new player's PW amount
			}
		}
	}
}
Obs: UNTESTED, UNTRIED and MAY GIVE SLIC SYNTAX ERRORS.
any question i am here.

Copy this code in any included .slc of the folder \default\gamedata\ I recommend the script.slc wich is included for sure for the original game (The included files are in the end of this file and you can include new one you created by writting the line:
Code:
#include "AnyFile.slc"
This means the AnyFile.slc is included. if this file doesnt exist you get slic errors.

2) The building time is in the TI data in the tileimp.txt just change for the improvement you want the value of its entry:
Code:
ProdutionTime
and there you go

PS: did you fixed the errors you were getting from your last modding attept?
__________________
"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 September 13, 2002, 10:07   #6
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Thx for the help... and yes, I got the last error fixed (I haven't finished my first game yet, so I can't be sure, but I haven't had any problem yet...)

I now get an slic error when starting the game...
__________________
This space is empty... or is it?

Last edited by Adagio; September 13, 2002 at 10:18.
Adagio is offline  
Old September 13, 2002, 10:15   #7
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
But you still get errors when loading CTP2?
__________________
"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 September 13, 2002, 10:26   #8
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
I only get the new slic error... The other error got fixed

Quote:
OLD_TILEIMP[0]
NEW_TILEIMP[0]
PW_BONUS[0]

OLD_TILEIMP[1]
NEW_TILEIMP[1]
What does the number in [] mean? this might be what causes the error...
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 11:48   #9
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Hmmm... how come it says, Pedrunn was the last one to reply... even after tons of refreshing of the browser..?
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 13:34   #10
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 08:54
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
Those are arrays Pedrunn uses - when you define a variabel like the following int_t number[]; you'll have a dynamically growing array. Now if you want to write an integer into that array you have to say which index it shall have. They start at 0.
If you want to get into SLICing start reading Locutus' and IW's documentations, mavbe even the activision one...
mapfi is offline  
Old September 13, 2002, 13:46   #11
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Ok, let's see if I understud it. If I make more of those in Pedrunns example, I have to do like this: (?)

Quote:
OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINE);
NEW_TILEIMP[0] = TerrainImprovementDB(TILEIMP_ADVANCED_MINE);
PW_BONUS[0] = 50;

OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_FARM);
NEW_TILEIMP[1] = TerrainImprovementDB(TILEIMP_ADVANCED_FARM);
PW_BONUS[1] = 30;

OLD_TILEIMP[2] = TerrainImprovementDB(TILEIMP_FARM);
NEW_TILEIMP[2] = TerrainImprovementDB(TILEIMP_Hydronic_FARM);
PW_BONUS[2] = 30;
Ok, I didn't check if I spelled right... But is it something like that?
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 13:49   #12
mapfi
Call to Power II Democracy GameCall to Power II Multiplayer
Prince
 
Local Time: 08:54
Local Date: November 1, 2010
Join Date: Jul 2002
Location: San Francisco, CA
Posts: 848
That's what you want, yes.
mapfi is offline  
Old September 13, 2002, 13:54   #13
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Ok, thx for the help
__________________
This space is empty... or is it?
Adagio is offline  
Old September 13, 2002, 14:21   #14
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
DP
__________________
"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; September 13, 2002 at 14:28.
Pedrunn is offline  
Old September 13, 2002, 14:22   #15
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
There are actually three errors:
1) A missing ';' after
Code:
int_t InitialPw
2) A missing ')' ater the line (you can see that i open two '(' but i dont get one of them closed
Code:
if(TileHasImprovement(location[0], OLD_TILEIMP[i]) {
3) The names of the improvements. In the tileimp.txt you will find that they are in plural not in singular form as i wrote.


The number is just something to relate the OLD_TILEIMP[] with the NEW_TILEIMP[] and the PW_BONUS[]. Since the code works like that. (A slic lesson here).
Try this code it is esier to understand and has new improvements:
Code:
HandleEvent(CreateImprovement) 'PWBonunWhenBuildingOneSameType' pre {
int_t i;
int_t InitialPw;
int_t FinalPW;
int_t OLD_TILEIMP[];
int_t NEW_TILEIMP[];
int_t PW_BONUS[];

OLD_TILEIMP[0] = TerrainImprovementDB(TILEIMP_MINES); 
NEW_TILEIMP[0] =  TerrainImprovementDB(TILEIMP_ADVANCED_MINES);
PW_BONUS[0] = 30;

OLD_TILEIMP[1] = TerrainImprovementDB(TILEIMP_ADVANCED_MINES); 
NEW_TILEIMP[1] =  TerrainImprovementDB(TILEIMP_MEGA_MINES);
PW_BONUS[1] = 50;

OLD_TILEIMP[2] = TerrainImprovementDB(TILEIMP_FARMS); 
NEW_TILEIMP[2] =  TerrainImprovementDB(TILEIMP_ADVANCED_FARMS);
PW_BONUS[2] = 40;

OLD_TILEIMP[3] = TerrainImprovementDB(TILEIMP_ADVANCED_FARMS); 
NEW_TILEIMP[3] =  TerrainImprovementDB(TILEIMP_MEGA_FARMS);
PW_BONUS[3] = 60;

// TEMPLATE obs: * need to be filled

//OLD_TILEIMP[*] = TerrainImprovementDB(TILEIMP_*); 
//NEW_TILEIMP[*] =  TerrainImprovementDB(TILEIMP_*);
//PW_BONUS[*] = *;

	i = 0;								// 'i' is zero for the last loop
	while(i < OLD_TILEIMP.#) {					// if 'i' is smaller then the biggest number inside OLD_TILEIMP[]
		if(TileHasImprovement(location[0], OLD_TILEIMP[i])) {	// if tile has tile imp equal to OLD_TILEIMP[i] 
			if(value[0] == NEW_TILEIMP[i]) {		// if new improvement has the same number	
				InitialPw = player[0].publicworkslevel;	// Search for previous amout of PW
				FinalPW = InitialPw + PW_BONUS[i];		// Give a 50 PW bonus
				setPW(player[0], FinalPW);		// and set the new player's PW amount
			}
		}
		i = i + 1;
	}
}
__________________
"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; September 14, 2002 at 08:21.
Pedrunn is offline  
Old September 13, 2002, 18:25   #16
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: 09:54
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by ADG
Ok, I didn't check if I spelled right... But is it something like that?
Just use copy (mark a line and press Ctrl and c on the same time), then go to the target document and press Ctrl + v.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old September 14, 2002, 07:49   #17
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Quote:
Originally posted by Martin Gühmann
Just use copy (mark a line and press Ctrl and c on the same time), then go to the target document and press Ctrl + v.

-Martin
Yeah, I know, but I was just too tired at that moment to open all the documents again, and try to fix around with them... but thx anyway
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 08:12   #18
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
It says there's a syntax error on this line:

Code:
if(TileHasImprovement(location[0], OLD_TILEIMP[i])) {
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 08:24   #19
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
That is why i hate slic. one small typo and frustation comes to you.
It is a missing '{' in the line before. I edited the code from its post it should work now.
Sorry.
__________________
"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 September 14, 2002, 08:31   #20
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Ok, thx, it works now (Well...it starts without complaining, haven't tested if the code works

Can't wait til the day, were I might be able to see what the errors mean (Just started learning java last week, so there's still a long way )...
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 08:35   #21
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
I just loaded a savegame to test if it works, but I don't get the bonus...
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 08:40   #22
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Quote:
Originally posted by ADG
I just loaded a savegame to test if it works, but I don't get the bonus...
EDIT: Woops, I ment to edit instead of reply...

Is it because in this line, you sets the number of the player. Shouldn't it be something like the i in PW_BONUS[i]? Otherwise the player who gets the bonus is always the same player... or am I mistaking here?

Code:
setPW(player[0], FinalPW);
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 08:56   #23
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
When you load a saved game. the slic codes are the same as the ones you saved. So my slic code is not part of.
To tell the PC that you have a new code in your game data you must press ' and the chatbox will open.
Then type
Code:
/reloadslic
And press enter. The game will search for new codes and changes in the code in your game data.
New games dont need this procedure.
__________________
"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 September 14, 2002, 09:00   #24
Adagio
staff
Spore
Deity
 
Adagio's Avatar
 
Local Time: 09:54
Local Date: November 1, 2010
Join Date: Jun 2001
Posts: 11,112
Ah, ok, thx for the help, it now works fine, now I only need to finish the code, so it works for the other TI's too
__________________
This space is empty... or is it?
Adagio is offline  
Old September 14, 2002, 09:01   #25
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: 09:54
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
Quote:
Originally posted by ADG
I just loaded a savegame to test if it works, but I don't get the bonus...
You just loaded a save game? In that case this is to less. You have also to reloadslic to do it just open the chat window by typing the apostrophe key (') and enter /reloadslic. Alternatively you can also open the cheat editor and press the reloadslic button. BTW the cheat editor is a great tool to test such code, but don't expect if you place a tile improvement with the cheat that you get the bonus you have to do it regulary. But you can first place a tile improvement and then close the cheat editor and place then the upgrate improvement.

-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
Martin Gühmann is offline  
Old September 14, 2002, 09:14   #26
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 04:54
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by ADG

Is it because in this line, you sets the number of the player. Shouldn't it be something like the i in PW_BONUS[i]? Otherwise the player who gets the bonus is always the same player... or am I mistaking here?

Code:
setPW(player[0], FinalPW);
Hey you are already commenting codes. Big step in slic learning.
Let me aswer you:
Check this part:
Code:
InitialPw = player[0].publicworkslevel;	
FinalPW = InitialPw + PW_BONUS[i];		
SetPW(player[0], FinalPW);
The SetPW(int_t, int_t) function works not adding the value of the second argument (int_t) to the player PW amount but replacing.
So in this piece of code:
line1: i get the player PW (InitialPW)
line2: make a new value(FinalPW) adding to the InitialPW value the PW_BONUS[i]
line3: Change the PW reserve of the player[0] to be equal to FinalPW

Remember: the TI entry names can be foun in the tileimp.txt

PS: I learnt slic in less than two days reading the info in this thread and locutus slic manual:
http://apolyton.net/forums/showthrea...threadid=33181

Of course. Make codes that actually worked took me a little while

EDIT: I never had experience in any coding language. Slic was the first.
__________________
"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; September 14, 2002 at 09:33.
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 03:54.


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