 |
|
Pedrunn
|
 |
of Natal, Brazil
Jul 2001 time: 02:22
|
|
DP. and if you copied the code that was in here try the next post one
Last edited by Pedrunn on 13-09-2002 at 17:37
|
|
|  |
 |
|
Adagio

|
|
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...
Last edited by Adagio on 13-09-2002 at 19:18
|
|
|  |
 |
|
mapfi
|
|
Zurich, Switzerland
Jul 2002 time: 06:22
|
|
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
|
|
Zurich, Switzerland
Jul 2002 time: 06:22
|
|
That's what you want, yes.
|
|
|  |
 |
|
Pedrunn
|
 |
of Natal, Brazil
Jul 2001 time: 02:22
|
|
DP
Last edited by Pedrunn on 13-09-2002 at 23:28
|
|
|  |
 |
|
Pedrunn
|
 |
of Natal, Brazil
Jul 2001 time: 02:22
|
|
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;
}
}
Last edited by Pedrunn on 14-09-2002 at 17:21
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:22. Apolyton Time is 00:22. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|