Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > CtP2-Creation/AI/Mods/Scenarios-Archive > Forts for AIs
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:15
Post  Old Post 22-09-2001 15:36 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Forts for AIs Support Apolyton

Did you ever noticed that the AI doesn't use forts to close the gaps in its empire between cities. I notice that the AI tries to connect its cities by roads, but it can only build the road straight to its borders, without forts it can't connect the cities. Therefore here is the code: It detects if the construction of a road is complete in the neighbourhood of this border and will build a fort on a neutral neighbour tile:

code:
HandleEvent(ImprovementComplete) 'MG_BuildFortification' post { int_t MG_tilimpcomplete; MG_tilimpcomplete = value[0]; improvement[0] = MG_tilimpcomplete; location_t MGFortLoc; int_t k; int_t MG_OK; MG_OK = 0; unit_t MGFortUnit; int_t MGPw; if(!(IsHumanPlayer(player[0]))){ if ((MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_ROAD)) // check if terrain has roads, railroads or maglevs ||(MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_RAILROAD)) ||(MG_tilimpcomplete == TerrainImprovementDB(TILEIMP_MAGLEV))){ for (k=7; k>=0 ; k=k-1) { //directions GetNeighbor(location[0], k, MGFortLoc);//look around if ((TerrainType(MGFortLoc)<=9)||(18<=(TerrainType(MGFortLoc))<=21)) { //check if neighbour tile is a land tile if ((CellOwner(MGFortLoc)==-1)&&(MG_OK == 0)) { //make shure that neighbour tile is owned by noone MGPw = player[0].publicworkslevel; // get AI players current public works level MGPw = MGPw + 1000; setPW(CellOwner(location[0]), MGPw); // make shure that AI player has enough puplic works to build a fort CreateUnit(CellOwner(location[0]), UnitDB(UNIT_DIPLOMAT), MGFortLoc, 1, MGFortUnit); //creates a unit to make shure that fort location is in the vision range of the AI player Event: CreateImprovement(CellOwner(location[0]), MGFortLoc, 8, 0); //create fort Event: DisbandUnit(MGFortUnit); //disband unit at fort location MG_OK = 1; // make shure that only one fort is build } } } } } }


To install the script file open the file script.slc (of coarse if you are using in your \ctp2_data\default\gamedata\ directory and insert at the end of that file the line:

#include "MG_FortsForAIs.slc"

And put the file MG_FortsForAIs.slc into your \ctp2_data\default\gamedata\ directory.

This fort code will be a part of the next version of GoodMod. Unfortunatly this code doesn't detect the gaps in an existing road network. Therefore the best would be to start a new game, but it can also implemented in an existing game. All what you have to do after installation of this file: Open the the chat window in the game by typing (') of coarse without the brackets and type /reloadslic.

I tried to make such a code that detect existing gaps in the road network but the code didn't work. Maybe someone can help.

-Martin

Edit: Hope it is better now.

Attachment: mg_fortsforais.slc
This has been downloaded 25 time(s).

Last edited by Martin Gühmann on 22-09-2001 at 16:53

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:15
  Old Post 22-09-2001 15:59 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

Cool!

Soon there will be no end to the AIs ability to kick human ass...

That will be a great way to get the AI to (hopefully) get better priorities for defending, perhaps even attacking.
Thanks Martin.

(Could you drop the long outcommented bits down a line, it screwing with the page... Ta)

Peter Triggs is offline Peter Triggs
Prince
Gone Fishin, Canada
Jan 2000
time: 05:15
  Old Post 22-09-2001 17:54
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Put an end to popups!

Great, Martin. This is something we've needed for ages.

player1 is offline player1
King
Belgrade, YU
Sep 2001
time: 06:15
  Old Post 25-09-2001 12:23
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Inflate your Upload Space

Excillent SLIC!

Still, sometimes AI builds too many forts.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:15
Post  Old Post 31-03-2002 04:37 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Suffering from ads?

I had to do some slic debug work, today. At this occasion I found to bugs in the code. That causes some error messages if you played with DebugSlic=Yes. Now it is fixed. For download visit my page or click here. Note I didn't replaced the attachment in the first post, as I have problems with downloading attachments. Note that this slic file is compartible with all mods in which you have to pay 1000 PW for a fort.

-Martin

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:15
  Old Post 31-03-2002 17:23
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Put an end to popups!

Great work Martin, i'll have a go with it this weekend
Which of the main mods will it work with? And will it work in a multiplayer game?
Thanks again.

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:15
Post  Old Post 31-03-2002 21:08 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton

quote:
Originally posted by child of Thor
Which of the main mods will it work with?


As I said it will work with all mods in which you have to pay for a fort 1000 PW that is the case in the original game, in AplytonPack, in GoodMod and I think also in World at War. It is not compartible with Cradle as you have in Cradle to pay 3600 PW for a fort. Note that all these mods already contain the first version of this script. In GoodMod you have just to replace the MG_FortsForAIs.slc, in the other mods that I mentioned above the MG_ prefix is replaced by the prefix of the mod, so you can rename the file and than replace the file of the mod by this one or just modify the according entry in the the *_script.slc of the modsetup.

MedPack2 doesn't use this script but it is compartible.

quote:
Originally posted by child of Thor
And will it work in a multiplayer game?


It works in MP, too. As it just asked for the fact is the current player not a human, only if this condition is true it will build a fort, so no benefits for the human.

-Martin

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:15
  Old Post 31-03-2002 21:52
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Full PM-box? Change here!

O.K. If i wanted to include it in my Craddle games would i change the number 1000 to 3600 as in 'MGPw = MGPw + 3600;' ? (new territory for me - just seems logical?)

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:15
Post  Old Post 01-04-2002 00:00 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Civilization 2

quote:
Originally posted by child of Thor
O.K. If i wanted to include it in my Craddle games would i change the number 1000 to 3600 as in 'MGPw = MGPw + 3600;' ? (new territory for me - just seems logical?)


Yes, or just download this one.

-Martin

child of Thor is offline child of Thor
Emperor
UK
Jan 2002
time: 05:15
  Old Post 02-04-2002 14:11
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Put an end to popups!

Hey! Thanks Martin,
I'm going to be starting a new game on Friday night so thank you very much

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:15.
Apolyton Time is 00:15.
    top of page
Rate This Thread:
archivepost
Forum Jump:
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
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0465 seconds (90.25% PHP - 9.75% MySQL) with 31 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net