 |
|  |
 |
|  |
 |
|
Locutus
|
|
ACS CTP1/2 Manager & Civ4 Co-Manager
|
 |
Hengelo, The Netherlands
Nov 1999 time: 06:35
|
|
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

|
 |
I owe..I owe..it's off to work I go
Jul 2000 time: 00:35
|
|
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

|
 |
I owe..I owe..it's off to work I go
Jul 2000 time: 00:35
|
|
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
|
 |
England
Jul 2001 time: 05:35
|
|
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

|
 |
I owe..I owe..it's off to work I go
Jul 2000 time: 00:35
|
|
..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).
|
|
|  |
 |
|  |
All times are GMT. The time now is 05:35. Apolyton Time is 00:35. |
top of page
|
|
|
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
|
|
|
|
|
|