 |
|  |
 |
|
Martock
|
 |
Greenville, SC USA
Apr 1999 time: 00:14
|
|
i've been playing with the game now for several weeks and have been wondering if the barbarians can be more of a hidden nuisance than an invading army type. i had mentioned in a previous post that i'd like to see the barbarians lose the use of military (offensive) units and switch over to the stealth units later in the game. playing around with the risks.txt only allows me to lengthen their stay in the game and allow them to use more powerful units like tanks, etc. what i'm looking to see is can they instead be allowed to use spies (i'd like to have them damage units and blow up specific buildings), infectors, eco-terrorist type (basically the assassinate ability), and lastly, the park ranger (using a nuke instead of the actual flower power bomb).
i think that barbarians should not only represent raiders and barbarians in the old days but also the terrorists of our times. hence in the modern years of the game instead of seeing barbarian tanks and marines i'd like to deal with a rogue infector prancing about in my back yard. i imagine this will have to have some sort of SLIC coding done to trigger the change in era for the barbarian units. i do know that the barbarian AI will use an infector if it finds cities on it's continent that range 20+ population. can i change that so it will infect everything in site until it either gets caught or dies in the attempt?...i hope so. i did try to get the AI to use an eco-ranger(i think this is the blue bike thingy) unit but that didn't produce anything...darn unit just stayed in place the entire time.
so the basic question here is:
1) is it possible to make the barbarian use stealth units later in the game instead of military offensive ones?
2) if so, can the barbarian AI use some specific abilities (IE: infect, assassinate, nuke, etc...) per unit?
3) given that it costs $ to use these abilites, can the barbarian AI have this restriction removed?? as i know from experience giving it money will only allow it to build oodles of hoplites and other useless units.
any sort of help in this area would be GREATLY appreciated!! 
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
I've increased the abilities of barbarians so they are always taking someones city so I assume that they'd have gold built up to pay for special attacks. I also made a seperate barbarian build list that the barabarian will start out with foot units, move up to mounted units as they become available then finally into the specialists later. I havent gotten to the point tech wise that the specialists will come into play but the game hasnt blown up, so conceptually it should work when I get to that point.
------------------
History is written by the victor.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
Actually, i never thought of having some new units limited to a new barbarian type of gov but thats a great idea. The way the AI builds units is based off build queues. Once the go beyond a unit, I havent seen them go back to build obsolete units.
------------------
History is written by the victor.
|
|
|  |
 |
