I'm gonna look into this into more detail tonight, hopefully I'll be able to address all your issues tomorrow...
Announcement
Collapse
No announcement yet.
Exchange city
Collapse
X
-
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
Comment
-
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?
Comment
-
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
Comment
-
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; }
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; } } }
Last edited by Locutus; December 20, 2001, 08:20.
Comment
-
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
Comment
-
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
Comment
Comment