I tried to do a code about a nuclear explosion disaster. I wrote the code but i am getting syntax errors everytime i load the game with it.
So can anyone help this unhappy slic newbie. And also point out changes to help me became a better slicer.
- Thanks in advance
So can anyone help this unhappy slic newbie. And also point out changes to help me became a better slicer.
Code:
HandleEvent(BeginTurn) 'NuclearBoom' post {
city_t tmpcity;
int_t tmpplayer;
int_t i;
int_t randomnum;
message(tmpplayer, 'NuclearBoom');
tmpcity = city[0];
tmpplayer = player[0];
GetCityByIndex(player[0], i, city[0]);
for(i=0; i< player[0].cities; i=i+1) { // Scroll over all cities
if(CityHasBuilding(city[0], "IMPROVE_NUCLEAR_PLANT")){ // if city has Nuclear Plant
randomnum = random(300); // there is a 300 Chance.
if(randomnum == 0){ // of happenning
Event: NukeCity(city[0], player[0]); // a nuclear explosion (nuke).
if(HasAdvance(player[0], ID_ADVANCE_FUSION)) { // But if player has Fusion
randomnum == randomnum - 10000; // nothing happens.
}
}
}
}
}
I have fix it the post.
Comment