Today on Apolyton POLYCAST #58 (PROMO #9) MODCAST #23 CIVCON '09 ANNOUNCED: AUGUST 7-9, 2009 TRI-LEAGUE #27 BTS TEAM D.G.: ENGAGE NOW
Apolyton Civilization Site Forums
main | civ4 | col | civrev | galciv2 | alt | civ3 | civ2 | ctp2 | smac | about | polycast
- Order Civilization IV: Colonization (Amazon US)/(UK) -
- Order Civilization: Revolution [360] (Amazon US)/(UK) | [PS3] (US)/(UK) | [DS] (US)/(UK) -
ApolytonPLUS | register | new posts | pm (-/-) | members
faq | news | civgroups (news) | hall of fame | downloads | upload | plus | store | search
Apolyton Civilization Site Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Site Forums > Call To Power > CtP2 General > SLIC questions
Page: Print | Email | Subscribe | Report News       0 votes -  average
03.Nov: BETTER AI, UPGRADE OPTIONS: `APOLYTON EDITION`
19.Jul: PROGRAMMER SOUGHT FOR LINUX PORT
12.Apr: REVISION 719 BUILD IS OUT!
CivGroups
Call to Power II Multiplayer (74): Not a Member - Join
Apolyton Storywriters' Guild (59): Not a Member - Join

bottom of page
   - CALL TO POWER 2 @ GOGAMER $9.99 - CALL TO POWER 2 @ GAMESTOP $14.99 - CALL TO POWER 2 @ CHIPS&BITS $24.95
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
hexagonian
The Courts of Candle'Bre
Emperor
Smemperor
Jun 1999
time: 21:44
21-06-2008 16:37 | www
edit | quote
#1 | report |
SLIC questions Support Apolyton, buy GURPS/ Alpha Centauri


I'm trying to get a couple of existing slics to work for Cradle, but with little luck.

All I am doing is changing existing units with new units.