|
Radical_Manuvr
|
|
Maryland, USA
Dec 2000 time: 05:14
|
|
I'm sure you can have barbarian stealth units appear either at random or on certain pre-assigned turns. Whether they actually use them or not is another matter. I think it's risks.txt or maybe const.txt that has last barbarian turn at 350. Once you have the SLIC done, you could either modify that # to suit your needs and have barbarian stealths appear after that or have both military and stealth units through the whole or part of the game. I have code for random barbarians that could quickly be modified to give stealths. The problem is you would probably want them to appear near a random city and I don't have that coded already.
// Spawns a random number and type of barbarian units at a location within a certain distance
void_f SpawnResist (location_t tmpLoc, int_t tmpDist)
{
int_t tmpRand;
int_t tmpRand2;
int_t i;
tmpRand = Random(5) + 3; // Spawn between 3 and 8 units ???? might be 2 and 7, not sure
for(i = 0; i < tmpRand; i = i + 1) {
tmpRand2 = Random(5); // 1/6 chance of each type unit
if (tmpRand2 == 0) {
CreateUnit(0, UnitDB(UNIT_ANTIAIR), tmpLoc, tmpDist);
} elseif (tmpRand2 == 1) {
CreateUnit(0, UnitDB(UNIT_GERMAN_BOMBER), tmpLoc, tmpDist);
} elseif (tmpRand2 == 2) {
CreateUnit(0, UnitDB(UNIT_GERMAN_FIGHTER), tmpLoc, tmpDist);
} elseif (tmpRand2 == 3) {
CreateUnit(0, UnitDB(UNIT_GERMAN_TANK), tmpLoc, tmpDist);
} elseif (tmpRand2 == 4) {
CreateUnit(0, UnitDB(UNIT_GERMAN_TANK2), tmpLoc, tmpDist);
} elseif (tmpRand2 == 5) {
CreateUnit(0, UnitDB(UNIT_ARTILLERY), tmpLoc, tmpDist);
}
}
}
I had the above in WW_func.slc but you could probably put it in scenario.slc. Just change the unit names using names from units.txt. The code below was in scenario.slc. Worked great, barbarians every few turns until another spawner took over. This would create a few random units 4 tiles from dusseldorf in this case. I think you would want to have it happen near a random city though. Sorry I haven't got anything for that yet. If/when I do I'll post it here if someone else hasn't already.
// spawn resistance near dusseldorf
} elseif (turnCount == 3 | | turnCount == 7 | | turnCount == 9 | | turnCount == 12 | | turnCount == 15) {
SpawnResist (dusseldorfloc,4);
}
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
Hows this look for a barbarian gov? i took a mixture of tyranny and monarchy but took away any negatives for being warlike. Then add an ADVANCE_BARBARIAN but dont add it to any AI build lists, so none of the AIs should go after it. I didnt get a chance to test it tonight but it should work.
GOVERNMENT_BARBARIAN {
Icon ICON_GOV_TYRANNY
EnableAdvance ADVANCE_BARBARIAN
Rank 1
SameRankAdvice GOVERNMENT_TYRANNY_SAME_RANK_ADVICE HigherRankAdvice GOVERNMENT_TYRANNY_HIGHER_RANK_ADVICE RationsExpectation -1
PositiveRationsCoef 1
NegativeRationsCoef 1
WorkdayExpectation -1
PositiveWorkdayCoef 1
NegativeWorkdayCoef 1
WagesExpectation -1
PositiveWagesCoef 1
NegativeWagesCoef 1
FoodCoef 0.1
ProductionCoef 0.85
InfrastructureCoefficient 0.5
CrimeCoef 1.5
CrimeOffset 95
KnowledgeCoef 1
MaxScienceRate 0.25
GoldCoef 0.75
CapitalizationCoefficient 0.5
UnitRushModifier 2
BuildingRushModifier 5
WonderRushModifier 100
EndGameRushModifier 6
MaxIncomingTrade 100000
MaxOutgoingTrade 100000
PollutionCoef 1.3
PollutionUnhappyCoef 0.02
SupportCoef 1.0
TurnsToNewReadiness 1
ReadyPeaceCoef 0.5
ReadyPeaceHP 0.5
ReadyAlertCoef 0.75
ReadyAlertHP 0.8
ReadyWarCoef 1
ReadyWarHP 1
DefenseCoef 0.85
WarDiscontentMaxUnits 5
WarDiscontentPerUnit 0.1
ConquestDistress -4
ConquestDistressDecay 0.2
OverseasCoef 0
OverseasDefeatDecay 0
OverseasDefeatCoef 1
HomeDefeatDecay 0.5
HomeDefeatCoef 1
MaxMartialLawUnits 8
MartialLawEffect 1
MartialLawThreshold 80
AtHomeRadius 2
EmpireDistanceScale 0.002
MinEmpireDistance 300
MaxEmpireDistance 2000
TooManyCitiesThreshold 10 TooManyCitiesCoefficient .1
ProfessionalUnits 0
GrowthRank 1
ProductionRank 1
CommerceRank 1
ScienceRank 1
GoldRank 1
MilitaryRank 3
PollutionRank 1
LoyaltyRank 1
MartialLawRank 5}
------------------
History is written by the victor.
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
Radical,
Regarding the thread on natural disasters via SLIC, seems like the random barbarian logic is very similiar to what we need to create quakes or plagues. Instead of creating a unit, couldnt we do infect attacks if a city is within x tiles of that random spot?
------------------
History is written by the victor.
[This message has been edited by Alpha Wolf (edited January 05, 2001).]
|
|
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:14
|
|
Alpha,
That might work as well, it comes down to the same thing. But if you want to be sure the event happens once every so often (e.g. there should be a 25% chance that the barbarians are created every turn so that they get created approximately once every 4 turns), looking at a random location might not work, since it could well be that half the time no city is found and the barbarians are actually executed only once every 7 or 8 turns on average (which would differ per number of civs and mapsize and play-style, etc). By looking for a city you would know for a fact, independent of mapsize or whatever, how often it occurs. So it's just what you prefer, if you don't mind this dependancy you might as well do it like that.
Anyway, if you'd like the code to happen near a random city, here's an example on how it might look (untested so there may be a few minor bugs but the general idea should work):
code:
// this code assumes any non-existing player is barbarian, ala CtPI
// also, I'm not sure if Random(3) return a value between 0 and 3 or 0 and 2, so this needs to be tested
HandleEvent(BeginTurn) 'BarbarianThread' post { // execute everytime at the beginning of someone's turn
location_t randomLoc;
city_t tmpCity;
int_t i;
int_t j;
int_t cityIndex;
int_t count;
player[1] = 0; // barbarians
count = 0;
if (player[0] == 0) { // if the current player is barbarian (needed so this gets executed only once a year)
if (Random(3) == 1) { // have a 25% chance that this happens (or is it 33%?)
for (i = 0; i < 32; i = i + 1) { // cycle through all players
player[0] = i; // store player
if (player[0] != player[1]) { // if this player isn't barbarian
for (j = 0; j < player[0].cities; j = j + 1) { // cycle through all cities of this player
count = count + 1; // add all cities of this player to a variable 'count'
}
}
} // 'count' now contains the total number of cities in the game not owned by barbarians
cityIndex = Random(count); // or is it count-1? this picks the random non-barbarian city that will get barbarians
for (i = 0; i < 32; i = i + 1) { // cycle through all players again to find the city that belongs to cityIndex
player[0] = i; // store player again
if (player[0] != player[1]) { // if this player isn't barbarian again
for (j = 0; j < player[0].cities; j = j + 1) { // cycle through all cities of this player again
if (cityIndex != 0) { // if cityIndex isn't 0
cityIndex = cityIndex - 1; // deduct 1 (this city isn't the city that will get barbarians)
} else { // if it is this city, this is the city that you were looking for
GetCityByIndex(player[0], j, tmpCity); // get the actual city
randomLoc = tmpCity.location; // put the location in a variable
SpawnBarbarians(randomLoc, 4); // call the routine that will create barbarians
}
}
}
}
}
}
}
Edit: SLIC in HTML sucks 
[This message has been edited by Locutus (edited January 05, 2001).]
|
|
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
All AI building is done off of the build lists. The AI reads thru the list, and builds the last thing that it can. So if the list consisted of a,b,c,d,e the AI will build only a's until it gets the tech for b. Also, if it should find the tech for e, it will never build anything else. So I created a list specifically for the AI, and it should only build those units. However, it also is dependent on the attack/defense/ranged percentages. so if it needs a ranged unit, and b is the most current ranged unit that it has, then it will build a b. there are also specific number of special units that it will try to build so that number can be increased, to pump out more terrorists. However, the barbarians still need some military units in order to defend its cities. This will take some playtesting to get the right percentages and such but is very easy to implement.
------------------
History is written by the victor.
|
|
|  |
 |
