Thread Tools
Old December 4, 2002, 04:36   #1
Devil of Truth
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Devil of Truth's Avatar
 
Local Time: 14:03
Local Date: November 1, 2010
Join Date: Sep 2002
Location: Keep honking... I'm reloading.
Posts: 351
I want to kill exactly 7 people. Volunteers?
Ok, now that I have your attention...

I want to kill exactly 7 (or 7 percent) of my adoring citizens from one my cities using SLIC. Obviously, if I'm feeling less benevolent, I want to be able to edit the SLIC file and change this value to say 351, or whatever strokes my fancy at that time.

Don't ask me why I want to do this. Let's just say I don’t like their attitudes.

The bit of the code I'm using at the moment (stolen from IW; Peter Triggs et al - thanks guys ):

int_t tmpDead;
int_t tmpCounter;
city_t tmpCity;

city[0] = tmpCity;

tmpDead = city[0].population/10;

for (tmpCounter = 0; tmpCounter < tmpDead; tmpCounter = tmpCounter + 1) {
Event:KillPop(tmpCity);
}

This doesn't quite do what I'm looking for. Can anybody help?
__________________
If something doesn't feel right, you're not feeling the right thing.
Devil of Truth is offline  
Old December 4, 2002, 05:46   #2
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
i dont thinck its posible because you are dividing integers. it wont work becase after division the number is rounded up to the nearest hole number so a city with a pop of 15 will lose .5 of the pop more then your 7%.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 4, 2002, 05:57   #3
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:03
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
That should kill of 10% of the population, though you'd need to put it into an event handler, depending on when you wanted them to die. If it's every turn, you need a handler that fires every turn. For simplicity's sake, if you wanted to do every city, the line:
Code:
HandleEvent(BeginCityTurn) 'kill10pcpt' pre{
// kill stuff code as above
}
at the beginning would kill of 10% from every city in the game.

If you want a specific city (Don't know how you want to choose which one) you'll need either its name or its index. eg. for the capital, use this:

Code:
HandleEvent(BeginCityTurn) 'kill10pcpt' pre{
if(IsHumanPlayer(player[0]))  // the human
      city_t  tmpCity;
      GetCityByIndex(player[0], 0, tmpCity);  // store your capital 
      if(tmpCity == city[0]){
           // insert kill stuff code here
      }
}
}

