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 > Call To Power II > CtP2-Creation/AI/Mods/Scenarios > SLIC: Logistics
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
E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:17
  Old Post 15-12-2004 23:36 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
SLIC: Logistics Suffering from ads?

NEED HELP!!!
this a shell just to express my logic before attempting to SLIC, can anyone check my flow here and offer any needed fixes?


code:
Start turn If player = human then Get unit type if land Then get unit location return value Get nearest city and get nearest fort, get lowest value (sptdist) If player has advance HORSE return value 5 RAILROAD return 10 AUTOMOBILE return 15 AIR return 20 return highest value(advdist) Get sptdist divide by advdist = logdist Get UNIT GOLD # multiple logdist = gold cost per turn Get UNIT pw # multiple logdist = pw cost per turn Total gold and pw cost for all units. Subtract from player gold and pw. repeat for all land units

The Big Mc is offline The Big Mc
King
Of the universe / England
Oct 2001
time: 05:17
  Old Post 16-12-2004 01:28 Visit The Big Mc's homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Full PM-box? Change here!

You need to keep the fort loc in an array to allow this script to work.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:17
  Old Post 16-12-2004 02:25 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Tired of ads?

quote:
Originally posted by The Big Mc
You need to keep the fort loc in an array to allow this script to work.


what do you mean about array? I have to have a separte set of slic that says: find all forts???

Last edited by E on 16-12-2004 at 02:33

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:17
  Old Post 16-12-2004 02:58 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

I think he's saying that a FindNearestFort() function called each time would be very time consuming - it would have to scan the map, since fort locations aren't automatically stored like city locations are. If when each fort is built you add the location to a global FORT_LOCS[] array, then you can just scan that array for distances.

Also, if you check for those advances in reverse order (starting with AIR, ending with HORSE), using elseif statements, you'll get the highest number straight away.

code:
Total gold and pw cost for all units. Subtract from player gold and pw. repeat for all land units

You only need "for all units" once. Either "add the individual one to a running total and subtract it all at the end", or "subtract the individual amount each time and repeat". Probably better the second way, then if there isn't enough gold/pw for the logistics cost, you can injure the unit or something.

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:17
  Old Post 22-12-2004 23:54 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

DP

Last edited by E on 23-12-2004 at 23:24

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:17
  Old Post 23-12-2004 00:16 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Increase Your PM Length

ok this is my first attempt at (finishing) SLIC. How do I define arrays? and what else did I miss on this. PS since units already have a PW update cost I'm just subtracting gold since you are paying to get that PW to the unit (and food)


code:
if(IsHumanPlayer(player[0])) //logistics is challenge for humans only HandleEvent(BeginTurn) 'Startturn' pre { for (i = 0; i < GetUnitsAtLocation(tmpLoc); i = i + 1) { int_f FindTheNearestCity( int_t thePlayer, location_t theLocation, int_t theDistance){ theNearestCity = tmpCity; if (HasAdvance(tmpPlayer, ID_ADVANCE_AERODYNAMICS)) { // if player has airpower, return 25; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_AUTOMOBILE)) { return 15; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_RAILROAD)) { return 10; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_HORSE)) { return 5; } else { // if none of above advances present, return 1; // basic logistics } } UNIT_TYPE=UnitDB(UNIT_ARTILLERY) return 5 //unitgold tmpcity-tmpunit/advbonus*unitgold*-1=unitlogistics GetTotalUnitlogistics AddGold(player[0], - totallogistics cost); //subtractgold gold DisableTrigger('StartTurn'); //run once only

E is offline E
King
July 24,2005 Ctp2 Tiles in sig!
May 1999
time: 21:17
  Old Post 23-12-2004 23:23 Visit E's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Put an end to popups!

Can anyone check the above SLIC please?

Martin Gühmann is offline Martin Gühmann
Emperor
Berlin, Germany
Mar 2001
time: 06:17
Post  Old Post 24-12-2004 01:55 Visit Martin Gühmann's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Well the code above doesn't run at all, first we should reoder it a little bit and fix the fomarting of the white space for readibility. Well of course the following code still doesn't work.

code:
HandleEvent(BeginTurn) 'Startturn' pre { if(IsHumanPlayer(player[0])){ //logistics is challenge for humans only for (i = 0; i < GetUnitsAtLocation(tmpLoc); i = i + 1) { int_f FindTheNearestCity( int_t thePlayer, location_t theLocation, int_t theDistance){ theNearestCity = tmpCity; if (HasAdvance(tmpPlayer, ID_ADVANCE_AERODYNAMICS)) { // if player has airpower, return 25; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_AUTOMOBILE)) { return 15; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_RAILROAD)) { return 10; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_HORSE)) { return 5; } else { // if none of above advances present, return 1; // basic logistics } } UNIT_TYPE=UnitDB(UNIT_ARTILLERY) return 5 //unitgold tmpcity-tmpunit/advbonus*unitgold*-1=unitlogistics GetTotalUnitlogistics AddGold(player[0], - totallogistics cost); //subtractgold gold DisableTrigger('StartTurn'); //run once only } } }


First thing to consider is that slic is an event driven language so you have to encapsulate your code by an event no statement can be placed outside of an event handle or outside of a function, except for global variable definition.

Second you cannot define local functions at least I never tried that, and I don't see any sense in it doing it in the middle of a for loop.

Third you disable the trigger afterwards it has been run once. Well what happens with all the other players in an MP game?

By the way you should check all the other pieces of slic lying around here.

-Martin

  < 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:
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.0369 seconds (88.28% PHP - 11.72% MySQL) with 30 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