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 > Civilization: Call To Power > CtP-Creation > Spawning units possible?
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
12.Sep: `CTP CHALLENGE LADDER` - SEPTEMBER UPDATE
09.Sep: EARLY BUILD SPRITE EDITOR
02.Aug: `SUPERLEAGUE` SIGN-UP

bottom of page
  - CIVILIZATION: CALL TO POWER @ GAMESTOP $9.99 - CIVILIZATION: CALL TO POWER @ AMAZON $9.99
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 07-04-2004 03:29
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Spawning units possible? Lose 30 kilos (of popups)

..on a related issue to scenario I am working on...

I was wondering if it would be possible..say..to spawn a free tank in each city...

Would I need a trigger of some sort...SLIC induced perhaps??

Let me know..thought it would be neat...say your in the middle of a heated battle and got say 50 tanks because you had 50 cities!!

or... all your ai civs came up with 40 + tanks then you have that to contend with!!

Me be thinking outloud and outta da box!!

Peace

Grandpa "Posting-whilst-EYE-B-Thinking" Troll

Attachment: professor dopey.jpg
This has been downloaded 22 time(s).

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:35
  Old Post 07-04-2004 04:19 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Support Apolyton or Terrorists Win

Spawning units is one of the easiest things to do in SLIC -- one example is the Settlers code I linked to a few days ago. What should trigger the spawn?

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 07-04-2004 05:23
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Locutus
Spawning units is one of the easiest things to do in SLIC -- one example is the Settlers code I linked to a few days ago. What should trigger the spawn?


Great!

I was hoping that say once a civilization discovered say Mass Production every city built gets a free marine.

Then again on Tanks same deal.

I see where you had it for the beginning, would it be hard to simply spawn a unit in each city once the tech is discovered?

In regards to the other post on spawing additional settlers...say each city you have built when you hit year 50 BC every city spawns a settler...
Then maybe again in turn 1000 AD


Question:

I dont remember, does the computer track "turns"...like I allways start Renaissance in MP games, most of the time. That is turn 75.

I was wondering if a trigger say..when you hit turn 75 each city gets a settler then again in say turn 150.

Thanks for the response...


I have my Uncle below in case I (WE) accidently create bugs..
Grandpa Troll

Attachment: exterminator01.jpg
This has been downloaded 22 time(s).

Locutus is offline Locutus
ACS CTP1/2 Manager & Civ4 Co-Manager
Hengelo, The Netherlands
Nov 1999
time: 06:35
  Old Post 07-04-2004 18:05 Visit Locutus<br><img src=/forums/images/staff-icon.gif>'s homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Avatar Enlargement: We've got the solution

Okay, I made example for the case of Tanks: as soon as Tank Warfare is discovered, you get a free Tank in every city (note that this code is untested but based on the Militia code for the MedMod, so it should work).

Note that you have to use the index for advances, you can't call them by name in CtP1 as you can do with units. The index is simply its location in advance.txt: ADVANCE_AGRICULTURE is 0, ADVANCE_TOOLMAKING is 1, etc (in the original game).

