August 3, 2002, 15:51
|
#31
|
Super Moderator
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Immortal Wombat
Would triggering a STOP on the CreateImprovement event also stop the event which is supposed to create the wonder?
|
Yes without further modifications. But you could use a global variable if it is set to 0 then the tile improvement can't be build, if it is set to 1 it can be build. So in the event that should build the wonder improvement it will be set to 1 and afterwards to 0 again. But actual I think giving and removing the enabling advance is the way to, because the AI will try only to build the wonder improvments instead of the real ones, so in the end it wouldn't build anything.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 3, 2002, 16:00
|
#32
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
If I gave it an insanely high PW cost, would the AI save up for it, or build cheaper ones?
__________________
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
|
|
|
|
August 3, 2002, 16:10
|
#33
|
Super Moderator
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Immortal Wombat
If I gave it an insanely high PW cost, would the AI save up for it, or build cheaper ones?
|
You could try it but I think the AI will save up for the best tile improvements that are available. I never saw an AI building roads when it was able to build railroads, the same is true for all the other tileimprovements.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 3, 2002, 16:25
|
#34
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Yeah, good point. It'll have to be the advances then
__________________
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
|
|
|
|
August 4, 2002, 18:23
|
#35
|
Deity
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
|
Uhm, why don't you just give all the TileImps an advance as prerequisite that's impossible to research (i.e. has itself as prerequisite or is disabled with the mod_* SLIC function)?
|
|
|
|
August 4, 2002, 18:32
|
#36
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Extra text file. Not a major problem, but annoying.
Unless I use Subneural Ads as that advance. Which is basically what I was going to do anyway.
__________________
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
Last edited by Immortal Wombat; August 4, 2002 at 18:39.
|
|
|
|
August 4, 2002, 18:35
|
#37
|
Deity
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Nov 1999
Location: De Hel van Enschede
Posts: 11,702
|
So? What's 20k on a 6MB download?
|
|
|
|
August 4, 2002, 18:40
|
#38
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
6Mb??
__________________
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
|
|
|
|
August 16, 2002, 16:21
|
#39
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Locutus
Uhm, why don't you just give all the TileImps an advance as prerequisite that's impossible to research (i.e. has itself as prerequisite or is disabled with the mod_* SLIC function)?
|
what are the variables for the mod_CanPlayerHaveAdvance function?
(int_t , ) ???
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 16, 2002, 16:40
|
#40
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
int_t [player], int_t [advanceDB index]
__________________
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
|
|
|
|
August 16, 2002, 16:40
|
#41
|
Super Moderator
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Pedrunn
what are the variables for the mod_CanPlayerHaveAdvance function?
(int_t, ) ???
|
Just take a look into the WW_mod.slc and you will find this:
Code:
|
// Players can not research any new technologies
int_f mod_CanPlayerHaveAdvance (int_t thePlayer, int_t theAdvance)
{
if (theAdvance == AdvanceDB(ADVANCE_ADV_NAVAL_TACTICS) ||
theAdvance == AdvanceDB(ADVANCE_VERTICAL_FLIGHT_AIRCRAFT) ||
theAdvance == AdvanceDB(ADVANCE_SUPERSONIC_FLIGHT) ||
theAdvance == AdvanceDB(ADVANCE_MASS_TRANSIT) ||
theAdvance == AdvanceDB(ADVANCE_COMPUTER) ||
theAdvance == AdvanceDB(ADVANCE_GLOBAL_ECONOMICS) ||
theAdvance == AdvanceDB(ADVANCE_CORPORATE_REPUBLIC)) {
return 0;
} else {
return 1;
}
} |
So the first argument is the player index in the game in integer form.
And the second argument is the advance represented by an integer the DataBase index of the advance.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 16, 2002, 16:56
|
#42
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Thanks
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 16, 2002, 17:58
|
#43
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Did I mention, the wonder code should work - provided when you test it, you don't complete two wonders on consecutive turns. Otherwise the TI isn't built properly, and problems occur.
__________________
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
|
|
|
|
August 16, 2002, 19:11
|
#44
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
This is making the game crash after lauching it. Any suggestion on how to make this code work.
Code:
|
int_t ExpansionPlayer;
int_f mod_CanPlayerHaveAdvance(int_t thePlayer, int_t theAdvance) {
int_t tmpAdvance;
int_t tmpPlayer;
tmpAdvance = theAdvance;
tmpPlayer = thePlayer;
if(tmpPlayer == ExpansionPlayer) {
if (tmpAdvance == AdvanceDB(ADVANCE_SUBNEURAL_ADS)) {
return 1;
}
else{
return 0;
}
}
else{
return 0;
}
}
HandleEvent(EndTurn) 'NobodyCanCreateCities' pre {
ExpansionPlayer = 0;
} |
And this is part of the where ExpansionPlayer is defined.
Code:
|
ExpansionPlayer = ownerNum;
GrantAdvance(ownerNum, AdvanceDB(ADVANCE_SUBNEURAL_ADS)); |
Right before the expansion starts. It is in the beginning of the expandCity function of my code for those who have see the code.
PS: Does the RemoveAdvance function work. I have tried to used but not with sucess.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 16, 2002, 19:35
|
#45
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Ah. You appear to have prevented any player from having any advance. Put the two if() statements the other way around, replace the second 0 with a 1, and you got it.
But you don't need it really. SubNeural ads can never be researched anyway, and you just need the RemoveAdvance function in a different handler at the end of that turn to make it work.
Set up a player array as a switch, eg:
Code:
|
int_t IsPlayerExpanding[];
// In the expandcity function
if(sucess == 1){
IsPlayerExpanding[owner] = 1;
}
// and then later...
HandleEvent(endturn) 'remove_ads' pre{
int_t i;
for(i=0; i < preference("NumPlayers"); i = i + 1){ // or whatever
if(IsPlayerExpanding[i] == 1){
RemoveAdvance(i, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
IsPlayerExpanding[i] = 0;
}
}
} |
or something
__________________
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
|
|
|
|
August 16, 2002, 22:13
|
#46
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Immortal Wombat
Ah. You appear to have prevented any player from having any advance.
|
: Now i got how those fuctions work! Thanks
Quote:
|
Originally posted by Immortal Wombat
But you don't need it really. SubNeural ads can never be researched anyway, and you just need the RemoveAdvance function in a different handler at the end of that turn to make it work.
|
Actually i was hoping the mod fuction would remove the advance and not prevent its research.
I will test the RemoveAdvance function again. But your piece of code needs modification since not only players who had sucess = 1 must get the advance but all those who triggered the expansion.
__________________
"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; August 16, 2002 at 22:29.
|
|
|
|
August 17, 2002, 08:27
|
#47
|
Emperor
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: England
Posts: 3,826
|
Quote:
|
Originally posted by Pedrunn
I will test the RemoveAdvance function again. But your piece of code needs modification since not only players who had sucess = 1 must get the advance but all those who triggered the expansion.
|
Can't you just remove the advance from all the players who have it?
|
|
|
|
August 17, 2002, 09:20
|
#48
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by J Bytheway
Can't you just remove the advance from all the players who have it?
|
Yep the RemoveAdvance function was working nicely with EndTurn and BeginTurn event. But that means the AI would have a whole turn with Subneural Ads. And he could place cities while with this advance. So i tried to add the fuction in the ExpandCity function. Did not work no matter where i write it . So i thought i would have to add the fuction in all event handlers but no need anymore i found the solution. Simple, yet perfect :
Code:
|
HandleEvent(CreateImprovement) 'RemoveSubNeralAds' post {
if (HasAdvance(player[0], ID_ADVANCE_SUBNEURAL_ADS)) {
RemoveAdvance(player[0], AdvanceDB(ADVANCE_SUBNEURAL_ADS));
}
} |
This means we are only one known bug to the release of the city expansion v2.0:
Prevent the building of regular improvements over the wonders. I tried this code:
Code:
|
HandleEvent(CreateImprovement) 'DontLetPlaceImpsOverCities' pre { // Does not work :(
if(TileHasWonder(location[0]) == 1 // only works for slic placements
|| TileHasCity (location[0]) == 1) {
return STOP;
}
} |
where the functions TileHasCity and TileHasWonder are known to be working perfecly. I tried several variations and even tested the event in several ways. I got to the conclusion that the CreateImprovement event only works for slic placements .
The best solution i came up to was to dont try to stop the placement but preventing the exclusion of the Imp: All wonders and cities Imps are OceanATM and none of the regular imps can exclude this type of TI. Wich means we have to place the port in another place (suggestion: OceanMine). Bad solution yet a solution.
__________________
"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; August 17, 2002 at 09:26.
|
|
|
|
August 17, 2002, 10:39
|
#49
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Code:
|
HandleEvent(CreateImprovement) 'RemoveSubNeralAds' post {
if (HasAdvance(player[0], ID_ADVANCE_SUBNEURAL_ADS)) {
RemoveAdvance(player[0], AdvanceDB(ADVANCE_SUBNEURAL_ADS));
}
} |
Make that a 'pre' and stick a return STOP; in, and it should work fine. In the worst case, it could prevent the AI from building one normal tile improvement, but it will always prevent suburbs being built.
Code:
|
HandleEvent(CreateImprovement) 'RemoveSubNeralAds' pre {
if (HasAdvance(player[0], ID_ADVANCE_SUBNEURAL_ADS)) {
RemoveAdvance(player[0], AdvanceDB(ADVANCE_SUBNEURAL_ADS));
return STOP;
}
} |
__________________
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
|
|
|
|
August 19, 2002, 13:23
|
#50
|
Super Moderator
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Immortal Wombat
Make that a 'pre' and stick a return STOP; in, and it should work fine. In the worst case, it could prevent the AI from building one normal tile improvement, but it will always prevent suburbs being built.
|
Yes it will always prevent suburbs being built, even the ones that are placed by slic. And actual you need the advance to build suburbs, so it must be removed afterwards. And this event handler should do it. I am just rewriting the GM1_goods.slc and this one already found its place in it. I hope I can accelerate the script a little bit and found also some stuff that didn't worked as it should be.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 19, 2002, 13:38
|
#51
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Combined with the IsPlayerExpanding[]; code above, altered a bit, so that it does not prevent the SLIC-created improvments.
-DAW4DADF
__________________
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
|
|
|
|
August 19, 2002, 14:10
|
#52
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Sorry you guys but i got it working this weekend. I just had no time to post here my attempts and because nothing really was defined until this morning. Everything was working. CreateImproements does stop not sliced replacements i just got confused with the game playing the sound of the placement (from martin's code). But despite the sound the improvement is not created. So there is no bug. [size = 3]This means[/size] the code is ready and working
I already started playing with it. And i have just reached Classical age without any bugs. I guess the read me is the only thing missing to release this mod (IW you dont mind if i use some pieces of your readme, do you?).
PS: Martin you may want to take alook to make it compatible with new capture option. I could not get both to work together.
Here is the final version of the code
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 19, 2002, 14:55
|
#53
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Because (I hope) the wonder code will be used on many different setups, not necessarily with the city expansion code, I think it would be best use the whole readme. I'll update it.
Which prefix are you using?
You can write a separate readme for the CityX code.
I altered the wonder code slightly so that it is easier to mod.
I still don't think you'd get the pyramids in a swamp, or the Empire State Building on a desert mountain, and I would like to remove those terrains from the options.
Opinions?
But otherwise, Well Done!!
__________________
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
Last edited by Immortal Wombat; August 19, 2002 at 15:14.
|
|
|
|
August 19, 2002, 15:20
|
#54
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Here's the readme. I'll email you the other graphics for the tile file.
Oh yeah, one more thing.
I removed the other units from the settlercreate handler. Not all mods have infantry units taking population and I think the advances you use push the game too late. I'd use Arcologies, and Nano Technology instead of the last two.
__________________
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
|
|
|
|
August 19, 2002, 15:46
|
#55
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Immortal Wombat
I removed the other units from the settlercreate handler. Not all mods have infantry units taking population and I think the advances you use push the game too late. I'd use Arcologies, and Nano Technology instead of the last two.
|
The CreateUnit is junk. the event doest work as you confirmed And the advances for each ages alo needs to be change according to the mod. I am assuming those advances are for the original settings. I will check the read me and i am witing the new graphics.
It wont be a problem create the variations:wonder, city and city + wonder expansion.
As for the terrains , i did not wnated to limit the expansion. If a city is surrounded by swamps and creates a wonder i still want it to have the wonder around its tile.
__________________
"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; August 19, 2002 at 15:56.
|
|
|
|
August 19, 2002, 15:58
|
#56
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Ok, sorry for the chain-post, but...
My Visible wonders mod is in the directory. I'm going to update that with the working code I finished last week. I really really think it would be easier if you took the wonder code completely out of the city expansion code to keep the two separate.
There will not be any SLIC clashes, all my functions have IWW prefixes.
You will need, in your readme to explain how to add a function that checks for wonders if the wonder mod is being used in conjuction with the CityX mod.
You can include:
Code:
|
int_f HasWonder(location_t tmpLoc){
return 0;
} |
That will have no negative effect if no wonders are being used.
Explain how to add the TileHasImprovement lines. Its not too hard.
Get the Apolyton Standard Tile File up ASAP, and we can run from there.
__________________
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
|
|
|
|
August 19, 2002, 17:23
|
#57
|
Super Moderator
Local Time: 07:04
Local Date: November 1, 2010
Join Date: Mar 2001
Location: Tübingen, Germany
Posts: 6,206
|
Quote:
|
Originally posted by Pedrunn
PS: Martin you may want to take alook to make it compatible with new capture option. I could not get both to work together.
|
So far no success. But I found some other problems:
Code:
|
HandleEvent(CreateUnit) 'settler built' post { // Doesnt Work :(
city_t tmpCity;
unit_t tmpUnit;
city[0] = tmpCity;
unit[0] = tmpUnit;
if(CityIsValid(city[0])) {
if ((unit[0].type == UnitDB(UNIT_SETTLER)) // if a unit is one of those listed here
||(unit[0].type == UnitDB(UNIT_URBAN_PLANNER)) // ...
||(unit[0].type == UnitDB(UNIT_SEA_ENGINEER))) { //...
ReduceCity(city[0], city[0].owner);
}
}
} |
Doesn't work, because you assign an empty city variable to the build in city variable the result is that the build in variable is an empty city variable, too. The same is true for the unit variable. Use this code instead and it should work:
Code:
|
HandleEvent(CreateUnit) 'settler built' post { // Doesnt Work :(
city_t tmpCity;
unit_t tmpUnit;
tmpCity = city[0];
tmpUnit = unit[0];
if(CityIsValid(tmpCity)) {
if ((tmpUnit.type == UnitDB(UNIT_SETTLER)) // if a unit is one of those listed here
||(tmpUnit.type == UnitDB(UNIT_URBAN_PLANNER)) // ...
||(tmpUnit.type == UnitDB(UNIT_SEA_ENGINEER))) { //...
ReduceCity(tmpCity, tmpCity.owner);
}
}
} |
This should work now. Here is another problem I found:
Code:
|
...
|| TType == TerrainDB(TERRAIN_JUNGLE)
|| TType == TerrainDB(TERRAIN_MOUNTAIN)
|| TType == TerrainDB(TERRAIN_BROWN_MOUNTAIN)
|| TType == TerrainDB(TERRAIN_WHITE_MOUNTAIN)
|| TType == TerrainDB(TERRAIN_SWAMP)){
Event:CreateImprovement(owner, tmpLoc, newType, 0);
FinishImprovements(tmpLoc);
return 1;
}
}
... |
FinishImprovement doesn't work directly afterwards a CreateImprovement event. From the testing with my rewritten GM1_Goods.slc it seems that CreateImprovement and FinishImprovements cost a lot of time therefore it is better to remove the not working ones. And put the FinishImprovements function in an post event handler triggered by the CreateImprovement event. Of course use some if's to make shure that only the right tile imps are finished.
Here is something else:
Code:
|
elseif(TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_ANCIENT_CITY_ONE))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_MEDIEVAL_CITY_ONE))) {
GrantAdvance(owner, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
Event:CreateImprovement(owner,tmpLoc, TerrainImprovementDB(TILEIMP_ANCIENT_CITY_DEAD),0);
RemoveAdvance(owner, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
} |
Again RemoveAdvance doesn't work here, therefore remove it, it will only cost processor time. Yeah I was really optimizing my GM1_Goods.slc
Code:
|
HandleEvent(CreateImprovement) 'DontLetPlaceImpsOverCities' pre { // Does not work :(
if(ExpansionPlacement == 0) { // Looks like CreateImprovement function
if(TileHasWonder(location[0]) == 1 // only works for slic placements
|| TileHasCity (location[0]) == 1) {
return STOP;
}
}
else{
ExpansionPlacement = 0;
}
} |
I have no real idea about this one. Probably the problem lies in the ExpansionPlacement variable, but unfortunatly I have no idea what it should do.
-Martin
__________________
Civ2 military advisor: "No complaints, Sir!"
|
|
|
|
August 19, 2002, 17:37
|
#58
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Immortal Wombat
You will need, in your readme to explain how to add a function that checks for wonders if the wonder mod is being used in conjuction with the CityX mod.
That will have no negative effect if no wonders are being used.
Explain how to add the TileHasImprovement lines. Its not too hard.
|
what i dont like about you code is this:
Code:
|
int_f IWW_WhatType(int_t tileimp)
{
int_t ans;
if(tileimp < IWW_NumNormalTimps){
ans = 1; // normal timp
} elseif (tileimp < IWW_NumNormalTimps + IWW_NumGoodTimps){
ans = 2; // Martin's goods
} elseif (tileimp < IWW_NumWonders + IWW_NumNormalTimps + IWW_NumGoodTimps){
ans = 3; // WONDERS
} elseif (tileimp >= IWW_NumWonders + IWW_NumNormalTimps + IWW_NumGoodTimps){
ans = 4; // City Expansions
}
return ans;
} |
Dont you think it will make our code much more compatible to each other and for others mods if you used my TileHasWonder(int_t tmpLoc) function. This way the modder just have to add #include "CityExpansion.slc" at the end of your code and remove the lines since your code would have this function already.
Code:
|
int_f TileHasWonder(location_t tmpLoc){
return 0;
} |
No need to count how many normal imps, good imps city imps and wonders imps.
__________________
"Kill a man and you are a murder.
Kill thousands and you are a conquer.
Kill all and you are a God!"
-Jean Rostand
|
|
|
|
August 19, 2002, 17:55
|
#59
|
King
Local Time: 02:04
Local Date: November 1, 2010
Join Date: Jul 2001
Location: of Natal, Brazil
Posts: 2,555
|
Quote:
|
Originally posted by Martin Gühmann
HandleEvent(CreateUnit) 'settler built' post { // Doesnt Work
city_t tmpCity;
unit_t tmpUnit;
tmpCity = city[0];
tmpUnit = unit[0];
if(CityIsValid(tmpCity)) {
if ((tmpUnit.type == UnitDB(UNIT_SETTLER)) // if a unit is one of those listed here
||(tmpUnit.type == UnitDB(UNIT_URBAN_PLANNER)) // ...
||(tmpUnit.type == UnitDB(UNIT_SEA_ENGINEER))) { //...
ReduceCity(tmpCity, tmpCity.owner);
}
}
}
[/CODE]
|
The code is wrong now because of desperate attempt of getting it working. It does not work in both ways. The event is bugged for sure (IW confirmed). you can try.
Quote:
|
Originally posted by Martin Gühmann
FinishImprovement doesn't work directly afterwards a CreateImprovement event. From the testing with my rewritten GM1_Goods.slc it seems that CreateImprovement and FinishImprovements cost a lot of time therefore it is better to remove the not working ones. And put the FinishImprovements function in an post event handler triggered by the CreateImprovement event. Of course use some if's to make shure that only the right tile imps are finished.
|
That part was caracterized as junk. I was going to remove it since i thought the problem was the function. Can you tell me for sure the it will work if i use it far from the CreateImprovement? I thought i would have to wait next tun to the improvement finish up. If you tell me it works this will be a major improvement to the code.
[QUOTE] Originally posted by Martin Gühmann
Code:
|
elseif(TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_ANCIENT_CITY_ONE))
|| TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_MEDIEVAL_CITY_ONE))) {
GrantAdvance(owner, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
Event:CreateImprovement(owner,tmpLoc, TerrainImprovementDB(TILEIMP_ANCIENT_CITY_DEAD),0);
RemoveAdvance(owner, AdvanceDB(ADVANCE_SUBNEURAL_ADS));
} |
Again RemoveAdvance doesn't work here, therefore remove it, it will only cost processor time. Yeah I was really optimizing my GM1_Goods.slc [quote]
Actually it did work. The player does not get subneural ads when their cities are pillaged anymore.
Quote:
|
Originally posted by Martin Gühmann
Code:
|
HandleEvent(CreateImprovement) 'DontLetPlaceImpsOverCities' pre { // Does not work :(
if(ExpansionPlacement == 0) { // Looks like CreateImprovement function
if(TileHasWonder(location[0]) == 1 // only works for slic placements
|| TileHasCity (location[0]) == 1) {
return STOP;
}
}
else{
ExpansionPlacement = 0;
}
} |
I have no real idea about this one. Probably the problem lies in the ExpansionPlacement variable, but unfortunatly I have no idea what it should do.
|
ExpansionPlacement is set to 1 if it is the CreateImprovement event is triggered by the ExpandCity function and 0 when are place by every othe way.
__________________
"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; August 19, 2002 at 18:42.
|
|
|
|
August 19, 2002, 19:35
|
#60
|
Prince
Local Time: 06:04
Local Date: November 1, 2010
Join Date: Dec 2000
Location: in perpetuity
Posts: 4,962
|
Quote:
|
Originally posted by Pedrunn
what i dont like about you code is this:
... [snip]
|
Yeah. I wasn't using it - I've taken it out.
I've updated the directory version. Download it and see what I've done with the code.
__________________
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
|
|
|
|
Posting 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
|
|
|
All times are GMT -4. The time now is 01:04.
|
|