Martin:
Yes, you're right: it works. I generated a NukeCity event in a savegame and nuked my capitol in 5340 BC. He, He.
Pedrunn:
Yup, in the olden days programs used to have line numbers (which the programer specified). If they still did we'd be writing stuff like:
Someone told me that the line numbers are probably still there but we just can't see them. The above code (which I just made up) shows how the computer would be executing the statements one by one. The curley brackets we use now eliminate the "goto" and "next" statements and make things a lot easier to read.
My bad. I was answering your first post where you didn't have the Alertbox. I should have looked more closely at your later posts where you had it in. Yes, you're right, if you're going to have an eyepoint like that you'll need to put "city[0]=tmpCity" in your "NuclearBoom" handler. Here's a couple of other points:
1) In the Alertbox, you need "Eyepoint(city[0].location); "
2) If you're going to use an Alertbox (rather than a messagebox) you have to put a button on it.
Alertboxes are described as 'modal', which means it's necessary for the player to respond in order for the game to continue. In order to respond, he's got to have a button to press. Alternately, you might just go for a Messagebox, where the buttons are optional.
3) I'm not at all sure when "g.player==player[0]" is true. You might have trouble with this, but keep on SLICing.
BTW Peter it wouldn't surprise me if it work,
Pedrunn:
Something like: it reads the line 1 first, then line 2, then line 3 ... (I hope you guys understood me)
Code:
600 for(i=0; i< player[0].cities; i=i+1); 610 GetCityByIndex(player[0], i, tmpCity); 620 if(CityHasBuilding(tmpCity, "IMPROVE_NUCLEAR_PLANT")) then 640; 630 goto 690; 640 randomnum = random(300); 650 if(randomnum == 0 && !HasAdvance(player[0], ID_ADVANCE_FUSION)) then 670; 660 goto 690; 670 Event: NukeCity(tmpCity, player[0]); 680 message(tmpplayer, 'NuclearBoom'); 690 next i;
Actually when i made a first draft of the code i used tmpcity all the time i just change after i saw the message cod could not figure out what that was. It just know what city[0] means. So i changed this integer name.
1) In the Alertbox, you need "Eyepoint(city[0].location); "
2) If you're going to use an Alertbox (rather than a messagebox) you have to put a button on it.
Code:
Button(ID_OK){ Kill(); }
3) I'm not at all sure when "g.player==player[0]" is true. You might have trouble with this, but keep on SLICing.
Comment