Announcement

Collapse
No announcement yet.

A Project: Creating Cpt. Nemo's Red Front for CtP2

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

  • #91
    Roughly the same place but with lots of snow.

    I think this is why i need to change the dead tile for minefield. Im thinking of using the grassland/glacier graphic with the barbed wire on, if i can get the borders not to overlap the barbed wire.

    The borders also overlap the deciduous trees in places, hopefully i can fix that but its not too noticeable for now.
    Attached Files
    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
    CtP2 AE Wiki & Modding Reference
    One way to compile the CtP2 Source Code.

    Comment


    • #92
      Well i attempted some code, i eventually got to the point where it didnt bring up any errors, but... it doesnt do anything.

      Heres basically what i want to do:

      What I want to do is make certain units for Germany, Russia and Finland be buildable only in cities the Soviets start with.

      Theres a lot of these cities, 99 in fact. Is there a shorter way to do this, rather than repeating the code below for every city location?

      Code:
      // Limits units buildable by each city in the game
      int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnit)
      {
      city_t	tmpCity;
      
      // USA city
      	GetCityByLocation(usbaseLoc, tmpCity);
      	if (CityIsValid(tmpCity)) {  if (tmpCity == theCity) {
      		if (theUnit == UnitDB(UNIT_AABATT_RF)) {
      			return 1;
      		}
      	}}
      }
      Now this is the code i butchered together as a test:

      Code:
      int_f IsSovietCity(city_t theCity) {
      	city_t tmpCity;
      
      	tmpCity = theCity;
      
      	if(tmpCity.location == (aralskLoc)
      	|| tmpCity.location == (archangelskLoc)
      	) {
      		return 1;
      	}
      	return 0;
      }
      Code:
      int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnit)
      {
      city_t	tmpCity;
      location_t  tmpLoc;
      
      	GetCityByLocation(tmpLoc, tmpCity);
      	if (CityIsValid(tmpCity)) {  if (IsSovietCity(tmpCity)) {
      		if (theUnit == UnitDB(UNIT_REDARMY_RF)) {
      			return 1;
      		} elseif (theUnit == UnitDB(UNIT_WAFFENSSREG_RF)) {
      			return 1;
      		} elseif (theUnit == UnitDB(UNIT_EINSATZK_RF)) {
      			return 1;
      		}
      	}}
      }
      Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
      CtP2 AE Wiki & Modding Reference
      One way to compile the CtP2 Source Code.

      Comment


      • #93
        With the original game, I think you have to repeat it for each location. With the playtest, you could try some of the flags that have been added by E (CityStyleOnly?) for use in units.txt.

        And please, do not use
        Code:
        GetCityByLocation(tmpLoc, tmpCity);
        if (CityIsValid(tmpCity))
        In the way you are using it here, CityIsValid will return true every time after the first valid city has been found. When the next call has an invalid tmpLoc, tmpCity is not updated, so it will still contain the "valid city" from the previous call, and you will end up executing the code multiple times for this city.

        This should be
        Code:
        if (GetCityByLocation(tmpLoc, tmpCity))
        The GetCityByLocation function will return 1 (true) when tmpCity has been updated with a valid value, and 0 (false) when there is no valid city at tmpLoc.

        Comment


        • #94
          Originally posted by Fromafar
          With the original game, I think you have to repeat it for each location. With the playtest, you could try some of the flags that have been added by E (CityStyleOnly?) for use in units.txt.
          Using CityStyleOnly and CivilizationOnly would be the best option now, I assume it would be a lot faster in-game too.

          Thanks for your help

          BTW have you got any idea why turnlength.txt isnt working now? I brought it up a couple of times in the playtest thread, i hoped someone might look at it.
          Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
          CtP2 AE Wiki & Modding Reference
          One way to compile the CtP2 Source Code.

          Comment


          • #95
            Will those flags work the way you want them to after a city has been captured?
            Concrete, Abstract, or Squoingy?
            "I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis

            Comment


            • #96
              Yeah they work fine. I basically didnt want captured cities to build everything a normal owned city would. Mainly to decrease the speed of an advance without proper logistics, and to add a bit of flavour. Ill make sure the German blitzkreig wont suffer though.

              For the few specific cities (eg. AI sea-locked cities building ships) ill use SLIC.
              Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
              CtP2 AE Wiki & Modding Reference
              One way to compile the CtP2 Source Code.

              Comment


              • #97
                citystyleonly lets any civ build the unit as long as the city thats building it matches whats required for the unit.

                civonly is like its implied the civ can build that unit regardless of the citystyle.

                Now I never tried mixing the two (using both flags on a unit) which could make it so that germans can only build german units in german cities. that could be away to leave real unique or special units to limited production.
                Formerly known as "E" on Apolyton

                See me at Civfanatics.com

                Comment


                • #98
                  Originally posted by E

                  Now I never tried mixing the two (using both flags on a unit) which could make it so that germans can only build german units in german cities.
                  Tried, tested and working.
                  Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                  CtP2 AE Wiki & Modding Reference
                  One way to compile the CtP2 Source Code.

                  Comment


                  • #99
                    For those that are interested, the map and all thats included is now finished.

                    Todo list:

                    Lots of msg and alert boxes (related to city capture/atmosphere).
                    SLIC to achieve bombing raids, blitzkreig tactics (rest of AI is done).
                    SLIC related to spawning units (im not sure this is necessary yet).
                    Great Library (icons and text).
                    Playtesting.

                    Everything else is done or in place to work, so you can now technically play the scenario. Although the Germans wont blitzkreig and will sometimes allow their planes to run out of fuel.
                    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                    CtP2 AE Wiki & Modding Reference
                    One way to compile the CtP2 Source Code.

                    Comment


                    • Fantastic!!! A big project here... and looking great!!! Can't wait to give it a shot

                      Comment


                      • Big isnt the word

                        Nice to see that someone might actually play this if it gets completed though.
                        Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                        CtP2 AE Wiki & Modding Reference
                        One way to compile the CtP2 Source Code.

                        Comment


                        • no doubt, I'll play too

                          Comment


                          • I'll give it a round (it may take me awhile).

                            Great work, I'm glad youre making use of my modder's code.

                            I hope more people try it than my civ3mod (I guess a name change would help mine)
                            Formerly known as "E" on Apolyton

                            See me at Civfanatics.com

                            Comment


                            • Just a bump and update for anyone that might still be reading.

                              I came back to the project a couple of weeks ago and found a crash with the latest playtest. Martin G. has kindly looked into it and (AFAIK) fixed the crash in the next source code release.

                              Once things are back to a non-crashing state I'll hopefully be able to start looking at the AI again.

                              For now I'm making new battle views, which make a nice change from the same ones we've been looking at for the past 7 years.

                              And WTF, 7000 views? How did that happen....
                              Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                              CtP2 AE Wiki & Modding Reference
                              One way to compile the CtP2 Source Code.

                              Comment


                              • Another update before I leave for Christmas holidays for a few weeks (likely without internet).

                                The new source code release got things working again and things are running smooth, although there is a crash related to AI transports, but fortunately they're practically irrelevant for the AI in Red Front anyway, so I've removed them for the AI for the time being.

                                I've played the scenario twice for 20 turns (the total length is around 60) and encountered no problems, in fact using tweaked strategies/goals (mostly from Peter Triggs' tweaked Activision WW2 scen) the AI is almost capturing cities with historical accuracy. I say almost but it seemed more like unit build costs were too low, which meant I was able build and rush many units and reinforce every front too easily.

                                AI grouping larger armies (>8) by itself is still a problem, but it seems spreading out it's units means it chooses battles better as it has greater vision of the current situation. Of course this means it can lose many units attacking heavily defended areas with small armies though.

                                The AI at least doesn't ungroup big armies created at the start though, so this could be a way (using spawn and group events) to get the AI to attack a rough area (so it's not predictable) at the right time.

                                I also now have redfront.bat setup so I can start testing summer and winter variations easier.

                                Finally some eye-candy... kind of. This is a prototype for the deciduous forest battle-view in summer.
                                Attached Files
                                Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                                CtP2 AE Wiki & Modding Reference
                                One way to compile the CtP2 Source Code.

                                Comment

                                Working...
                                X