Thread Tools
Old December 18, 2001, 18:00   #31
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 19:35
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I'm gonna look into this into more detail tonight, hopefully I'll be able to address all your issues tomorrow...
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old December 19, 2001, 06:53   #32
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 17:35
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
I almost got it to work myself but the computer did not like the find get nearest city command.

I will tell you what I was going to do anyway I was going to find the nearest city every time a barbarian moved and then match the city over the captured one to find the owner

As you may be a ware there are a few errors already in your script so to save you time here is were they are

if (IsHumanPlayer(LOQ_oldCityOwner) {

needs to be changed to

if (IsHumanPlayer(LOQ_oldCityOwner)) {

and

if (LOQ_capturedCity.owner = 0) {

should be

if (LOQ_capturedCity.owner == 0) {

that was it with the errors if you could help me with the find nearest city bit I may be able to sort it.

any way I am here will Friday and then its Christmas
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 19, 2001, 09:40   #33
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 19:35
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
I ran the code (after fixing the typos you already mentioned) and had no problems whatsoever with it: it (seemed to) work exactly as advertised. Could you explain in more detail what exactly goes wrong according to you?

As far as nearest city goes, I'll post a bit more about that tonight, don't have much time now. What exactly did is wrong with it? Did you get an error while using it or does it just not do what it should or whatever?
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery
Locutus is offline  
Old December 20, 2001, 06:48   #34
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 17:35
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
right when the barbarians capture one of my cities .
I don't get the message box up .

when I look at the code I notes that the city is changed to barbarian and then you take the city owner which at this time is now barbarian. so it does not work.

it loads up ok just the function it is meant to do does not work.
it just sends the barbarian money around in a circle.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 20, 2001, 08:09   #35
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Deity
 
Locutus's Avatar
 
Local Time: 19:35
Local Date: October 31, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
Actually, as you can see in this event:
Code:
// when a city is captured, store old owner
HandleEvent(CaptureCity) 'LOQ_BarbCaptureCityPre' pre {
	LOQ_capturedCity = city[0];
	LOQ_oldCityOwner = city[0].owner;
}
the owner is stored PRE, so before a city is captured. I used the same code to store the old owner of a captured city for the Militia code of the MedMod (and Cradle and Alex and whatever) and it works just fine there. Executing the code on my system, like I said before, also works perfectly. Perhaps you forgot to #include the file or something silly like that (happens to the best of us)? In any case, you can check if the code is actually being executed by putting in an addition messagebox somewhere with "Message(1, 'GotHere') and make a messagebox that displays a simple text message ("Got Here" ). If this doesn't work in the game, the code obviously isn't being executed at all, otherwise you have a very weird problem

I'm afraid I didn't get around to looking into the GetNearestCity function (I'll try again tonight but no promises) but I seem to vaguely remember it being bugged. If that is the case, you could try cycling to all cities of all players and store the city with the smallest distance to the location you need. Something roughly like this:

Code:
nearest = 9999999999;   // rediculously large number
for (i = 0; i < 32; i++) {
  player[0] = i;
  for (j = 0; j < player[0].cities; j = j + 1) {
      GetCityByIndex(i, j, tmpCity);
      if (SquaredDistance(currentLoc, tmpCity.location) < nearest) {
         nearest = SquaredDistance(currentLoc, tmpCity.location);
         nearestCity = tmpCity;
      }
   }
}
PS I use SquaredDistance instead of Distance because it's (slightly) faster (obviously, since Pythagoras is used to calculate distance).
__________________
Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

Last edited by Locutus; December 20, 2001 at 08:20.
Locutus is offline  
Old December 20, 2001, 10:51   #36
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 17:35
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
All I know is that every time they nick one of my cites they don't offer it me back I will try to put in a dumb msg box. and will get back to your tomorrow. not that it will do much good were braking up tomorrow at 12 GMT so I will talk more after the holidays.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old January 7, 2002, 08:30   #37
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 17:35
Local Date: October 31, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
i am back. with all the new threads and stuff I am like a kid in a toy shop

got it working and started to mod it. I need a bit of help with Teleporting the barbarians out of the city can you help locutos.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 13:35.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team