August 9, 2002, 19:39
|
#1
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Great Britain
Posts: 684
|
Babarian Encampments SLIC idea
I was just wondering weather or not it would be possible for the barbarians to have encampments as in civ3 (as much as i hate that game, it does have some *few* good points)
These encampments would only appear outside a civilizations boarders (to the best of my knowledge babarians only appear outside the boarders anyway unless from hut) and would at a pretty slow rate create fairly crap babarian units with one unit always in it defending and the others built sent out to explore or whatever.
if u attacked the encampment and succeseded then there would be a small reward as in gold or whatever and it would simply disappear off the map (as in a destroyed city) and another one would randomly appear somewhere else.
If this randomly appearing wouldnt work, would it be possible to do the same only have the encampments randomly layed at the start (or a settler like unit that built these encampments at the start but was invisible) OR settler units that randomly appear through the game that build them ?
I would like to think it would somehow be possible
SMIFFGIG
|
|
|
|
August 9, 2002, 20:04
|
#2
|
King
Local Time: 22:49
Local Date: October 31, 2010
Join Date: Jul 2002
Location: Berkeley
Posts: 1,375
|
not a bad idea im for it
|
|
|
|
August 10, 2002, 00:23
|
#3
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Here it is a code i have just made. For a better graphic i suggest a new city style has to be created for barbarians. Any grphic suggestion?
This code creates a camp (city) in the unit location with the same size of the stack when the barabrians ends its turn.
When the unit moves the the citys is killed.
So far no bonus for the player who kills the camp.
Code:
|
HandleEvent(EndTurn) 'CreateBarbarianCamp' pre { // When the player turn ends
int_t i;
if(player[0] == 0) { //if player is barbarian
for(i=o; i <= player[0].armies; i = i + 1) {
GetArmyByIndex(player[0], i, army[0]); // In all its armies
CreateCity(0,army[0].location, 0, city[0]); // create a city in its location
if(CityIsValid(city[0])) { // if city was created
value[0] = GetUnitsAtLocation (army[0].location);
value[1] = value[0] - 1; // The number of units
AddPops(city[0], value[1]); // becomes the size of the city
}
}
}
}
HandleEvent(MoveUnits) 'KillBarbarianCamp' pre { // When a army moves
int_t i;
player[0] = army[0].owner; // check army player owner
if(player[0] == 0) { // if player is barbarian
location[0] = army[0].location; // Get its location
GetCityByLocation(location[0], city[0]); // and check if there is a city
if(CityIsValid(city[0])) { // If there is
for (i = 0; i <= city[0].population; i=i+1){ //
Event: KillPop(city[0]); // Kill City
}
}
}
} |
PS: not tested so it may contain bugs. I am waiting your word if it worked or not  .
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Last edited by Pedrunn; August 10, 2002 at 06:00.
|
|
|
|
August 10, 2002, 13:39
|
#4
|
Prince
Local Time: 05:49
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
|
There's a small typo in line 4. It should say i=0 instead of i=o.
I tried the code in a saved game where there were lots of barbarians about, but the code had no effect. It's still a great idea though!
|
|
|
|
August 11, 2002, 09:04
|
#5
|
Super Moderator
Local Time: 07:49
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Pedrunn
Here it is a code i have just made. For a better graphic i suggest a new city style has to be created for barbarians. Any grphic suggestion?
|
Of course Civ3 even if the graphics of this game don't have the high quality of CTP2 graphics (8bit Civ3 in comparision 16bit CTP2)
Quote:
|
Originally posted by Pedrunn
This code creates a camp (city) in the unit location with the same size of the stack when the barabrians ends its turn.
When the unit moves the the citys is killed.
So far no bonus for the player who kills the camp.
|
Actual I would prefer a tile improvement. One of the fort like it would have a different border radius, you could use some slic code create at this loacation randomly units. And finally no city name would be displayed.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 11, 2002, 23:04
|
#6
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Martin Gühmann
Actual I would prefer a tile improvement. One of the fort like it would have a different border radius, you could use some slic code create at this loacation randomly units. And finally no city name would be displayed.
|
Tile imps were my first thougth but i did not want the units to appear over the hut. But there is also the problem of conserving the borders of the civ what makes the city idea only workable in unclaimed terrain.
I also thaught in addind a city-like unit to the army. but i dont know how to make it be the unit of the army to appear in the map
I guess we may have to stick to the Tile Imp idea.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 12, 2002, 14:19
|
#7
|
Prince
Local Time: 05:49
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
|
Does anyone have any idea why this code would not have an effect in the game? When I included it in the script.txt, it informed me about the typo, so I know that the game "read" the code, but it did not "excute" it.
|
|
|
|
August 12, 2002, 17:14
|
#8
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Try adding this line under the line int_t i; of the EndTurn event.
Code:
|
player[0] = g.player; |
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 12, 2002, 17:53
|
#9
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Try using "beginturn" instead of "endturn" - maybe CreateCity handlers can only fire on the turn of the player whose city it is?
__________________
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
|
|
|
|
August 12, 2002, 19:42
|
#10
|
King
Local Time: 05:49
Local Date: November 1, 2010
Join Date: Jan 2000
Location: Gone Fishin, Canada
Posts: 1,059
|
ahenobarb,
You should have got some 'wrong type of argument' errors because you can't use functions like GetArmyByIndex(int , int, armyVar) and GetCityByLocation(location, cityVar) with BuiltIn army or city variables: they must be user defined variables like 'tmpArmy' and 'tmpCity'. Make sure you've got DebugSlic=yes.
|
|
|
|
August 13, 2002, 18:30
|
#11
|
Prince
Local Time: 05:49
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
|
It looks like I am birthing Pedrunn's calf, but here is the revised code generated from the comments everyone included here. BTW, Immortal Wombat, I used your suggestion and changed EndTurn to BeginTurn and back again, but it still didn't do anything.
HandleEvent(EndTurn) 'CreateBarbarianCamp' pre { // When the player turn ends
int_t i;
army_t tmpArmy;
city_t tmpCity;
player[0] = g.player;
if(player[0] == 0) { //if player is barbarian
for(i=0; i <= player[0].armies; i = i + 1) {
GetArmyByIndex(player[0], i, tmpArmy); // In all its armies
CreateCity(0,tmpArmy.location, 0, tmpCity); // create a city in its location
if(CityIsValid(tmpCity)) { // if city was created
value[0] = GetUnitsAtLocation (tmpArmy.location);
value[1] = value[0] - 1; // The number of units
AddPops(city[0], value[1]); // becomes the size of the city
}
}
}
}
HandleEvent(MoveUnits) 'KillBarbarianCamp' pre { // When a army moves
int_t i;
army_t tmpArmy;
city_t tmpCity;
player[0] = g.player; // check army player owner
if(player[0] == 0) { // if player is barbarian
location[0] = tmpArmy.location; // Get its location
GetCityByLocation(location[0], tmpCity); // and check if there is a city
if(CityIsValid(tmpCity)) { // If there is
for (i = 0; i <= tmpCity.population; i=i+1){ //
Event: KillPop(tmpCity); // Kill City
}
}
}
}
I was looking over Pedrunn's other code regarding religion that he is working on with mapfi and others (you know the thread  ) and he said he has concerns about the CreateCity function, which is also used here. perhaps it's the culprit?
|
|
|
|
August 13, 2002, 19:37
|
#12
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Great Britain
Posts: 684
|
Hey, nice lot of replies here hope it can be implemented
for the graphics i was thinking of the village one thats used in the samuari scenario, i think that looks perfect from what i can remember
|
|
|
|
August 13, 2002, 19:52
|
#13
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Try this one. I think it will work now.
Note: The part with // is to prevent the barbs to. mess up borders by creating city over them. If works with them. try without them.
Note2: I changed the MoveUnit event for BeginTurn. This mean that all barbarian cities are going to be destroyed every turn. This makes more sense since barbarians are supposed to be nomads.
Code:
|
HandleEvent(EndTurn) 'CreateBarbarianCamp' pre { // When the player turn ends
int_t i;
int_t tmpPlayer;
int_t ArmyCount;
int_t CitySize;
army_t tmpArmy;
city_t tmpCity;
location_t tmpLoc;
player[0] = g.player;
if(player[0] == 0) {
ArmyCount = player[0].armies;
for(i=0; i <= ArmyCount; i = i + 1) {
tmpPlayer = player[0];
GetArmyByIndex(tmpPlayer, i, tmpArmy); // In all its armies
tmpLoc = tmpArmy.location;
// if(CellOwner(tmpLoc) == -1) { // if unit is in unclaimed land
CreateCity(0, tmpLoc, 0, tmpCity); // create a city in its location
if(CityIsValid(tmpCity)) { // if city was created
CitySize = GetUnitsAtLocation (tmpLoc) - 1; // The number of units
AddPops(tmpCity, CitySize); // becomes the size of the city
}
// }
}
}
}
HandleEvent(BeginTurn) 'KillBarbarianCamp' pre {
int_t i;
int_t tmpPlayer;
int_t CityCount;
int_t CitySize;
city_t tmpCity;
tmpPlayer = g.player;
if(tmpPlayer == 0) {
CityCount = PlayerCityCount(tmpPlayer);
for(i=0; i <= CityCount; i = i + 1) {
GetCityByIndex(tmpPlayer, i, tmpCity);
city[0] = tmpCity;
if(CityIsValid(city[0])) {
for (i = 0; i <= city[0].population; i=i+1) {
if(CityIsValid(city[0])) {
Event: KillPop(city[0]);
}
}
}
}
}
} |
EDIT: Found a typo.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Last edited by Pedrunn; August 13, 2002 at 22:59.
|
|
|
|
August 17, 2002, 10:05
|
#14
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Great Britain
Posts: 684
|
Hey great, i hope this does work, i havent actually tested it as i dont know how
the thing is, im not sure if it is a good idea to have the barb encampments destroyed every turn,
1. Cause the only way ull be able to kill the encampment if u manage to find one by luck, otherwise ull probably never get to kill one as it would have disappeared by the time u get there
2. This would mean they would not be able to build units out of the encampment as it would disappear
3. Gets rid of the need to try and kill them as they will never be any threat
I understand what ur saying about them being nomads but i would say that if u do want them to disappear it should definitly be way more turns than 1 at least as much for them to be able to build one unit out of them, also i was thinking how about using the militia code so there is always one unit in the encampment (as in Civ3)
Personly i dont think that they should dissapear and reappear at all
|
|
|
|
August 17, 2002, 10:06
|
#15
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Great Britain
Posts: 684
|
Correction
I do want them to reappear just not dissappear
|
|
|
|
August 17, 2002, 10:43
|
#16
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Quote:
|
Hey great, i hope this does work, i havent actually tested it as i dont know how
|
Copy and paste the code into scenario.slc
__________________
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
|
|
|
|
August 17, 2002, 11:03
|
#17
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Actually i have a improved version of this code already. Yet not tested too wich only the camps get destroyed and not the captured cities too.
The camp only is destroyed in the beginning of the barbarian turn. It is like: Start Barbarian turn -> Destroy All Camps -> Barbarians move units -> End Barbarian Turn - Create Camps where there are barbarians units -> the non-barbs civs start their turns -> the non-barb civs dont see any barb units in the map just camps -> End non-Barb Civ turn -> Begin Barbarians turn - Kill all camps -> Barbarians units moves -> End barbarian Turn -> Create Camps where there is a barb unit.
I will test it today since no one did it until now. But if you can please do. I am a bit busy with city expansion code.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 18, 2002, 10:30
|
#18
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
I had to choose between slic work or my girlfriend, yesterday  .
Sorry guys  .
Probably i wont have time today too  . Maybe tomorrow.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 26, 2002, 12:37
|
#19
|
Prince
Local Time: 05:49
Local Date: November 1, 2010
Join Date: Nov 2001
Posts: 437
|
I'm guessing you got the same results I did: it still didn't do anything.
Has anyone confirmed that CreateCity works as advertised? For that matter does ImprovementComplete?
|
|
|
|
August 26, 2002, 12:50
|
#20
|
Super Moderator
Local Time: 07:49
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
All the events with these GEA_ arguments can't be triggered in slic.  You can only trigger event handler by this event unfortunatly I get error index of bounce errors if I use this event to trigger my code and try to use a build in array with DebugSlic=Yes. If it is just saved in a user defined variable no problem, but if you try to use this variable no change. So you have to use the CreateImprovement event and have to trigger an event handler by this event that will execute the FinishImprovements function.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 26, 2002, 12:53
|
#21
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
I fee such a jerk. I have finished this code but isntead of cities it is created Tile Improvements.
Add this in any .slc file of the mod you want to use it.
Code:
|
//////////////////////////////////////////////////////////////////////////
// 5) Barbarian Camp
// by Pedrunn
//////////////////////////////////////////////////////////////////////////
int_t CampPlacement;
HandleEvent(EndTurn) 'CreateBarbarianCamp' pre { // When the player turn ends
int_t i;
int_t tmpPlayer;
int_t ArmyCount;
int_t CitySize;
army_t tmpArmy;
location_t tmpLoc;
player[0] = g.player;
if(player[0] == 0) {
ArmyCount = player[0].armies;
for(i=0; i <= ArmyCount; i = i + 1) {
GetArmyByIndex(0, i, tmpArmy); // In all its armies
tmpLoc = tmpArmy.location;
if(CellOwner(tmpLoc) == -1) { // if unit is in unclaimed land
CampPlacement = 1;
GrantAdvance(0, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
Event:CreateImprovement(0, tmpLoc, TerrainImprovementDB(TILEIMP_BARBARIAN_CAMP), 0);
}
else{
tmpPlayer = CellOwner(tmpLoc);
CampPlacement = 1;
GrantAdvance(tmpPlayer, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
Event:CreateImprovement(tmpPlayer, tmpLoc, TerrainImprovementDB(TILEIMP_BARBARIAN_CAMP), 0);
}
}
}
}
HandleEvent(CreateImprovement) 'BarbsCantHaveSubneuralAds' post {
if(CampPlacement == 1) {
CampPlacement = 0;
FinishImprovements(location[0]);
if (HasAdvance(player[0], ID_ADVANCE_SUBNEURAL_ADS)) {
RemoveAdvance(player[0], AdvanceDB(ADVANCE_SUBNEURAL_ADS));
}
}
}
HandleEvent(BeginTurn) 'DestroyBarbarianCamp' pre {
int_t i;
int_t j;
location_t tmpLoc;
player[0] = g.player;
if(player[0] == 0) {
for (i=0; i<=GetMapWidth()-1; i=i+1) {
for (j=0; j<=GetMapHeight()-1 ; j=j+1) {
MakeLocation(tmpLoc, i, j);
if(TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_BARBARIAN_CAMP))) {
Event: CutImprovements(tmpLoc);
}
}
}
}
}
HandleEvent(BattleAftermath) 'Destroy2BarbarianCamp' pre {
if(TileHasImprovement(location[0], TerrainImprovementDB(TILEIMP_BARBARIAN_CAMP))){
Event:CutImprovements(location[0]);
}
} |
and this in the bottom of the *_tileimp.txt of the same mod you want to use.
Code:
|
############################################################
TILEIMP_BARBARIAN_CAMP {
Icon ICON_TILEIMP_FORTIFICATIONS
Tooltip TOOLTIP_TILEIMP_SELECT_FORT_BUTTON
Statusbar STATUSBAR_TILEIMP_SELECT_FORT_BUTTON
Level 4
Class:Structure1
ConstructionTiles 1
CantBuildOn TERRAIN_WATER_BEACH
CantBuildOn TERRAIN_WATER_DEEP
CantBuildOn TERRAIN_WATER_RIFT
CantBuildOn TERRAIN_WATER_SHALLOW
CantBuildOn TERRAIN_WATER_SHELF
CantBuildOn TERRAIN_WATER_TRENCH
CantBuildOn TERRAIN_WATER_VOLCANO
TerrainEffect {
Terrain TERRAIN_BROWN_HILL
Terrain TERRAIN_BROWN_MOUNTAIN
Terrain TERRAIN_DESERT
Terrain TERRAIN_FOREST
Terrain TERRAIN_GLACIER
Terrain TERRAIN_GRASSLAND
Terrain TERRAIN_HILL
Terrain TERRAIN_JUNGLE
Terrain TERRAIN_MOUNTAIN
Terrain TERRAIN_PLAINS
Terrain TERRAIN_SWAMP
Terrain TERRAIN_TUNDRA
Terrain TERRAIN_WHITE_HILL
Terrain TERRAIN_WHITE_MOUNTAIN
DefenseBonus 0.5
EnableAdvance ADVANCE_SUBNEURAL_ADS
ProductionCost 0
ProductionTime 1
TilesetIndex 695
}
} |
You must have the Apolyton Tile File.
(* stands for the prefix of the mod and you will find these files to be changed in the
CTP2 base director/ctp2_data/default/gamedata).
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 26, 2002, 20:24
|
#22
|
Prince
Local Time: 06:49
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
aha, I thought I saw an extra one hiding at the end
__________________
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
|
|
|
|
August 27, 2002, 00:57
|
#23
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 27, 2002, 20:10
|
#24
|
Emperor
Local Time: 15:49
Local Date: November 1, 2010
Join Date: Dec 2000
Posts: 3,944
|
Pedrunn:
Just wanted to let you know that I can quite happily confirm that CreateCity() & CreateCoastalCity() work absolutely perfectly.  There's nothing wrong with the call, just how you used the args. You've got the right amount of args, but not the right ones.
CreateCity(player, location, distance[, holder]);
Where:
- player cannot be in the form: g.player, player[0].
- location cannot be an array element: army.location, city.location.
- distance is taken to me "somewhere between zero and X squares away".
- holder is not necessary, only if you want to do more with the city. Must be in form city_t.
- A city will not create within another city's radius. It puts it close to the location then.
Copy and paste the following code into scenario.slc, and start an original game. You should get a new city every couple of turns.
Code:
|
// Example CreateCity() & CreateCoastalCity() functions
HandleEvent(BeginTurn) 'CreateCityTest' pre {
city_t tmpCity;
location_t tmpLoc;
int_t tmpPlayer;
int_t tmpDistance;
int_t tmpCounter;
city_t tmpCity;
tmpDistance = 5; // This is the distance from loc to build city
tmpPlayer = g.player; // Current player
if(IsHumanPlayer(tmpPlayer)) { // Only do for human
tmpCounter = random(4); // <1 = CreateCity, >=3 = CoastalCity
if(GetCityByIndex(tmpPlayer, 0, tmpCity)) {
tmpLoc = tmpCity.location;
if(tmpCounter < 1) {
if(!(CreateCity(tmpPlayer, tmpLoc, tmpDistance)) { // Create the actual city. You don't need a settler for this.
return STOP; // Error creating city
}
}
if(tmpCounter >= 3) { // Create coastal city
if(!(CreateCoastalCity(tmpPlayer, tmpLoc, tmpDistance)) { // Create the actual city. You don't need a settler for this.
return STOP; // Error creating city
}
}
}
} |
|
|
|
|
August 28, 2002, 13:06
|
#25
|
King
Local Time: 02:49
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Thanks Dale. Thats som very imporant info. I did not tested my code with the CreateCity event But I will keep the code as TI (the last one) since there is TI has the advantages of being created inside another civilization borders without messing up the borders.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
Posting 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
|
|
|
All times are GMT -4. The time now is 01:49.
|
|