code:
trigger 'SpawnTank' when (player.1 && discovery.type == 55) { // 55 = tank warfare i = 0; while (i < player.1.cities) { // loop through all cities SetCityByIndex(1, player.1, i); CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank i = i + 1; } }

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 08-04-2004 07:40
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton buy from Amazon

Thanks..I been working some 16 hour days..hopefully can try out tommorrow!
Ill post back!

'Preciate it!

Attachment: customer_service_desk_sleeping.gif
This has been downloaded 20 time(s).

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 09-04-2004 05:44
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Originally posted by Locutus
Okay, I made example for the case of Tanks: as soon as Tank Warfare is discovered, you get a free Tank in every city (note that this code is untested but based on the Militia code for the MedMod, so it should work).

Note that you have to use the index for advances, you can't call them by name in CtP1 as you can do with units. The index is simply its location in advance.txt: ADVANCE_AGRICULTURE is 0, ADVANCE_TOOLMAKING is 1, etc (in the original game).

code:
trigger 'SpawnTank' when (player.1 && discovery.type == 55) { // 55 = tank warfare i = 0; while (i < player.1.cities) { // loop through all cities SetCityByIndex(1, player.1, i); CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank i = i + 1; } }


Worked like a charm...

I have the years per turn slowed down so that I have plenty of years of growth and Battle with the latest technology...

I discovered Tanks at turn 52 and each of my cities got a free tank!

Works great!

I will continue to work with the model SLIC you wrote to work on my scenario!

Now..to resolve the settler-spawn issue...

Peace

Grandpa "Voting-Locutus-4-Prez"Troll

Attachment: supreme dancing troll.jpg
This has been downloaded 18 time(s).

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 04:06
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Full PM-box? Change here!

quote:
Originally posted by Locutus
Okay, I made example for the case of Tanks: as soon as Tank Warfare is discovered, you get a free Tank in every city (note that this code is untested but based on the Militia code for the MedMod, so it should work).

Note that you have to use the index for advances, you can't call them by name in CtP1 as you can do with units. The index is simply its location in advance.txt: ADVANCE_AGRICULTURE is 0, ADVANCE_TOOLMAKING is 1, etc (in the original game).

code:
trigger 'SpawnTank' when (player.1 && discovery.type == 55) { // 55 = tank warfare i = 0; while (i < player.1.cities) { // loop through all cities SetCityByIndex(1, player.1, i); CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank i = i + 1; } }


Question Oh Great Locutus

Say I decide upon something like a Blitzkreig (a.k.a. Lightning War) type scenario..where I would say create maybe 4 tanks per city or whatever the number may be..

What number in the above code would I change?

I was thinking it was i=i + 1;..change the "1" to a "2" to read the following i=i + 2

Would this be correct?

I am trying to teach myself this and would greatly appreciate any assistance...


I forget..maybe it was Big Dave..years ago..or maybe JByethway..at any rate....

they responded in a post...something like this:

EDIT:

TEST:

EDIT:

TEST:

and it dawned on me..DUH!...try and if it works..great if not dont..

Point in case..I had my PW trigger..set at 60 pw per citizen..seems great but very quickly you have far to much pw......

I backed down to 16 per citizen and maybe..will back that down..soon..

I have a hamster wheel spinning around in me head..I am just trying N tweaking to make some enjoyable scenarios...



HEY BLACKICE!!!!!! GUESS WHAT..I CAN PLAY SCENARIOS THE WAY I WANT SO AS NO ONE IS EXPOSED TO MY EXCLUDED UNITS!!!

Whoa...This makes me sooooo happy!!


Peace

Grandpa Troll

Attachment: hamster wheel.jpg
This has been downloaded 13 time(s).

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:35
  Old Post 12-04-2004 04:49 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Avatar Enlargement: We've got the solution

quote:
Originally posted by Grandpa Troll
Say I decide upon something like a Blitzkreig (a.k.a. Lightning War) type scenario..where I would say create maybe 4 tanks per city or whatever the number may be..

What number in the above code would I change?

I was thinking it was i=i + 1;..change the "1" to a "2" to read the following i=i + 2

Would this be correct?


Nope, doing that would make it create a tank in every other city, rather than in every city. The simplest way to do what you want is to duplicate the CreateUnit(...) line, if there are two of them it will make two units. A slightly more elegant way would be something like this:

code:
trigger 'SpawnTank' when (player.1 && discovery.type == 55) { // 55 = tank warfare i = 0; while (i < player.1.cities) { // loop through all cities SetCityByIndex(1, player.1, i); j=0; while (j < 4) { CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank j = j + 1; } i = i + 1; } }


Which should create 4 tanks in each city. The number 4 there is the one you want to change. This creates the tanks and at the same time counts with j from 0 to 3 (as I said, we tend to count from 0 here...), creating a tank at each value of j, and thus producing 4 tanks.

(Usual disclaimers apply: untested, etc.)

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 05:14
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

I just tried the repeating the create unit line and it works like a champ!

Another question...

Lets say I wanted to have an ocean game..and had a trigger to add sol's and later battleships...

I am taking it that only ocean or lake front tiles would create them..

My concern is a game crashing if the loop was for all cities but not all cities could produce them?

Thanks

GT

Attachment: bald_eagle_searching_md_wht.gif
This has been downloaded 13 time(s).

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:35
  Old Post 12-04-2004 05:28 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

I think there might be a function that checks whether a city is coastal or not - have a look at the function reference and see if you can spot anything useful.

In fact, though, I think you won't have any problems - if the game cannot create the unit it will probably simply carry on without crashing. A more likely problem is that you'll end up with landlocked ships.

Anyway, give it a try and see what happens - experimentation is the best way to learn .

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 05:36
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton

..I will thanks

Problem now......

I went and tried then above mentioned idea of copying the create unit for a unit

I got 4 marines in some cities no marines in other cities

repeat for tanks..the exact cities that got the 4 marines got 4 tanks

I did fortify the marines outside of city so as to make room for the tanks

I have 51 cities...

I got 52 marines

then 52 tanks

Any reason you can think of?
I am going to copy the triggers..maybe you can see where I failed...

trigger 'SpawnTank' when (player.1 && discovery.type == 55) { // 55 = tank warfare
i = 0;
while (i < player.1.cities) { // loop through all cities
SetCityByIndex(1, player.1, i);
CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_TANK"), city.location, 0); // create a tank
i = i + 1;
}
}
trigger 'SpawnMarines' when (player.1 && discovery.type == 59) { // 59 = Mass Production
i = 0;
while (i < player.1.cities) { // loop through all cities
SetCityByIndex(1, player.1, i);
CreateUnit(player.1, UnitType("UNIT_MARINES"), city.location, 0); // create a marine
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_MARINES"), city.location, 0); // create a marine
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_MARINES"), city.location, 0); // create a marine
i = i + 1;
CreateUnit(player.1, UnitType("UNIT_MARINES"), city.location, 0); // create a marine
i = i + 1;
}
}

Thanks

GT

Attachment: brain leaving head.gif
This has been downloaded 13 time(s).

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 05:45
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Civilization: The Boardgame

quote:
Originally posted by J Bytheway
I think there might be a function that checks whether a city is coastal or not - have a look at the function reference and see if you can spot anything useful.

In fact, though, I think you won't have any problems - if the game cannot create the unit it will probably simply carry on without crashing. A more likely problem is that you'll end up with landlocked ships.

Anyway, give it a try and see what happens - experimentation is the best way to learn .


Actually, I do love finding a city with a tile or two of water.then i often create a 9 stack of Battleships..

this way, in effect, you have a possibility of 18 units...

awesome bombardment capabilities, plus if your city gets attacked you now have 9 to replace units with....


OR

U can take that 9 stack and use them to help build an improvement by disbanding them within the city...to help "rush-buy" something like an oil refinery or drug store....


Peace

GT

Attachment: briteidea.gif
This has been downloaded 13 time(s).

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 06:15
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Get a bigger avatar today!

..just studying the code..was I supposed to copy the whole text..and then it makes a unit in each city?

As in maybe 2 + duplicates of "all" the trigger..

or as asked above..simply the line "creat unit....."??

Thanks..just grabbing some..well...

Attachment: straws.jpg
This has been downloaded 13 time(s).

J Bytheway is offline J Bytheway
Emperor
England
Jul 2001
time: 05:35
  Old Post 12-04-2004 17:05 Visit J Bytheway's homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Browse Apolyton AD-FREE

You shouldn't copy the i = i + 1 lines - that's making it skip some of your cities. Just copy the CreateUnit lines.

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 20:45
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

quote:
Originally posted by J Bytheway
You shouldn't copy the i = i + 1 lines - that's making it skip some of your cities. Just copy the CreateUnit lines.


thx a bunch!

GT

Attachment: come into the factories.jpg
This has been downloaded 11 time(s).

Grandpa Troll is offline Grandpa Troll

Immortal
I owe..I owe..it's off to work I go
Jul 2000
time: 00:35
  Old Post 12-04-2004 21:29
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations: Deluxe Edition

Sweet!

I briefly checked and all works fine.

NOTE:

To any whom try this;

I followed the guidance of the esteemed Monseignor JBYTHEWAY and missed a small point!

I copied the lines create unit but when I removed

i= i + 1

I deleted all the i= i + 1 and should have actually left the first one!

Ok..so..all together tell Grandpa Troll.....

Attachment: you moron.jpg
This has been downloaded 9 time(s).

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