Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site forums as they ran on Ultimate Bulletin Board, 1998–2001. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 2005 site & forums

  Apolyton Civilization Site Forums
  CtP2-Creation
  Need help making Barrack :-)

Post New Topic  Post A ReplyPost A Reply In A New Window

profile | register | preferences | faq | search next newest topic | next oldest topic bottom of page
Author
Topic:   Need help making Barrack :-) Format for Better Printing
magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 05, 2001 10:26   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Well, I think the game would be better if they have barrack. Anyone know how to make improve to do that.
Better yet, I would love to see a millitary base (title improve) that if a unit station there for a number of turn the unit become veteran. Hope someone know how to do it.
MrFun
Prince
United States, Iowa
Nov 2000
posted January 05, 2001 11:19   Click Here to See the Profile for MrFun   send a private message to MrFun Visit MrFun's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
It's simple to add a new building with the text files. Modify buildings.txt document under the Default folder/Gamedata folder, then add corresponding text in any document related with the Great Library.

The harder part is capturing and altering a graphic for the new building or creating an entirely new one.

jethro
Settler

Jan 2001
posted January 05, 2001 11:24   Click Here to See the Profile for jethro   send a private message to jethro
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
THERE IS WAY TO DO THAT,THOUGH IT WOULD REQUIERE SLIC FUNCTIONS,AS IS IN THE WW2 SCENERIO,IN THAT SCE ANY UNIT IN A GROUP A GERNERAL IS MADE A VETERAN AS LONG AS IT IS WITH THE GERNERAL.YOU COULD MAKE A SLIC FUNCTION THAT FLAGS THE UNIT AFTER X TURNS,THOUGH THAT WOULD PROBABLY REQUIER THE BARRACKS LOCATION,IN OTHER WORDS PROBABLY ONLY IN A SCENERIO.MIGHT BE A SIMPLER WAY,IN WW2 SLIC THE FILE SAYS IT MAKES THE UNIT A VETERAN FOR THE REST OF THE TURN,MAYBE CHANGE THAT TO 100 TURNS OR WHATEVER,AFTER ALL MOST UNITS BECOME OBSELETE BEFORE THAT ANYWAY.PLAY AROUND WITH THE SLIC AFTER THE TERRAIN IMPROVEMENT IS MADE.
magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 05, 2001 14:24   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Thanks for the advice. I never touch the SLIC before
may be I will give it a try. What about minefield? If
other player(or make it easy, everyone) unit move on it, will damage. Do you think that is possible?

I don't like the infantry unit that much, They should have
musket unit first then rifile unit. I am looking for a nice
pic for the infantry and create musket unit using the exsting infantry pic.

By the way, does anyone know where to get a nice modern unit pics?

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 06, 2001 08:48   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Both the barracks/military base and the minefield thing can be done through SLIC. For the Barracks you'll need the functions IsVeteran, ToggleBVeteran and CityHasBuilding. For a military base you'll need the veteran functions plus some annual counter-array and for the minefield you'll need DamageUnit (or is it called Damage? I'm not sure). The coding should be fairly straightforward.
[This message has been edited by Locutus (edited January 06, 2001).]
magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 06, 2001 10:43   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Locutus, thanks for the advice. May be you can help me
with this one. I seem to have problem with making button for the tileimp. Do you know anything about it
such as pic size, max color, background and where to put
it etc.
Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 06, 2001 12:53   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Well, I'm only a SLIC guy, don't harass my with questions like that, those only scare me

Seriously, I think the pic should go in the regular picture folder (default\graphics\pictures), it should be 16-bit tga. The background color should be pink or purple or whatever it's called (Red 255 Green 0 Blue 255), the size 40x30. Am I a graphics expert? No. Did I steal this info from the WWII scenario? Yes

Edit:
Is it actually possible to add custom tile improvements to the game? Currently not. It's not possible without being able to change the terrain graphics (those *.til files). Changing the buttons is easy enough, but currently there's no way to change graphics on the actual map.
[This message has been edited by Locutus (edited January 06, 2001).]

lago
King
King King King Ace
Nov 1999
posted January 06, 2001 13:16   Click Here to See the Profile for lago   send a private message to lagoSend a Message to UIN: 62602340
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

For the Barracks you'll need the functions IsVeteran, ToggleBVeteran and CityHasBuilding.

Locutus, where is the documentation (such as it is) on SLIC functions? Thanks.

Alpha Wolf
Prince
Chicago Illinois
Nov 2000
posted January 06, 2001 15:46   Click Here to See the Profile for Alpha WolfClick Here to Email Alpha Wolf  send a private message to Alpha Wolf Visit Alpha Wolf's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

