I was looking through the LOTR code, and noticed there's a LOTR_script.slc file in both the \Scenarios\War of the Ring\scen000x\default\gamedata and in the \ctp2_data\default\gamedata\ files, which one is actually used?
Announcement
Collapse
No announcement yet.
Script.slc Question
Collapse
X
-
Re: Script.slc Question
Originally posted by EPW
I was looking through the LOTR code, and noticed there's a LOTR_script.slc file in both the \Scenarios\War of the Ring\scen000x\default\gamedata and in the \ctp2_data\default\gamedata\ files, which one is actually used?
Another SLIC question, is there any function which can tell you whether you have recaptured a city? The city recapture event must use it but I can't find it in the Modification directory(or the event.slc file for that matter, I suspect its hard coded).
You can check the first player or civ to recapture any city by checking the recapture feat:
Code:HandleEvent(AccomplishFeat) 'counterfeatTrig' post { if (PlayerCivilization(player[0]) == CivilizationIndex("Russian") && FeatDB(FEAT_CITY_RECAPTURED)) { DisableTrigger('counterfeatTrig'); } }
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
-
Re: Re: Script.slc Question
Originally posted by Maquiladora
Look in gamefile.txt, if that exists in the scenario gamedata folder then that one is used I think. Otherwise it uses the one in the regular gamedata folder, which is modified by modswapper.
The city recapture feat?
If it was a city you previously held, I wanted to reduce the fine. This doesn't seem to be possible."
Comment
-
Re: Re: Re: Script.slc Question
Originally posted by EPW
I changed the city capture code in the WOTR scenario so you could pay gold to "cleanse" a city captured rather than raze it.
If it was a city you previously held, I wanted to reduce the fine. This doesn't seem to be possible.
Hopefully someone else will be able to help you. It might help to post the code too.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
-
Here's the code, modified from Martin's KillCityOption.slc:
Code:HandleEvent(CaptureCity) 'MG_NewKillCityOption' post { CCityCost = ((1000*city[0].population) + Random(1000)); if (city[0].population>1) { if(IsHumanPlayer(player[0])){ if(CityIsValid(city[0])) { if(CCityCost > PlayerGold(player[0])){ message(player[0], 'DestroyCityMSG'); city[0] = DestroyCity; } else{ message(player[0], 'SaveCityMSG2'); city[0] = DestroyCity; } } } } } AlertBox 'DestroyCityMSG' { int_t i; int_t MGPw; int_t MGCitySize; location_t MGCityLoc; unit_t MGUnit1; unit_t MGUnit2; location_t MGUnitLoc1; location_t MGUnitLoc2; city_t MGCity; int_t MG_OK1; int_t MG_OK2; int_t k; int_t m; army_t MGArmy; Title(ID_DESTROY_CITY_TITLE); Text(ID_DESTROY_CITY); //MessageType("MILITARY"); DestroyCity = city[0]; //player[5] = MG_COwner; Show(); Button(ID_BLOODBATH) { if(CityIsValid(city[0])) { AddGold(player[0], (city[0].population*25)); MGPw = player[0].publicworkslevel; MGPw = MGPw + (city[0].population*25); setPW(player[0], MGPw); ChangeGlobalRegard(player[0], -100, ID_BLOODBATH, 50); Deselect(); for (i=city[0].population; i>=0; i=i-1){ if(CityIsValid(city[0])) { Event: KillPop(city[0]); } } Kill(); } } } AlertBox 'SaveCityMSG2' { int_t i; int_t MGPw; int_t RandomDeath; Title(ID_SAVE_CITY_TITLE); Text(ID_SAVE_CITY2); //MessageType("MILITARY"); DestroyCity = city[0]; Show(); Button(ID_CLEANSE) { if(CityIsValid(city[0])) { AddGold(player[0], -(CCityCost)); RandomDeath = (city[0].population) - (Random((city[0].population) / 2)); for (i=city[0].population; i>=RandomDeath; i=i-1){ if(CityIsValid(city[0])) { Event: KillPop(city[0]); } } Kill(); } } Button(ID_BLOODBATH) { if(CityIsValid(city[0])) { AddGold(player[0], (city[0].population*25)); MGPw = player[0].publicworkslevel; MGPw = MGPw + (city[0].population*25); setPW(player[0], MGPw); ChangeGlobalRegard(player[0], -100, ID_BLOODBATH, 50); Deselect(); for (i=city[0].population; i>=0; i=i-1){ if(CityIsValid(city[0])) { Event: KillPop(city[0]); } } Kill(); } } }
"
Comment
-
Re: Re: Re: Script.slc Question
Originally posted by EPW
I changed the city capture code in the WOTR scenario so you could pay gold to "cleanse" a city captured rather than raze it.
If it was a city you previously held, I wanted to reduce the fine. This doesn't seem to be possible.
Still, in the former case, the code should be easy enough.
Hmm.
Ideally we want a list of player owned cities which is updated whenever we gain one. But, I'm not sure we can add a captured city to the list of cities after the KillCityOption fires and checks we owned it.
(please note, I haven't written slic for years, so my skills are rusty)
Code:city_t CitiesIHad[]; HandleEvent(BeginTurn) 'IW_countourcities' pre { int_t j; city_t tmpCity; if(IsHumanPlayer(player[0])){ for(j=0; j < PlayerCityCount(player[0]); j=j+1){ GetCitybyIndex(player[0],j, tmpCity); CitiesIHad[j] = tmpCity; } } DisableTrigger('IW_countourcities'); } HandleEvent(CaptureCity) 'IW_newcitycaptured' post { if(CityIsValid(city[0]) && IsHumanPlayer(player[0])){ CitiesIHad[CitiesIHad.#] = city[0]; } } HandleEvent(CreateCity) 'IW_newcityfounded' post { if(CityIsValid(city[0]) && IsHumanPlayer(player[0])){ CitiesIHad[CitiesIHad.#] = city[0]; } } HandleEvent(GiveCity) 'IW_mordorgaveyouacitywtf' post { if(CityIsValid(city[0]) && IsHumanPlayer(player[0])){ CitiesIHad[CitiesIHad.#] = city[0]; } } HandleEvent(ConvertCity) 'IW_newconvertedcity' post { if(CityIsValid(city[0]) && IsHumanPlayer(player[0])){ CitiesIHad[CitiesIHad.#] = city[0]; } }
(or if this doesn't work, I seem to recall maybe slic is loaded in backwards, then try including it before).
If neither of these works, then we can count cities the slightly slower way:
Code:city_t CitiesIHad[]; HandleEvent(BeginTurn) 'IW_counteveryturn' pre { if(IsHumanPlayer[player[0])){ for(j=0; j < PlayerCityCount(player[0]); j=j+1){ GetCitybyIndex(player[0],j, tmpCity); CitiesIHad[j] = tmpCity; } } }
And then whichever of the above works, just add a check to KillCityOption:
Code:// where you have this block: Button(ID_CLEANSE) { if(CityIsValid(city[0])) { int_t c; int_t hadit; hadit = 0; for(c=0; c < CitiesIHad.#; c=c+1){ if(city[0] == CitiesIHad[c]){ hadit = 1; } } if(hadit){ AddGold(player[0], -(CCityCost)/2); // or whatever } else { AddGold(player[0], -(CCityCost)); } RandomDeath = (city[0].population) - (Random((city[0].population) / 2)); for (i=city[0].population; i>=RandomDeath; i=i-1){ if(CityIsValid(city[0])) { Event: KillPop(city[0]); } } Kill(); } }
Um. So, that probably won't work, but it should be the gist of it.Last edited by Immortal Wombat; April 18, 2008, 03:45.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
Comment