code:
//////////////////////////////////////////////////////////////////////////// //Elite units code by Stan Karpinski, using peices of code from Immortal // // Wombat, Peter Triggs. If a unit is involved in a successful battle, // // there is a 5% chance it will become an elite unit of that type. // // Applies to only certain front line troops and the army must have at // //least 2 units // //////////////////////////////////////////////////////////////////////////// int_t HeroChance; int_t HeroChance2; int_t HeroChance3; int_t HeroChance4; HandleEvent(VictoryMoveOrder) 'elite' pre { location_t tmpLoc; int_t PromotionChance; tmpArmy = army[0]; tmpNum = tmpArmy.size; tmpPlayer = army[0].owner; tmpLoc = army[0].location; int_t tempUnit; if (tmpNum >=2) { for (j = 0; j < GetUnitsAtLocation(tmpLoc); j = j + 1) { GetUnitFromCell(tmpLoc, j, tmpUnit); if ((tmpUnit.type == UnitDB(UNIT_WARRIOR))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Eone'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_WARRIOR_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HOPLITE))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Etwo'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HOPLITE_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HYPASPISTS))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Ethree'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HYPASPISTS_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_LEGION))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Efour'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_LEGION_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_SPEARMAN))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Efive'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_SPEARMAN_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_PIKEMEN))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Esix'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_PIKEMEN_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_ARQUEBUSIER))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Eseven'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_ARQUEBUSIER_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_INFANTRYMAN))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Eeight'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_INFANTRYMAN_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_MACHINE_GUNNER))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Enine'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_MACHINE_GUNNER_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_MAN_AT_ARMS))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Eten'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_MAN_AT_ARMS_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_MARINE))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Eeleven'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_MARINE_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HOVER_INFANTRY))){ PromotionChance = random(90); if(PromotionChance <= 5){ message(tmpPlayer, 'Etwelve'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HOVER_INFANTRY_ELITE), tmpLoc,0); Event:GroupOrder(army[0]); } } } } } ////////////////////////////////////////////////////////////////////////////// // Elite unit code expansion // //Elite units involved in a successful combat have a 1 in 30 chance of being// // promoted to a GENERAL. Army must have at least 2 units // ////////////////////////////////////////////////////////////////////////////// HandleEvent(VictoryMoveOrder) 'General' pre { location_t tmpLoc; int_t PromotionChance; tmpArmy = army[0]; tmpNum = tmpArmy.size; tmpPlayer = army[0].owner; tmpLoc = army[0].location; int_t tempUnit; if (tmpNum >=2) { for (j = 0; j < GetUnitsAtLocation(tmpLoc); j = j + 1) { GetUnitFromCell(tmpLoc, j, tmpUnit); if ((tmpUnit.type == UnitDB(UNIT_WARRIOR_ELITE))){ PromotionChance = random(90); if(PromotionChance <= 2){ message(tmpPlayer, 'Gone'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HERO), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HOPLITE_ELITE))){ PromotionChance = random(90); if(PromotionChance <= 2){ message(tmpPlayer, 'Gtwo'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HERO), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_SPEARMAN_ELITE))){ PromotionChance = random(90); if(PromotionChance <= 2){ message(tmpPlayer, 'Gthree'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HERO), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_LEGION_ELITE))){ PromotionChance = random(90); if(PromotionChance <= 2){ message(tmpPlayer, 'Gfour'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HERO), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HYPASPISTS_ELITE))){ PromotionChance = random(90); if(PromotionChance <= 2){ message(tmpPlayer, 'Gfive'); KillUnit(tmpUnit); CreateUnit(army[0].owner, UnitDB(UNIT_HERO), tmpLoc,0); Event:GroupOrder(army[0]); } } elseif ((tmpUnit.type == UnitDB(UNIT_HERO))){ PromotionChance = random(90); if(PromotionChance <= 3){ if (HeroChance<9){ HeroChance=HeroChance+1; KillUnit(tmpUnit); if(HeroChance==1){ CreateUnit(army[0].owner, UnitDB(UNIT_GREAT_GENERAL), tmpLoc,0); AgeGREAT_GENERAL = 100 + random(50); message(tmpPlayer, 'GREAT_GENERAL'); Event:GroupOrder(army[0]); } } } } } } } ///////////////////////////////////////// // // // Improved PoW (Now works) // // by The Immortal Wombat // // // ///////////////////////////////////////// //-------------// // Variables // //-------------// int_t POW_TYPE[]; int_T POWage; int_t tmpNum;int_t tmpWonder; army_t tmpArmy; int_T tmpNum2; int_t IsThere; location_t tmpLoc; location_t tmpLoc2; unit_T tmpUnit2; int_t tmpPlayer; int_t i; //---------------------// // Begin Game Setup // //---------------------// HandleEvent(BeginTurn) 'GameStart' pre { POW_TYPE[0] = UnitDB(UNIT_WARRIOR); //The better the age, the better the unit you get. POW_TYPE[1] = UnitDB(UNIT_SPEARMAN); POW_TYPE[2] = UnitDB(UNIT_HOPLITE); POW_TYPE[3] = UnitDB(UNIT_MAN_AT_ARMS); POW_TYPE[4] = UnitDB(UNIT_INFANTRYMAN); POW_TYPE[5] = UnitDB(UNIT_MACHINE_GUNNER); POW_TYPE[6] = UnitDB(UNIT_HOVER_INFANTRY); DisableTrigger('GameStart'); //run once only } //----------------------// // Get Player Age // //----------------------// int_f WOUTER_GetAge(int_t thePlayer) { tmpPlayer = thePlayer; if (HasAdvance(tmpPlayer, ID_ADVANCE_PLASMA_WEAPONRY)) { // if player has Plasma Weaponry, return 6; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_ADV_INFANTRY_TACTICS)) { // etc. return 5; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_RAILROAD)) { return 4; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_BANKING)) { return 3; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_COMPOSITE_BOW)) { return 2; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_TOOLMAKING)) { return 1; } else { // if none of above advances present, (should never happen) return 0; // age is age 0 } } //--------------------------------------------// // Capturing event (should be unnecessary) // //--------------------------------------------// int_f CaptureUnit(location_t theLocation){ // invented function to create unit depending on age tmpLoc2 = theLocation; POWage = WOUTER_GetAge(tmpPlayer); //get age Event:CreateUnit(tmpPlayer, tmpLoc2, 0, POW_TYPE[POWage], 1); //create unit. If in age 1, create POW_TYPE[1] Event:GroupOrder(army[0]); //This is set up like this because of bugs just using the CreateUnit event } //------------------// // Battle event // //------------------// HandleEvent(VictoryMoveOrder) 'capture' pre { tmpArmy = army[0]; tmpNum = tmpArmy.size; tmpPlayer = army[0].owner; tmpLoc = army[0].location; IsThere = 0; for(i = 0; i < tmpNum; i = i + 1) { GetUnitFromArmy(tmpArmy, i, tmpUnit); tmpNum2 = tmpUnit.type; if(tmpNum2 >= 112 && tmpNum <= 117){ // number of units. 107-117 are wonder-units IsThere = 1; //GOT ONE!! } } if(IsThere == 1){ //If it was there, POWage = WOUTER_GetAge(tmpPlayer); //get age (for messaging purposes) if(POWage == 6){ message(tmpPlayer, 'six'); CaptureUnit(tmpLoc); //and run the captureunit function } elseif(POWage == 5){ message(tmpPlayer, 'five'); CaptureUnit(tmpLoc); } elseif(POWage == 4){ message(tmpPlayer, 'four'); CaptureUnit(tmpLoc); } elseif(POWage == 3){ message(tmpPlayer, 'three'); CaptureUnit(tmpLoc); } elseif(POWage == 2){ message(tmpPlayer, 'two'); CaptureUnit(tmpLoc); } elseif(POWage == 1){ message(tmpPlayer, 'one'); CaptureUnit(tmpLoc); } } }

