 |
|
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?
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.
|
|
|  |
 |
|
Peter Triggs
|
|
Gone Fishin, Canada
Jan 2000 time: 05:20
|
|
quote:
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:
quote:
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.
|
|
|  |
 |
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:20
|
|
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 on 17-07-2002 at 13:28
|
|
|  |
All times are GMT. The time now is 05:20. Apolyton Time is 00:20. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|