 |
|  |
 |
|  |
 |
|
azalae
|
|
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 on 05-06-2002 at 07:46
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:19
|
|
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.
|
|
|  |
All times are GMT. The time now is 05:19. Apolyton Time is 00:19. |
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
|
|
|
|
|
|