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 > SLIC help
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
tigger is offline tigger
Chieftain
UK
Feb 2002
time: 05:17
  Old Post 23-02-2002 15:49
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
SLIC help Support Apolyton, pre-order Civilization IV

I'm trying to adapt the sogdia rebellion code form the Alexander scenario. The scenario.slc code refers to a SwapCity function. The function in AG_func.slc is aso follows:

// Swaps City to Player. Kills all units first if flag is set to 1.
int_f SwapCity (city_t swCity, int_t swPlayer, int_t killUnits)
{
int_t i;
int_t tmpPlayer;
int_t tmpNum;
int_t numUnits;
int_t noSwap;
unit_t tmpUnit;
city_t tmpCity;
location_t tmpLoc;

tmpCity = swCity;
if (CityIsValid(tmpCity)) {
tmpPlayer = swPlayer;
numUnits = GetUnitsAtLocation(tmpCity.location);
tmpLoc = tmpCity.location;
for (i = 0; i < numUnits; i = i + 1) { // Check for special units
GetUnitFromCell(tmpLoc, i, tmpUnit);
tmpNum = tmpUnit.type;
if (tmpNum >= 72 && tmpNum <= 88) {
noSwap = 1;
}
}
if (noSwap == 0) {
if (killUnits == 1) {
for (i = 0; i < numUnits; i = i + 1) { //If no special units, kill all units
GetUnitFromCell(tmpLoc, i, tmpUnit);
Event: KillUnit(tmpUnit, 0, tmpUnit.owner);
}
}
Event:GiveCity(tmpCity, tmpPlayer);
} else {
return -1; // Can't swap due to Special unit
}
} else {
return -2; // Can't swap due to invalid city
}
}

Initially it threw up syntax errors when I used it. I assumed this was due to the special unit checks as I have no special units. But I can't seem to get it working. All I want is all player 1s units killed in the city and then the city swapped to player0.

Help!!!!

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:17
  Old Post 23-02-2002 20:16 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton, buy Civilization 2

This code revolves around the fact that there are special units. Without them, the whole code becomes a lot simpler. You should set the last integer (KillUnits) to onoe each time so the units are killed first.
This should work though, I've basically just cut out all the special unit stuff, and restructured what's left.

code:
// Swaps City to Player. Kills all units first if flag is set to 1. int_f SwapCity (city_t swCity, int_t swPlayer, int_t killUnits) { int_t i; int_t tmpPlayer; int_t tmpNum; int_t numUnits; unit_t tmpUnit; city_t tmpCity; location_t tmpLoc; tmpCity = swCity; if (CityIsValid(tmpCity)) { tmpPlayer = swPlayer; numUnits = GetUnitsAtLocation(tmpCity.location); tmpLoc = tmpCity.location; if (killUnits == 1) { for (i = 0; i < numUnits; i = i + 1) { GetUnitFromCell(tmpLoc, i, tmpUnit); Event: KillUnit(tmpUnit, 0, tmpUnit.owner); } } Event:GiveCity(tmpCity, tmpPlayer); } else { return -1; // Can't swap due to invalid city } }

tigger is offline tigger
Chieftain
UK
Feb 2002
time: 05:17
  Old Post 24-02-2002 00:45
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Cheers IW, that works great. I'm still a little clumsy when it comes to SLIC, but the sceanrio is almost finsihed now.

Cheers Mate

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:17
  Old Post 24-02-2002 04:00 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Get a bigger avatar today!

No probs, can't wait to see the scenario

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:17.
Apolyton Time is 00:17.
    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.0332 seconds (86.55% PHP - 13.45% 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