|
Radical_Manuvr
|
|
Maryland, USA
Dec 2000 time: 05:14
|
|
Martock,
I did modify the code for a scenario I'm working on. I only used eco-terrorists and only gave them the infect city attack. I'm still in the early stages of creation so I just have cities and no units added at the beginning. The stealth barbarians were created on turn 3 and within 1 or 2 turns they attempted to infect the city I had them appear near. Within a few more turns they had infected every one of my 6 cities. I haven't tried any other units out but the barbarians definitely use eco-terrorists. I should have switched to cheat mode to see how many they had, but didn't think about it at the time. It seemed like as soon as they could move to the next city, they were attacking.
Alpha, I've been working on my scenario stuff almost all day and my brain is overloaded. I might be at a point to work on the natural disaster thing by Sunday, but I'm not an SLIC expert so it could be anywhere from an hour to a few days before I have something, assuming nobody else gets to it first. I don't remember who posted it but that x-y code looks like a good start.
|
|
|  |
 |
|  |
 |
|
Alpha Wolf
|
|
Prince of the Barbarians
Feb 2001 time: 05:14
|
|
i think barbarians stop getting produced based on the diffdb or risks file. I think its turn 350 right now. I too have noticed that on games that I just sit and watch that almost no barbarians are generated. Since they are designed to mostly harrass the human that actually makes sense. Once I start moving, they start popping up like dandilions. Somewhat annoying but might be the game's way of dealing with ultra active humans.
------------------
History is written by the victor.
|
|
|  |
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
|
|
|
|
|
|