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 > Need help with mod
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
KaiserWill is offline KaiserWill
Settler
Adelaide, SA, Australia
Mar 2001
time: 05:14
Unhappy  Old Post 08-05-2001 17:48
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Need help with mod Support Apolyton, buy Civilization III: Complete

I'm sick of having to laboriously replace all my obsolete units with new ones so I'm writing a mod that automatically updates any units fortified inside my cities to the latest technology. My first effort worked nicely only I used KillUnit to remove the old units which generated several minutes of unwanted sound effects of the units dying. I thought I'd try grouping the obsolete units into armies & then disbanding them but I just can't get them to disband. Here's part of the code I'm using (please don't laugh - I'm new to all this!). Can anyone tell me where I'm going wrong?

int_t p_counter;
int_t k_counter;
int_t counter;
army_t UAR_disarmy;
army_t UAR_tmparmy;
unit_t UAR_tmpunit;
city_t UAR_tmpcity;
int_t UAR_citycount;
int_t UAR_whilecount;
int_t UAR_forcount;
int_t UAR_tmploc;
int_t UAR_inf_type;

void_f UAR_ME_Routine() {
UAR_citycount = player[0].cities+1;
for (UAR_whilecount = 0; UAR_whilecount < UAR_citycount; UAR_whilecount = UAR_whilecount +1) {
GetCityByIndex(player[0], UAR_whilecount, UAR_tmpcity);
UAR_tmploc = UAR_tmpcity.location;
if(CityIsValid(UAR_tmpcity)) {
UAR_unitcount = GetUnitsAtLocation(UAR_tmploc);
Event:CreatedArmy(UAR_disarmy);
for (UAR_forcount = 0; UAR_forcount < UAR_unitcount; UAR_forcount = UAR_forcount + 1) {
GetUnitFromCell(UAR_tmploc, UAR_forcount, UAR_tmpunit);
if (UAR_tmpunit.valid) {
UAR_inf_type = UAR_tmpunit.type;
if (UAR_inf_type == UnitDB(UNIT_HOPLITE)
| | UAR_inf_type == UnitDB(UNIT_WARRIOR)) {
p_counter = p_counter + 1;
GetArmyFromUnit(UAR_tmpunit, UAR_tmparmy);
Event:UngroupOrder(UAR_tmparmy);
Event:GroupUnitOrder(UAR_disarmy, UAR_tmpunit);
counter = counter + 1;
} elseif (UAR_inf_type == UnitDB(UNIT_SWORDSMAN)) {
k_counter = k_counter + 1;
GetArmyFromUnit(UAR_tmpunit, UAR_tmparmy);
Event:UngroupOrder(UAR_tmparmy);
Event:GroupUnitOrder(UAR_disarmy, UAR_tmpunit);
counter = counter + 1;
}
}
Event isbandArmyOrder(UAR_disarmy); //doesn't work
if (counter > 0) {
while (k_counter > 0) {
CreateUnit(player[0],UnitDB(UNIT_KNIGHT),UAR_
tmploc,0,UAR_tmpunit);
Event:EntrenchUnit(UAR_tmpunit);
k_counter = k_counter - 1;
}
while (p_counter > 0) {
CreateUnit(player[0],UnitDB(UNIT_PIKEMEN),UAR
_tmploc,0,UAR_tmpunit);
Event:EntrenchUnit(UAR_tmpunit);
p_counter = p_counter - 1;
}
}
}
}
}
}

KaiserWill is offline KaiserWill
Settler
Adelaide, SA, Australia
Mar 2001
time: 05:14
Exclamation  Old Post 08-05-2001 17:51
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Enter the AD-FREE zone

ACK! Don't know what happened to all the tabs in my post, or what that smiley face is doing instead of the D in DisbandArmyOrder. Oh well, you get the idea anyway...

Immortal Wombat is offline Immortal Wombat
Prince
in perpetuity
Dec 2000
time: 05:14
Post  Old Post 08-05-2001 22:41 Visit Immortal Wombat's homepage!
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton buy from Amazon

You're new to this ?? Hell it took me ages to get anything like that confident. The appears when you put : D together. Tabs fail unless you use the UBB code - [ code ] (without the spaces)

eg.

code:
Event: DisbandArmyOrder(UAR_disarmy); // Is there a space in here between event and : ? if (counter > 0) { while (k_counter > 0) { CreateUnit(player[0],UnitDB(UNIT_KNIGHT),UAR_tmplo c,0,UAR_tmpunit); Event:EntrenchUnit(UAR_tmpunit); k_counter = k_counter - 1; } }


As for the actual error. I can't help I'm afraid. What exactly was the error message ?

Ben
[This message has been edited by Immortal Wombat (edited May 08, 2001).]

WesW is offline WesW
CTP1/2 Modification Site Admin
Florence, Al., USA
Jan 1970
time: 23:14
Post  Old Post 09-05-2001 02:42 Visit WesW's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

This sounds similar to what Locutus tried to do with the militia code, and he have run into all kinds of problems with it, from functions not working to saved game failures. I doubt that you will be able to get this trigger to work, at least not without reloading slic each time you load the game.

KaiserWill is offline KaiserWill
Settler
Adelaide, SA, Australia
Mar 2001
time: 05:14
Post  Old Post 09-05-2001 10:45
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Help yourself to an AD-FREE life

I don't get an error message, and the right number of replacement units show up fine, it's just that the old units I want to get rid of don't disappear. As I said KillUnit does the job but you have to put up with five minutes of "urgh!" and "ach!" as each old unit dies. I think I'll settle for the easy option of automatically creating one or two free new-technology defensive units per city, and then manually disbanding the old ones en masse using the army management screen. If I ever get the unit-replacement code to work I'll package it properly and submit it though, coz it's one big beef I have with the game that you can't upgrade any of your units.

Dale is offline Dale
King
Sir! Why do you keep clicking on me?
Dec 2000
time: 15:14
Post  Old Post 09-05-2001 11:38
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Avatar Enlargement: We've got the solution

Kaiser:
It's a hellova lot easier to use DisbandUnit event instead of the DisbandArmyOrder. Try this. Extract the unit you want to disband and put it in a temp variable like tmpUnit. You're using GetUnitsInCell anyways, so make use of it! Then just use this command:

Event: DisbandUnit(tmpUnit);

There's no death animations, no sounds, no count against killed units, it just disappears. This is what I use for the withdraw script.

Hope this helps.
Dale

------------------
Rommell to a sub-commander outside Tobruk: "Those Australians are in there somewhere. But where? Let's advance and wait till they shoot, then shoot back."

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:14
Post  Old Post 09-05-2001 16:02 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Full PM-box? Change here!

Most of the xxxOrder events don't seem to work if you want to call them (listening to them does seem to work in most cases). In order to have some action take place, you'll have to use the event that does the actual job, not the event that gives the order to do it. So, not only is DisbandUnit easier, it's also the only thing that will actually work (I tested it on the Militia code as well, worked fine except that all units disbanded inside cities added production points to whatever that city was building, something I didn't like).

I don't think any of the bugs in SLIC itself (in particular the savegame-bug) will give you any problems with this code, but only by testing it extensively can you find out for sure.
[This message has been edited by Locutus (edited May 09, 2001).]

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