 |
|
magma12
|
|
Bangkok, Thailand
Nov 2000 time: 05:14
|
|
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.
|
|
|  |
 |
|
jethro
|
|
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
|
|
Bangkok, Thailand
Nov 2000 time: 05:14
|
|
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?
|
|
|  |
 |
|
magma12
|
|
Bangkok, Thailand
Nov 2000 time: 05:14
|
|
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.
|
|
|  |
 |
|
|
thank you thank you thank you
I've been wondering about this for weeks. Didn't look hard enough.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:14
|
|
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
|
|
Bangkok, Thailand
Nov 2000 time: 05:14
|
|
Thanks for the code. Hope other will include it in their mod pack.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
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.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
Thanks. Will try it tonight.
------------------
History is written by the victor.
|
|
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:14
|
|
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);
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:14. Apolyton Time is 00:14. |
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
|
|
|
|
|
|