Last edited by Martin Gühmann on 24-06-2008 at 19:19

Martin Gühmann
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Moderator
Berlin, Germany
Mar 2001
time: 04:44
21-06-2008 23:20 | www
edit | quote
#2 | report |
Re: SLIC questions Suffering from ads?


quote:
Originally posted by hexagonian
I'm trying to get a couple of existing slics to work for Cradle, but with little luck.

All I am doing is changing existing units with new units.


And what is your particular problem? Any error messages?

-Martin

hexagonian
The Courts of Candle'Bre
Emperor
Smemperor
Jun 1999
time: 21:44
22-06-2008 12:59 | www
edit | quote
#3 | report |
Enter the AD-FREE zone


CRA_elite

slc: 16 Symbol tmpArmy undefined
slc: 16 Symbol tmpArmy used in assignment unknown type

slc: 17 Symbol tmpArmy not a structure
slc: 17 Symbol tnpNum undefined:
slc: 17 Variable tmpNum used in assignment unknown type

slc: 18 Symbol tmpPlayer undefined
slc: 18 Variable tmpPlayer used in assignment unknown type

slc: 22 Symbol j undefined
slc: 22 Variable j used in assignment unknown type

slc: 23 Symbol tmpUnit undefined

slc: 24, 33, 42, 51, 60, 69, 78, 87, 96, 105, 114, 123, 150, 157, 166, 175, 184, 193, 202 Symbol tmpUnit not a structure

slc: 210 Symbol AgeGREAT_GENERAL undefined
slc: 210 Variable AgeGREAT_GENERALused in assignment unknown type

slc: 235 GREAT_GENERAL not string variable


++++++++++++++++++++++++++++++++++++
CRA_pow

slc:14 Symbol tmpNum already has a type

slc:15 Symbol tmpArmy already has a type

slc:21 Symbol tmpPlayer already has a type

slc: 83 Symbol tmpArmy not a structure

slc: 89 Symbol tmpUnit not a structure


++++++++++++++++++++++++++++++++++++
In addition, when I activate the above SLICs, I get crashes on the following SLIC, but do not get those crashes when the two above are deactivated

CRA_wonderunits

slc:8 Symbol tmpPlayer already has a type

slc:8 Symbol tmpWonder already has a type

slc:291 Symbol i already has a type

slc:292 Symbol j already has a type

Martin Gühmann
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Moderator
Berlin, Germany
Mar 2001
time: 04:44
24-06-2008 19:38 | www
edit | quote
#4 | report |
Got spare money?


The code you use has global variables. That is really bad style, unless the variables are really intended to be global, and exchange data across events and function.

The quick and dirty way to fix it is to change the include order of the slic files: So first CRA_wonderunits.slc, CRA_pow.slc, and then CRA_pow.slc.

Probably this won't be enough, but it should remove the symbol undefined errors. For the symbol already have a type error, you can outcomment the symbol redefinition.

quote:

slc: 210 Symbol AgeGREAT_GENERAL undefined


That line doesn't seem to do anything in your script so it can go, or being outcommented.

quote:

slc: 235 GREAT_GENERAL not string variable


Looks like a message box is missing.

-Martin

hexagonian
The Courts of Candle'Bre
Emperor
Smemperor
Jun 1999
time: 21:44
25-06-2008 01:37 | www
edit | quote
#5 | report |
Lose 30 kilos (of popups)


Rearranging the order in script.slc appears to do the trick. I actually didn't have to outcomment anything. It also explains why the pow.slc file stopped working for me about a week ago, and I hadn't done anything to that file - but I had alphabetized the slics in script.slc for bookkeeping purposes.

No guarantee that it will hold up, but the only new slic I now have is the elite.slc, and Cradle has been running pretty stable since 2001, so any crashes will probably be trackable to that file.

