 |
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:14
|
|
Jules,
For your specific example, you could use:
code:
HandleEvent(GrantAdvance) 'BuildingExpires' post {
advance[0]=value[0];
if (value[0] == AdvanceDB(ADVANCE_ECONOMICS)) {
Message(player[0], 'BUILDING_OBSOLETE_1_MSG');
}
}
with:
BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(IMPROVE_BAZAAR)} obsolete. However we can now build the {BuildingDB(IMPROVE_BROKERAGE)} improvement instead."
But you'll then have to do this over again for each advance that makes a building obsolete. As there's quite a few of them you might want to set up a mapping from advances to buildings via a system of arrays. This is what I did in my UnitUpdater. In your case it would look something like this:
obsadv[0]=AdvanceDB(ADVANCE_ECONOMICS) ;
OBS_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BAZAAR);
NEW_BUILDING_TYPE[0]= BuildingDB(IMPROVE_BROKERAGE);
obsadv[1]=AdvanceDB(ADVANCE_whatever) ;
OBS_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);
NEW_BUILDING_TYPE[1]= BuildingDB(IMPROVE_whatever);
obsadv[2]=AdvanceDB(ADVANCE_and so on) ;
OBS_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);
NEW_BUILDING_TYPE[2]= BuildingDB(IMPROVE_and so on);
Your handler would then look like:
code:
// Globals:
int_t BUILDING_INDEX;
int_t OBS_BUILDING_TYPE[];
int_t NEW_BUILDING_TYPE[];
HandleEvent(GrantAdvance) 'BuildingExpires' post {
int_t i;
int_t obsadv[];
// the above data arrays can go here
for(i=0; i
with:
BUILDING_OBSOLETE_1 "Our knowledge of {advance[0].name} has made the improvement {BuildingDB(OBS_BUILDING_TYPE[BUILDING_INDEX])} obsolete. However we can now build the {BuildingDB(NEW_BUILDING_TYPE[BUILDING_INDEX])} improvement instead."
This is assuming that no advance obsoletes more than one type of building. It's a bit more complicated if you allow that to happen. No guarentees the above code will work as it stands; I might have forgotten something.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:14
|
|
Glad it worked. Mind you, I don't know what happened to the code I posted earlier.
Ben's right about DebugSlic. If you don't have DebugSlic=Yes you won't get proper Error messages.
|
|
|  |
All times are GMT. The time now is 05:14. Apolyton Time is 00:14. |
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
|
|
|
|
|
|