Announcement

Collapse
No announcement yet.

creating natural disasters via SLIC????

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    quote:

    Originally posted by Harlan on 01-06-2001 04:31 PM
    Alpha,
    If its like CTP1, any file that starts with a number can be changed, but you have to change that number too. So if it was the Units.txt, add three new units and then add three to that start number.

    Luckily, many files now no longer use that number, which is great, cos it was a real pain to keep that straight.



    I was just making a joke If I had more time, I'd have sat down with the SLIC doc and be doing it myself. But since coding and analyzing crappy code is what I do all day, I mostly just want to have fun when I play. unfortunately, I just cant turn off all those "what if" thoughts

    I really wish they had gotten rid of all the size limitations. Most have really bogged their computers down when they had unlimited everything. Of course, definitions of more of the fields would be helpful. Been playing with the Ai to see if I can maximize its aggressiveness without being reckless.
    ------------------
    History is written by the victor.
    [This message has been edited by Alpha Wolf (edited January 06, 2001).]

    Comment


    • #32
      Now I am embaressed. I did that in a hurry before I left on holiday. I am aware (now) that this is simply a function that return the cities food prod.

      Anyway today I will see what I can learn, cause I have 12 hours and onthing planned.

      Comment


      • #33
        What I would like to see (outside of normal disasters) are some disasters political in nature. Say that your happyness drops 5-10 points in every city, and any city that drops into unrest has a good chance of going barbarian. This might be considered a civil war, the death of a powerful ruler, or something.

        I think this would be good, since it would give us a reason to keep building all those theaters and stuff that dont seem to make a differnce.

        Outside of that, does anyone know how to increase the unhappyness due to overcrowding?

        Thanks,



        ------------------
        Bluevoss-
        Bluevoss-

        Comment


        • #34
          quote:

          Originally posted by Bluevoss on 01-06-2001 08:06 PM
          What I would like to see (outside of normal disasters) are some disasters political in nature. Say that your happyness drops 5-10 points in every city, and any city that drops into unrest has a good chance of going barbarian. This might be considered a civil war, the death of a powerful ruler, or something.

          I think this would be good, since it would give us a reason to keep building all those theaters and stuff that dont seem to make a differnce.

          Outside of that, does anyone know how to increase the unhappyness due to overcrowding?

          Thanks,




          in const.txt, REVOLUTION_LEVEL 60. By increasing this number you can make cities revolt more often. I suspect from your questions that you are playing on the easier levels. The more difficult levels require some attention to happines. You might also avoid building happiness wonders.

          ------------------
          History is written by the victor.

          Comment


          • #35
            AW,

            Looking at the 4th post on this thread it appears you want an 80% chance of some type of natural disaster to occur every turn. Is that correct? I suppose that is the easy part anyway and could be modified by anyone to have x% chance of the disaster routine on each turn once the other code is written. I'm pretty sure I can get a randomly placed bombardment for the earthquakes. The drought/great weather part seems as though it may be more complicated, but I'll give it a shot. I doubt I could do the tidal wave thing and honestly won't even try. I remember reading something about changing terrain could have unpredictable or undesirable results so I'm not going to mess with that.

            Comment


            • #36
              Radical_Manuvr that would be good if you got to work on the bombardemnt functioons. I will create some simplle framework, like messageboxes and the like, adn determing what disaster occurs. Then you/we can simply insert the functions into the code and get it running.

              And if i get that all done, I'll also have a go at bombarding but i doubt that i will.

              Good Luck!

              Comment


              • #37
                RE: To do food production
                Drought: Create a building that decrease food by 25%
                IMPROVE_DROUGHT {
                DefaultIcon ICON_IMPROVE_GRANARY
                Description DESCRIPTION_IMPROVE_GRANARY
                EnableAdvance ADVANCE_AGRICULTURE
                ProductionCost 0
                Upkeep 0
                FoodPercent -0.25
                }
                Surplus: Create building increase by 25%
                IMPROVE_SURPLUS {
                DefaultIcon ICON_IMPROVE_GRANARY
                Description DESCRIPTION_IMPROVE_GRANARY
                EnableAdvance ADVANCE_AGRICULTURE
                ProductionCost 0
                Upkeep 0
                FoodPercent 0.25
                }

                Can that work?

                Then all we do is create them, and then after x amount of turns remove them.

                Is that right?

                Comment


                • #38
                  quote:

                  Originally posted by Radical_Manuvr on 01-06-2001 10:37 PM
                  AW,

                  Looking at the 4th post on this thread it appears you want an 80% chance of some type of natural disaster to occur every turn. Is that correct? I suppose that is the easy part anyway and could be modified by anyone to have x% chance of the disaster routine on each turn once the other code is written. I'm pretty sure I can get a randomly placed bombardment for the earthquakes. The drought/great weather part seems as though it may be more complicated, but I'll give it a shot. I doubt I could do the tidal wave thing and honestly won't even try. I remember reading something about changing terrain could have unpredictable or undesirable results so I'm not going to mess with that.


                  being that turns represent so many years, I figure theres a reasonable chance that somewhere in the world a disaster would happen almost every turn. alot of them will be in unpopulated areas or quakes so small that they dont do much damage. Would it be easy just to do weather every turn and to put out a message only when its really bad/good? Just randomly increase/decrease food levels worldwide since from one year to the next crop outputs vary, sometimes drastically.

                  ------------------
                  History is written by the victor.

                  Comment


                  • #39
                    quote:

                    Originally posted by heardie on 01-07-2001 12:29 AM
                    RE: To do food production
                    Drought: Create a building that decrease food by 25%
                    IMPROVE_DROUGHT {
                    DefaultIcon ICON_IMPROVE_GRANARY
                    Description DESCRIPTION_IMPROVE_GRANARY
                    EnableAdvance ADVANCE_AGRICULTURE
                    ProductionCost 0
                    Upkeep 0
                    FoodPercent -0.25
                    }
                    Surplus: Create building increase by 25%
                    IMPROVE_SURPLUS {
                    DefaultIcon ICON_IMPROVE_GRANARY
                    Description DESCRIPTION_IMPROVE_GRANARY
                    EnableAdvance ADVANCE_AGRICULTURE
                    ProductionCost 0
                    Upkeep 0
                    FoodPercent 0.25
                    }

                    Can that work?

                    Then all we do is create them, and then after x amount of turns remove them.

                    Is that right?


                    That sure sounds like it could work. Then all SLIC would have to do is go thru the cities and add droughts occasionally. But can we auctually track what turn an improvement was built so we know when to kill it?

                    ------------------
                    History is written by the victor.

                    Comment


                    • #40
                      In case I forget, thanks for all the help guys

                      ------------------
                      History is written by the victor.

                      Comment


                      • #41
                        And everyone (drumroll) here is some cool code

                        Alpha I thought about that too(tracking improvements) and here is what i came up with:

                        have a variable say isDrought - and default it to -1.
                        When we have a drought set it to three and then decrement it bu 1 each turn. when it gets to zero remove the improvment and set it to -1. Too easy. Anyway the code that can be added to mine is:
                        1+2. Drought/Good Weather Building
                        I can't work out how to add a building to a city. anyone?
                        3. Add a earthquake code.

                        I also took the liberty to add floods as a natural disaster as there is already a flood function.

                        Enough rambling lets post some crappy code
                        Code:
                        #include "msg.slc"
                        HandleEvent(BeginTurn) 'FirstTurn' pre
                        {
                        	Message (g.player, 'StartMessage'); //Message when you start a game
                        	DisableTrigger('FirstTurn')
                        }
                        
                        HandleEvent(BeginTurn) 'EveryTurn' pre 
                        {
                        	int_t DisasterType;
                        	int_t FloodStrength;
                        	
                        	int_t isDrought; //Used to determing whether we are is drought, or something else.
                        	isDrought = -1;
                        	//The next will do two checks. If it is greater than zero, decrement.
                        	//If it is 0 then destroy all the 'Drought' buildings and set it to -1
                        	if (isDrought > 0) {
                        		isDrought = isDrought - 1;
                        	}
                        	
                        	elseif (isDrought == 0) {
                        		isDrought = -1;
                        		Message (g.player, 'DroughtEnd'); //Message when drought ends
                        	}
                        
                        	
                        	int_t isWeather; //Used to determing whether we are is drought, or something else.
                        	isWeather = -1;
                        	//The next will do two checks. If it is greater than zero, decrement.
                        	//If it is 0 then destroy all the 'Drought' buildings and set it to -1
                        	if (isWeather > 0) {
                        		isWeather = isWeather - 1;
                        	}
                        	
                        	elseif (isWeather == 0) {
                        		isWeather = -1;
                        		Message (g.player, 'WeatherEnd'); //Message when good wheather ends
                        	}
                        
                        	
                        	//Start the disaster code here
                        	
                        	DisasterType = random (10);
                        	if (DisasterType == 1)
                        	{
                        		Message (g.player, 'DroughtBegin'); 
                        		//Create the building 'Drought'
                        		for(m = 0; m <= player.cities; m = m + 1){
                        			//Insert Building Code here
                        		} 
                        		isDrought = 3;  //Three turns of drought
                        	}
                        	
                        	if (DisasterType == 2)
                        	{
                        		Message (g.player, 'WeatherBegin');  
                        		//Create the building 'GoodWeather'
                        		for(m = 0; m <= player.cities; m = m + 1){
                        			//Insert Building Code here
                        		} 
                        		isWeather = 3;  //Three turns of weather
                        	}
                        
                        	if (DisasterType == 3 | | DisasterType == 4 | | DisasterType == 5 | | DisasterType == 6)
                        	{
                        		Message (g.player, 'Earthquake'); 
                        		//Do the Earthquake Stuff
                        	}
                        	
                        	if (DisasterType == 7 | | DisasterType == 8)
                        	{
                        		Message (g.player, 'Flood'); 
                        		FloodStrength = Random(3) + 1
                        		Flood(FloodStrength);
                        	}
                        }
                        I havent yet tested this(its not ready) so there may be careless spelling errors, missing ';'s, etc.

                        Alsoo I think this (part of it, anyway) should just be for large random disasters. I was thinking that up the top I could just at a
                        if(random(10)==1) then
                        and then there is only a 1/10 chance of anything occuring at all.

                        What do you think?

                        Radical_Manuvr got any code for me?

                        Comment


                        • #42
                          I just started on the earthquake stuff. Determined how to indicate the random location based on map size so it will work with any map, but I've only spent an hour on it so far so. Haven't tested yet either and I'm not sure how long it will take me.

                          Question about using building for the +/- food. If this is a human player, what's to stop them from selling the building? I don't have another method for the +/- food at this point but just thought I would throw that out.

                          To add a building I didn't find a nice easy way, maybe someone else knows of one. Here are the functions I think you need to do it.

                          VOID ClearBuildQueue(city)
                          Remove all items from the build queue of the given city. Example:

                          city_t tmpCity;

                          int_t i;



                          for(i = 0; i < player[0].cities; i = i + 1) {

                          GetCityByIndex(player[0], i, tmpCity);

                          if(CityisValid(tmpCity)) {

                          ClearBuildQueue(tmpCity)

                          }

                          }

                          //clears the build queues of all of player[0]’s cities

                          VOID AddBuildingToBuildList(city, buildingType)
                          Add the building type to the end of the city’s queue. Example:

                          if(!city[0].buildqueuelength) {

                          AddBuildingToBuildList(city[0], BuildingDB(IMPROVE_CITY_WALLS));

                          }

                          //if the city is not building anything, it will put the improvement City Walls into its build queue.


                          2 events that may help

                          BuildFront(city_t)
                          Try to build the first thing in a city's queue

                          OR

                          BuyFront(city_t)
                          Rush buy an item in a city

                          BuildFront is probably better. It may not require gold since it looks like BuyFront does. The above set of functions and events may require you to determine the gold a player has, how much the rush buy costs and add enough gold using AddGold(city).

                          I haven't tried the event below but it may work nice and clean. Since int_t is integer I suppose you have to know the index number of the building you want to add. Hopefully this will work.

                          CreateBuilding(city_t, int_t)
                          Create a building


                          For getting rid of the building


                          VOID DestroyBuilding(city, building)
                          Remove the specified building from the city.

                          Example:

                          DestroyBuilding(city[0], BuildingDB(IMPROVE_SILO));


                          Back to work on the quakes. Later

                          Comment


                          • #43
                            Forgot to add that the flood function or event (forgot which it is) is like the global warming disaster. As far as I know that would affect all coasts and possibly swamps (if it works like CTP1) anywhere on the map not just those near a random epicenter.

                            Comment


                            • #44
                              heardie:
                              Here's how to add a building:
                              CreateBuilding(tmpCity, BuildingDB(IMPROVE_DROUGHT));

                              Radical:
                              Here's how to prevent sales:
                              Code:
                              EventHandler(SellBuilding) 'SellBuilding' pre {
                              int_t	type;
                              	type = value[0];
                              	if (type = BuildingDB(IMPROVE_DROUGHT)) {
                              		return STOP;
                              	}
                              }

                              Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                              Comment


                              • #45
                                quote:

                                Originally posted by Radical_Manuvr on 01-07-2001 08:58 AM
                                Forgot to add that the flood function or event (forgot which it is) is like the global warming disaster. As far as I know that would affect all coasts and possibly swamps (if it works like CTP1) anywhere on the map not just those near a random epicenter.


                                Thats one of the reasons I avoided the existing flooding criteria. Assuming that it would flood ALL areas and i was also worried about the rerouting of rivers that happened on the first global warming (i assume its similiar in ctp2 also).

                                IF i get my work project done today, i want to slap some of these great ideas from you and Locutus in my game and try them out.

                                ------------------
                                History is written by the victor.

                                Comment

                                Working...
                                X