Announcement

Collapse
No announcement yet.

Limits of modding

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

  • Limits of modding

    I'm trying to get a sense of the limits to the ability to mod CTP2 and have a few questions:

    1) can you make government types that expire? Meaning can you make it so that a civilization cannot have a "city-state" government after the discovery of a certain advance (giving a new government type, for instance) or after a certain date in the game?

    2) Is there an equivalent to the events.txt in Civ II? so that you could tell the game/scenario: on x turn, [DoSomething1] happens?

    3) In a scenario, could you edit the territory borders around a city?

    Thanks in advance.

  • #2
    2) Is there an equivalent to the events.txt in Civ II? so that you could tell the game/scenario: on x turn, [DoSomething1] happens?
    I'll try to answer this one. In Civ2 you could have:

    Code:
    @IF
    CityTaken
    city=New York
    attacker=English
    defender=Americans
    @THEN
    Text
    New York captured by the Redcoats! Enraged local citizens join the fight for liberty!
    EndText
    CreateUnit
    unit=Militia
    owner=Americans
    veteran=false
    homecity=none
    locations
    84,22
    84,23
    79,31
    endlocations
    @ENDIF
    In CTP2 this could be done, pretty well literally, as:

    Code:
    HandleEvent(CaptureCity) 'SampleHandler' pre {
    
        if (PlayerCivilization(player[0]) == CivilizationIndex("English") 
            && PlayerCivilization(city[0].owner) == CivilizationIndex("American")
    	  && city[0].location==NewYorkLoc ){
    	   
             message(city[0].owner,'NewYorkCaptured');
             event:CreateUnit(city[0].owner,UnitDB(UNIT_MILITIA),SpawnRebelsLoc,0);
    
        }
    }
    
    
    messagebox 'NewYorkCaptured' {
        Show();
        Text (ID_NewYorkCapturedMessage);
        // NewYorkCapturedMessage "New York captured by the Redcoats!
        // Enraged local citizens join the fight for liberty!"
    }
    where:

    i) NewYorkLoc is a (global) location variable that you've set to be New York's location,

    ii) SpawnRebelsLoc is a (global) location variable that you've set to be the place where you want the Militia to appear,

    and,

    iii) the outcommented lines appear in the .txt file that you're using to save your text in.

    The "CaptureCity" event occurs whenever a city is captured: player[0] is the capturing player and city[0] is the city (so city[0].owner is it's owner and city[0].location is it's location).

    The only thing I've left out is a mechanism to check that SpawnRebelsLoc is a valid location to create a new unit on. There's more than one way to do this and no point on going off on a tangent.

    Although I haven't looked into it in detail (the above is just the example on p32 of the Conflicts in Civilization Instruction Manual) it would appear to be a very straightforward matter to convert any of your existing triggers into SLIC.
    (What would be very very tedious would be making the maps and units and all that kind of stuff.)

    But anyway, SLIC is FAR more powerful than the triggers mechanism of Civ2. For one thing, the latter had seven events: CityTaken, Negotiation, RandomTurn, ScenarioLoaded, Turn, TurnInterval, and UnitKilled. SLIC has something like 238 events (if I counted them right, they're not numbered). Not all of them are interesting, nor even all that usable, but each of them is a 'hook' into the executable: they (and the ones in Civ2 for that matter) allow you to change the actual game's program.

    'Actions' Once you've set your hook, Civ2 gave you 9 types of 'action' that you can perform: ChangeMoney, CreateUnit, DontPlayWonders, JustOnce, MakeAgression, MoveUnit, PlayCDTrack, PlayWaveFile, and Text/EndText. With SLIC what corresponds to an action is just any acceptable block of SLIC code. From this point of view there are literally infinitely many types of SLIC 'actions' because as a proper scripting language SLIC has all sorts of resources that enable you to specify what it is that you want the computer to do.

    For example, in Civ3 you can get 'Generals'. But, on the one hand, I've read complaints that you don't get enough of them, and on the other, big deal: Immortal Wombat had already implemented a similar idea in Cradle before Civ3 was released. Hexagonian describes it as follows:

    There is also a set of Wonder Units that are tied into the creation of certain Wonders. I tried to align them to a theme within the Wonder - hence the selection of certain leaders. They will grant veteran status to any units underneath them. They also operate as ranged units, so they will not be sitting on the front lines taking the early hits - and are generally stronger than their counterparts. There is a happiness penalty if the unit is disbanded or lost.

    To do this, Immortal Wombat wrote a whole bunch of little handlers: a pair for each of the special Wonder units. Here's the pair for Hammurabi with my comments trying to explain what each line is doing:

    Code:
    HandleEvent(CreateWonder) 'Hammurabi' post {//this triggers whenever a Wonder is created
    
    	tmpWonder = value[0];//set tmpWonder equal to the Data Base value of the Wonder that was just created
    
    	if(tmpWonder == WonderDB(WONDER_CODE_OF_HAMMURABI)) {//if this wonder was the CODE_OF_HAMMURABI
    		tmpCity = city[0]; // set tmpCity equal to the city the wonder was created in 
    		tmpPlayer = tmpCity.owner;//and tmpPlayer equal to the owner of that city
    		CreateUnit(tmpPlayer, UnitDB(UNIT_HAMMURABI), city[0].location, 0);//give HAMMURABI to tmpPlayer in the city
    		DisableTrigger('Hammurabi');//do this once, i.e., only allow one HAMMURABI unit to be created
    	}
    }
    
    HandleEvent(BeginTurn) 'UnhappinessChecker1' pre {
    	foundHim = 0;//set foundHim to false
    	if(PlayerHasWonder(Player[0], WonderDB(WONDER_CODE_OF_HAMMURABI))) {
          //if the player whose turn is beginning has the CODE_OF_HAMMURABI Wonder
    		for(i = 0; i < player[0].units; i = i + 1) {// look through his units
    			GetUnitByIndex(player[0], i, tmpUnit);//   "
    			if(tmpUnit.type == UnitDB(UNIT_HAMMURABI)) {//if one of them is HAMMURABI
    				foundHim = 1; //set foundHim to true
    			}
    		}
    		if (!foundHim) {//if we didn't find him (i.e. he just got killed or disbanded)
    			for(j = 0; j < player[0].cities; j = j + 1) {//look through his cities
    				GetCityByIndex(player[0], j, tmpCity); // "
    				Event:AddHappyTimer(tmpCity, 3, -1, 12);// and make each of them unhappy
    				DisableTrigger('UnhappinessChecker1'); // do this once, i.e. just when HAMMURABI is       
                                                                   // killed/disbanded
     
    			}
    		}
    	}
    }
    Details aside, the real point here is to notice the incredible flexibility of what you can do with SLIC.

    Comment


    • #3
      Re: Limits of modding

      Originally posted by ahenobarb
      I'm trying to get a sense of the limits to the ability to mod CTP2 and have a few questions:

      1) can you make government types that expire? Meaning can you make it so that a civilization cannot have a "city-state" government after the discovery of a certain advance (giving a new government type, for instance) or after a certain date in the game?
      I've heard that you can add the line ObsoleteAdvance in the government.txt inside the brackets of the gov you aim at.
      but i never tested it myself
      Ex
      Code:
      ObsoleteAdvance ADVANCE_HUMAN_RIGHTS
      Originally posted by ahenobarb
      3) In a scenario, could you edit the territory borders around a city?
      Trick one. But i am almost 100% sure that you cant in a easy way .
      The best way that comes to my mind is to create another player cities in the territory you dont want to have boders and them disband them right after. the territory wich the disbanded city occupied becomes neutral.
      "Kill a man and you are a murder.
      Kill thousands and you are a conquer.
      Kill all and you are a God!"
      -Jean Rostand

      Comment


      • #4
        It is quite easy to make governments obsolete by using the flag in government.txt. This eliminates that government from the 'pick list' after the enabling advance has been achieved. The problem is that if the player is running an 'obsolete' government at the changeover event then that civ will remain in that government. There appears to be no easy way to automatically kick the player out of the obsolete government.

        Comment


        • #5
          As far as borders go, you can create tile improvements similar to the Fortress, that make the border expand. The radius of the expansion is determined by a variable that can be set, so you could simply create 1 (invisible) tile imp for every radius you would like and place them with SLIC (make sure cities themselves have a border radius of 0 or 1 then, or things could get screwed up). I've successfully tested this myself to simulate the expanding borders concept of Civ3. Only down-sides are shrinking borders and city radius. Making borders shrink properly is tricky, the 'real' border will shrink but some sort of remnant of the old border is left, which looks ugly on the map and causes a number of weird bugs; I haven't succeeded in making this work properly yet (but Pedrunn's trick is a good one, hadn't considered that yet - but it would be better to use tile imps rather than cities). The second problem is that the city radius *always* falls within the borders of a civ. If you edit cities so they have a border radius of 0 and then place a tile-imp with radius 1 through SLIC, it will work fine for 1-radius cities but when the city expands to size 9 (size 7 in the original game, IIRC), the city radius expands to 2 and the borders expand with it, whether you want to or not.

          BTW, excellent explanation/comparison by Peter, that's one for the archives
          Last edited by Locutus; July 17, 2002, 04:28.
          Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

          Comment


          • #6
            Just what I was thinking...

            The one real pain translating Civ2 code to SLIC is the locations, which are bound to be different in the two games. God help whoever does Red Front.
            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


            • #7
              Thanks everybody!

              Great explanation Peter, I went through it line by line and now have a much better sense how to do things like this with .slc files. Great example BTW, I am playing the Cradle Mod and have Hammurabi, it's nice to look at some of the code, so I can see how this works out in the game.

              From everything that I've gathered today, it looks like the Civ III mod that I shelved while I waited for improvements to the game to come out, will be coming off the shelf and into a CTP2 environment. CTP2 can do about 95% of the things I wanted to do in the mod, now to make time to acutally do it.

              Comment


              • #8
                Hey, that's great to hear Don't restrain yourself in providing us with juicy details, we love juicy details
                Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                Comment


                • #9

                  Just let us know about the other 5%. We probably can help you get those
                  Last edited by Pedrunn; July 18, 2002, 01:47.
                  "Kill a man and you are a murder.
                  Kill thousands and you are a conquer.
                  Kill all and you are a God!"
                  -Jean Rostand

                  Comment

                  Working...
                  X