Fixed the last two problems too, although I did have the messageboxes in.

I renamed GREAT_GENERAL to Gsix (following the naming sequence of the other messages I had in the slc file.)

Thanks

Immortal Wombat
Apolytoners Hall of Fame
Prince
in perpetuity
Dec 2000
time: 03:44
04-07-2008 16:25 | www
edit | quote
#6 | report |
Lose 30 kilos (of popups)


Urgh, yes. that'll be all my fault. Sorry.

It's buggy anyway, the variable names in this line need to agree. (tmpNum2 in this case)
code:
if(tmpNum2 >= 112 && tmpNum <= 117){


This is better, assuming I haven't introduced any new bugs.

code:
//--------------------------------------- // Prisoners of War 1.02 // by the Immortal Wombat //--------------------------------------- int_t POW_TYPE[]; //----------------------- // Begin Game Setup HandleEvent(BeginTurn) 'GameStart' pre { POW_TYPE[0] = UnitDB(UNIT_WARRIOR); POW_TYPE[1] = UnitDB(UNIT_SPEARMAN); POW_TYPE[2] = UnitDB(UNIT_HOPLITE); POW_TYPE[3] = UnitDB(UNIT_MAN_AT_ARMS); POW_TYPE[4] = UnitDB(UNIT_INFANTRYMAN); POW_TYPE[5] = UnitDB(UNIT_MACHINE_GUNNER); POW_TYPE[6] = UnitDB(UNIT_HOVER_INFANTRY); DisableTrigger('GameStart'); //run once only } //---------------------- // Get Player Age int_f WOUTER_GetAge(int_t thePlayer) { int_t tmpPlayer; tmpPlayer = thePlayer; if (HasAdvance(tmpPlayer, ID_ADVANCE_PLASMA_WEAPONRY)) { return 6; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_ADV_INFANTRY_TACTICS)) { return 5; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_RAILROAD)) { return 4; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_BANKING)) { return 3; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_COMPOSITE_BOW)) { return 2; } elseif (HasAdvance(tmpPlayer, ID_ADVANCE_TOOLMAKING)) { return 1; } else { return 0; } } //-------------------------------------------- // Capturing event void_f CaptureUnit(location_t theLocation, int_t thePlayer){ location_t tmpLoc; int_t POWage; int_t tmpPlayer; tmpPlayer = thePlayer; tmpLoc = theLocation; POWage = WOUTER_GetAge(tmpPlayer); Event:CreateUnit(tmpPlayer, tmpLoc, 0, POW_TYPE[POWage], 1); Event:GroupOrder(army[0]); } //------------------ // Battle event HandleEvent(VictoryMoveOrder) 'capture' pre { location_t tmpLoc; army_t tmpArmy; unit_t tmpUnit; int_t tmpNum; int_t tmpNum2; int_t tmpPlayer; int_t POWage; int_t IsThere; int_t i; tmpArmy = army[0]; tmpNum = tmpArmy.size; tmpPlayer = army[0].owner; tmpLoc = army[0].location; IsThere = 0; for(i = 0; i < tmpNum; i = i + 1) { GetUnitFromArmy(tmpArmy, i, tmpUnit); tmpNum2 = tmpUnit.type; if(tmpNum2 >= 112 && tmpNum2 <= 117){ // ID of chosen units IsThere = 1; } } if(IsThere == 1){ POWage = WOUTER_GetAge(tmpPlayer); //get age (for messaging purposes) if(POWage == 6){ message(tmpPlayer, 'six'); CaptureUnit(tmpLoc, tmpPlayer); //and run the captureunit function } elseif(POWage == 5){ message(tmpPlayer, 'five'); CaptureUnit(tmpLoc, tmpPlayer); } elseif(POWage == 4){ message(tmpPlayer, 'four'); CaptureUnit(tmpLoc, tmpPlayer); } elseif(POWage == 3){ message(tmpPlayer, 'three'); CaptureUnit(tmpLoc, tmpPlayer); } elseif(POWage == 2){ message(tmpPlayer, 'two'); CaptureUnit(tmpLoc, tmpPlayer); } elseif(POWage == 1){ message(tmpPlayer, 'one'); CaptureUnit(tmpLoc, tmpPlayer); } } }

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 03:44.
Apolyton Time is 22:44.
    top of page
Rate This Thread:
Forum Jump:

 



  Contact Us - Apolyton Civilization Site - Support Us!
Log Out Unregistered
Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.3067 seconds (79.98% PHP - 20.02% MySQL) with 51 queries
Page Loading Time:

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