If you want to kill 7 citizens, simply use your code, but replace
Code:
tmpDead = city[0].population/10;
with
Code:
tmpDead = 7;
To get 7%, use:
Code:
tmpDead = city[0].population*7;
tmpDead = tmpDead/100;
Done separately to avoid rounding errors when SLIC tries to do fractions (it can't).

hope this helps, and is comprehensible
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old December 4, 2002, 05:59   #4
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:03
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
/me realsies there's a good chance you knew most of that, and are getting rounding errors*
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old December 4, 2002, 06:33   #5
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
wombat does this mean you are volunteering!
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 4, 2002, 09:35   #6
Devil of Truth
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Devil of Truth's Avatar
 
Local Time: 14:03
Local Date: November 1, 2010
Join Date: Sep 2002
Location: Keep honking... I'm reloading.
Posts: 351
Thanks Big Mc and IW for your help and suggestions. As always, much appreciated.

Unfortunately, I still cannot wreak my revenge on exactly 7 lucky individuals. Here’s why:

* Create a SLIC with the code as suggested, and set tmpDead to 7 (tmpDead = 7;
* Add the SLIC to script.slc blah-blah-blah;
* Create a new game;
* Build a city and cheat it to population size 10 (just so we’re clear - when I say population size, I mean the number below the city name.)

You should now be the proud owner of a city with 100 000 inhabitants! (Even though I suck at math), the city should grow by: 100 000 + growth - 7;

Right?

Wrong. (End the turn.)

Whoa! The city now has +/-30 000 people! Where have 69 993 folks disappeared to?

Instead of inflicting my benevolent rule on exactly 7 people - I’ve now slaughtered them and their entire family and all their friends and all their friends’ family and their bank managers and their family and the guy that delivers the paper and his family and the dude that tries to wash your car at a red light and his family and their neighbours and their family and their neighbours’ neighbours and their families and… you get the picture.

It seems Event:KillPop(tmpCity); doesn’t use the city population, instead, it uses the population number. (If I’ve just said something that everybody else already knew - ignore it.)

Nevertheless, the question still stands. How do I kill exactly 7 people?
__________________
If something doesn't feel right, you're not feeling the right thing.
Devil of Truth is offline  
Old December 4, 2002, 09:48   #7
child of Thor
Call to Power II Democracy GameCTP2 Source Code Project
Emperor
 
child of Thor's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Jan 2002
Location: UK
Posts: 3,272


DoT i sure hope you can sleep easy at night. I suppose you could put it down to a catastrophic government mistake......some experiment gone wrong, either way i wouldn't want to be one of your citizens during this experiment, I have a feeling more may perish
__________________
'The very basis of the liberal idea – the belief of individual freedom is what causes the chaos' - William Kristol, son of the founder of neo-conservitivism, talking about neo-con ideology and its agenda for you.info here. prove me wrong.

Bush's Republican=Neo-con for all intent and purpose. be afraid.
child of Thor is offline  
Old December 4, 2002, 09:49   #8
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:03
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Code:
(...)
	for(i=0; i > 7; i = i + 1) {
		Event:KillPop(tmpCity); 
	}
(...)
or

Code:
(...)
	AddPops(tmpCity, -7);
(...)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old December 4, 2002, 09:49   #9
Immortal Wombat
Apolytoners Hall of Fame
Prince
 
Immortal Wombat's Avatar
 
Local Time: 13:03
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
Quote:
It seems Event:KillPop(tmpCity); doesn’t use the city population, instead, it uses the population number.
Yes... 'fraid so.

So 7 people rather than 7 pop points? That's much harder. Very little SLIC deals with the actual population. Um...

Probably the best way is to plant some sort of tile improvement to fine tune the actual growth of the city. I don't know if it would work properly.

Can I ask why you would wish to?
__________________
Concrete, Abstract, or Squoingy?
"I don't believe in giving scripting languages because the only additional power they give users is the power to create bugs." - Mike Breitkreutz, Firaxis
Immortal Wombat is offline  
Old December 4, 2002, 09:52   #10
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:03
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
The city now has +/-30 000 people! Where have 69 993 folks disappeared to?
I just saw this
sorry it is impossibe (I think)
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old December 4, 2002, 10:39   #11
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
it is possible but only in a msg box.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 4, 2002, 10:42   #12
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:03
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
how???
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old December 4, 2002, 10:44   #13
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
very easy indeed but i have to run for the bus now sea you tomorrow after 2.30pm gmt.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
Old December 4, 2002, 10:49   #14
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:03
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
Pedrunn is offline  
Old December 4, 2002, 20:33   #15
HuangShang
Call to Power II Democracy GameCTP2 Source Code Project
King
 
HuangShang's Avatar
 
Local Time: 05:03
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Berkeley
Posts: 1,375
the title really tight but i dont uderstand anything u guy said
HuangShang is offline  
Old December 5, 2002, 04:56   #16
Devil of Truth
Call to Power II Democracy GameCall to Power Democracy GameCTP2 Source Code Project
Prince
 
Devil of Truth's Avatar
 
Local Time: 14:03
Local Date: November 1, 2010
Join Date: Sep 2002
Location: Keep honking... I'm reloading.
Posts: 351
Thanks again everybody.

coT, I sleep the peaceful sleep of the righteous at night. My citizens understand the importance of the "Grand Experiment." They realise it’s for the "Greater Good." Their "Grandiose Patriotism" will always be remembered. And those that don’t agree with me – die ! So, everybody wins!

Quote:
Very little SLIC deals with the actual population.
IW, I was afraid of that. I had a feeling that SLIC wouldn’t let me do it!

The reason for all this bloodshed: A friend of mine remarked that he’d like something like Cancer or Bubonic Plague or Smallpox or Cholera or Whatever to affect the citizens of his cities. Every turn a very small number of people in every city dies – not enough to be irritating - but enough to hamper growth a tad. This would be triggered by an advance or an age, and would continue until either a cure is discovered, or a wonder is built (Cure for Cancer in Civ2). I think it makes a nice little sub-plot. A race within a race. I also thought it wouldn’t be too difficult...

Pedrunn - NO ! You cannot possibly say "impossible" so flippantly! You’re one of my CTP2 heroes! Don’t let me down. (Besides – I have a rather embarrassing Pedrunn quote on impossibility right here.)

Big Mc, the wilful decimation of my population is on your shoulders now. No pressure.
__________________
If something doesn't feel right, you're not feeling the right thing.
Devil of Truth is offline  
Old December 5, 2002, 07:47   #17
Pedrunn
Call to Power II Democracy Game
King
 
Pedrunn's Avatar
 
Local Time: 09:03
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
Quote:
Originally posted by Devil of Truth
Pedrunn - NO ! You cannot possibly say "impossible" so flippantly! You’re one of my CTP2 heroes! Don’t let me down. (Besides – I have a rather embarrassing Pedrunn quote on impossibility right here.)
Ooops!


At least thanks to Big Mc we know how meanless this word is around here.
No matter what this doesnt mean that the effect you want cant be work around. We can always remove the people with invisible TI's or unamed buildings with food penalties. Not as accurate but efficient.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand

Last edited by Pedrunn; December 5, 2002 at 07:57.
Pedrunn is offline  
Old December 5, 2002, 10:25   #18
The Big Mc
CTP2 Source Code Project
King
 
The Big Mc's Avatar
 
Local Time: 12:03
Local Date: November 1, 2010
Join Date: Oct 2001
Location: Of the universe / England
Posts: 2,061
The only way to do it if may reasoning is right is to model the civs growth. This is to mean that the word estimate is put in front of the pop in the city view windows. And then use msq boxes to say that “7 people have been killed in the great experiment today”. Then using the INT CityFoodDelta(city) function one can model the citys growth pattern then minus a pop point or so when the dead of the exsperimant = 501 or greater. every turn you would add the regular new pop so the 501 would becom 491 if ten people are added per turn then you would minus the dead of the experiment. So the city growth is reduced.

if you think I wont to program it I suggest you turn to some one else.
__________________
"Every time I learn something new it pushes some old stuff out of my brain" Homer Jay Simpson
The BIG MC making ctp2 a much unsafer place.
Visit the big mc’s website
The Big Mc is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 08:03.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team