Originally posted by lago on 01-06-2001 01:16 PM
Locutus, where is the documentation (such as it is) on SLIC functions? Thanks.

http://apolyton.net/ctp2/modification/

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

lago
King
King King King Ace
Nov 1999
posted January 06, 2001 17:14   Click Here to See the Profile for lago   send a private message to lagoSend a Message to UIN: 62602340
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
thank you thank you thank you

I've been wondering about this for weeks. Didn't look hard enough.

magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 07, 2001 04:37   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Locutus, well since you are a SLIC guy I have a question for you. I have add a barrack in the game using
fort icon and pic. I was trying to use SLIC from ww2 general. edit some to something like this

// Turns units near Barrack into Veteran and all other units non Veteran
void_f VeteranEffect ()
{
int_t y;
int_t j;
unit_t tmpUnit;
int_t tmpNum;
int_t numUnits;
int_t tmpPlayer;

for (y = 1; y < 5; y = y + 1) {
if (IsPlayerAlive(y)) {
player[0] = y;
tmpPlayer = player[0];
numUnits = player[0].units;
}
}

// Make all Units veterans who share the location of the Generals
if (barrack.valid) {
tmpNum = GetUnitsAtLocation(barrack.location);
for (y = 0; y < tmpNum; y = y + 1) {
GetUnitFromCell(barrack.location, y, tmpUnit);
ToggleVeteran(tmpUnit, 10);
}
}

}

I am new to SLIC, I hope you can help with the barrack slic so we can use it.

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 07, 2001 08:37   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
magma,
I'm not sure what you're trying to do here, but let me give you some exaple code. Below is how the barrack code could look like in the classic Civ1/2 way: every new unit built in a city is a veteran when a barrack is present. I get the feeling you may be looking for something different though, so if that is the case, let me know what you *are* looking for and I'll see what I can do. Note that following is untested and may contain a few typos or bugs, but the basic idea *should* work.

code:

HandleEvent(CreateUnit) 'BarrackCode' post { // if a unit is created
int_t tmpUnit;
city_t tmpCity;
tmpUnit = unit[0]; // store the unit that was just built
tmpCity= city[0]; // store the city in which it was built

if (CityIsValid(tmpCity)) { // if city exits (unit didn't come from ruin or whatever)
if (CityHasBuilding(tmpCity, BuildingDB(IMPROVE_BARRACK)) { // if city has a barrack
ToggleVeteran(tmpUnit, 1); // make unit a veteran;
}
}
}


magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 07, 2001 11:24   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
My apologics Locutus, I was trying to make a Barrack (Milliatry Base) as a tile imp. The concept is, if unit station there for a period of time (trainning) it will get a vetran status. No expire. But thank for the code you gave
it will work too If you like the concept please help.
Alpha Wolf
Prince
Chicago Illinois
Nov 2000
posted January 07, 2001 12:34   Click Here to See the Profile for Alpha WolfClick Here to Email Alpha Wolf  send a private message to Alpha Wolf Visit Alpha Wolf's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
I definitely want to try this specific code. I was looking for something like that earlier myself. I've always suspected that barbarians are all vets because all things being equal, they tend to kick my butt.

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

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 07, 2001 15:51   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
LS: if this thread looks like ****, it's because HTML and SLIC don't go well together. I'll try to fix it a bit but I can't garantuee to keep the code intact and still keep the thread look good.

Oh, ok, now I get it. A military base is more complicated: you'll have to keep track of how long a unit has been there and you'll need to track down the actual bases themselves as well. I intended to write you some example code on how to do it but ended up writing all code
This will make units train for 6 turns before they turn veteran, assuming they are in their own base and they go to sleep there (since there's no 'train' command). It's not possible with this code to train 3 turns, do something else, and train 3 turns again, you have to train 6 consequetive(sp?) turns. That would make the code even more complicated and someone else may figure out how to do that (hint: requires keeping track of all non-veteran units, not just the ones sleeping in bases). Same disclaimer as usual: not tested, might be buggy.

code:

location_t militaryBaseLocs[]; // array that stores all bases in game
int_t militaryBaseOwners[]; // array that stores all owners of bases
int_t miitaryBaseIndex; // value that stores how many bases exist/at what index new bases are added
unit_t trainingUnits[]; // array that stores all training units
int_t trainingTimes[]; // array that stores how long these units have been training
int_t trainingIndex; // value that stores how many units are training/at what index new units are added

HandleEvent(ImprovementComplete) 'MilitaryBaseBuilt' post { // triggers if a tile improvement is built
location_t tmpLoc;
int_t tmpPlayer;
int_t tmpValue;
tmpValue = value[0]; // might have to be value[1], not sure; stores type of improvement
tmpPlayer = player[0]; // stores owner of improvement
tmpLoc = location[0]; // stores location of improvement

if (tmpValue == TerrainImprovementDB(TILEIMP_MILITARY_BASE)) { // check if type of improvement is military base
militaryBaseLocs[miitaryBaseIndex] = tmpLoc; // store base
militaryBaseOwners[militaryBaseIndex] = tmpPlayer; // store owner
militaryBaseIndex = militaryBaseIndex + 1; // now one more base exists
}
}

HandleEvent(CutImprovements) 'MilitaryBasePillaged' post { // triggers if a tile improvement is pillaged
location_t tmpLoc;
int_t i;
int_t j;
tmpLoc = location[0]; // get location of pillage

i = 0;
while (i < militaryBaseIndex) { // cycle through all military bases
if (militaryBaseLocs[i] == tmpLoc) { // if the location of this base is same as pillage-location
for (j = i; j < (militaryBaseIndex - 1); j = j + 1) { // go through all remaining bases except the last one
militaryBaseLocs[j] = militaryBaseLocs[j + 1]; // put next base at the position of the current base
militaryBaseOwners[j] = militaryBaseOwners[j + 1]; // do the same for the owners
} // the above two lines overwrite the pillaged base and move all other bases forward in the array
militaryBaseIndex = militaryBaseIndex - 1; // there's now one less base
i = militaryBaseIndex + 1; // base is found, no need to look further
} else { // if this is not the same location as the pillage location
i = i + 1; // look at the next base
}
}
}

HandleEvent(SleepUnit) 'UnitTrains' post { // triggers if a unit goes to sleep
int_t i;
unit_t tmpUnit;
tmpUnit = unit[0]; // store unit

i = 0;
while (i < militaryBaseIndex) { // cycle through all military bases
if (militaryBaseLocs[i] == tmpUnit.location) { // if location of base is same location of that of sleeping unit
if (militaryBaseOwners[i] == tmpUnit.owner) { // check if unit is in his own base
if (IsVeteran(tmpUnit)) { // if unit isn't already veteran
trainingUnits[trainingIndex] = tmpUnit; // train this unit
trainingTimes[trainingIndex] = 5; // it takes 6 turns to train a unit
} // (countdown from 5 to 0, so 6 turns)
trainingIndex = trainingIndex + 1; // one more unit training
i = militaryBaseIndex + 1; // no need to look further, so end cycling through bases
} else { // if locations are different
i = i + 1; // look at next base
}
} else {
i = i + 1;
}
}
}

HandleEvent(WakeUnit) 'UnitStopsTraining' post { // triggers if a units wakes up
int_t i;
int_t j;
unit_t tmpUnit;
tmpUnit = unit[0]; // store unit

i = 0;
while (i < militaryBaseIndex) { // cycle through all military bases
if (militaryBaseLocs[i] == tmpUnit.location) { // if location of base is same location of that of sleeping unit
if (militaryBaseOwners[i] == tmpUnit.owner) { // check if unit is in his own base
j = 0;
while (j < trainingUnitsIndex) { // go through all training units
if (tmpUnit == trainingUnits[j]) { // if this is the unit
for (k = j; k < trainingIndex; k = k + 1) {
trainingUnits[k] = trainingUnits[k + 1];
trainingTimes[k] = trainingTimes[k + 1];
}
trainingIndex = trainingIndex - 1; // one less unit training
j = trainingIndex + 1;
i = militaryBaseIndex + 1;
} else {
j = j + 1; // no need to look further
}
}
} else { // if locations are different
i = i + 1; // look at next base
}
} else {
i = i + 1;
}
}
}

HandleEvent(BeginTurn) 'TrainingUnitsAnnual' post { // trigger when a new turn begins for any of the players
int_t i;

if (player[0] == 0) { // if player is barbarian, this should happen once a year, not x times a year (where x is # of players in the game)
i = 0;
while (i < trainingIndex) { // cycle through all players
if (trainingTimes[i] != 0) { // unless training is completed
trainingTimes[i] = trainingTimes[i] - 1; // one year of training completed
} else { // if training is completed
ToggleVeteran(trainingUnits[i], 1); // make unit veteran
for (j = i; j < trainingIndex; j = j + 1) { // go through all remaining units
trainingUnits[j] = trainingUnits[j + 1]; // put next unit at the position of the current one
trainingTimes[j] = trainingTimes[j + 1]; // put next time at the position of the current one
}
trainingIndex = trainingIndex - 1; // one less unit training
}
i = i + 1; // look at next unit
}
}
}



[This message has been edited by Locutus (edited January 07, 2001).]
[This message has been edited by Locutus (edited January 07, 2001).]
magma12
Settler
Bangkok, Thailand
Nov 2000
posted January 09, 2001 03:48   Click Here to See the Profile for magma12   send a private message to magma12
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Thanks for the code. Hope other will include it in their mod pack.
Alpha Wolf
Prince
Chicago Illinois
Nov 2000
posted January 16, 2001 01:07   Click Here to See the Profile for Alpha WolfClick Here to Email Alpha Wolf  send a private message to Alpha Wolf Visit Alpha Wolf's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
quote:

Originally posted by Locutus on 01-07-2001 08:37 AM
magma,
I'm not sure what you're trying to do here, but let me give you some exaple code. Below is how the barrack code could look like in the classic Civ1/2 way: every new unit built in a city is a veteran when a barrack is present. I get the feeling you may be looking for something different though, so if that is the case, let me know what you *are* looking for and I'll see what I can do. Note that following is untested and may contain a few typos or bugs, but the basic idea *should* work.

code:

HandleEvent(CreateUnit) 'BarrackCode' post { // if a unit is created
int_t tmpUnit;
city_t tmpCity;
tmpUnit = unit[0]; // store the unit that was just built
tmpCity= city[0]; // store the city in which it was built

if (CityIsValid(tmpCity)) { // if city exits (unit didn't come from ruin or whatever)
if (CityHasBuilding(tmpCity, BuildingDB(IMPROVE_BARRACK)) { // if city has a barrack
ToggleVeteran(tmpUnit, 1); // make unit a veteran;
}
}
}



OK, i just dont get it. I used this code, which seemed to make sense to me, but it wont work. I even fixed the missing ")" on the CityHasBuilding line. I built the barracks in my town, but the new units created dont appear to be vets (no little flag by unit). Or do they only get the vet flag after a battle? I put the code in the scenario.slc file. Also tried it in script.slc. What am i doing wrong?

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

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 17, 2001 05:46   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Odd, I did make another mistake, but I thought that doing that should give an error message, guess I was wrong. Anyway, try replacing BuildingDB(IMPROVE_BARRACK) with "IMPROVE_BARRACK". It's an old CtP1 function and requires the old CtP1 syntax, I forgot about that.
Alpha Wolf
Prince
Chicago Illinois
Nov 2000
posted January 17, 2001 13:34   Click Here to See the Profile for Alpha WolfClick Here to Email Alpha Wolf  send a private message to Alpha Wolf Visit Alpha Wolf's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Thanks. Will try it tonight.

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

Alpha Wolf
Prince
Chicago Illinois
Nov 2000
posted January 17, 2001 22:55   Click Here to See the Profile for Alpha WolfClick Here to Email Alpha Wolf  send a private message to Alpha Wolf Visit Alpha Wolf's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
no luck. it didnt work. again i'm assuming that the flag will show up upon creation and not only after battles.

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

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted January 18, 2001 08:02   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Hmm, very odd. I'll need to look into this more closely when I have the time (which will be a while). It can't be that combat is needed because it works fine in the Alexander scenario, all units stacked with Alex get vet-status, combat experience or not.

One alternative (I have no idea if this will work but it's worth a try) might be to kill the unit immideately when it's created and create a new one of the same type and give that one veteran status, which would look something like this:

(replace "ToggleVeteran(tmpUnit, 1);" with this)

code:

// if city has barrack {
tmpType = value[0]; // I think this returns the unittype, but maybe it's value[1]
tmpLoc = tmpCity.location;
tmpOwner = tmpCity.owner;
Event:KillUnit(tmpUnit);
CreateUnit(tmpOwner, tmpType, tmpLoc, 0, tmpUnit);
ToggleVeteran(tmpUnit, 1);

Apolyton Civilization Site Forums
> > > CtP2-Creation Forum

next newest topic | next oldest topictop of page

All times are EDT

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A ReplyPost A Reply In A New Window
Hop to:

Contact Us
Apolyton Civilization Site

Powered by: Ultimate Bulletin Board, Version 5.44a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.

Front Page | Civilization III | Dinosaurs | Civilization II | Call to Power | Call to Power II | Alpha Centauri | Alternative Civs | Misc | Links | About ACS | GameStats
GameLeague | Scenario League | HAC | Civilization Scenario Collection | Spanish CivII Site | Clash of Civs | CtP Maps | Art of War | WesW's Ctp1/2 Site