Announcement

Collapse
No announcement yet.

Wonderful Reality

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    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

    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

    Comment


    • #47
      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?

      Comment


      • #48
        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

        Comment


        • #49
          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

          Comment


          • #50
            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!"

            Comment


            • #51
              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

              Comment


              • #52
                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
                Attached Files
                "Kill a man and you are a murder.
                Kill thousands and you are a conquer.
                Kill all and you are a God!"
                -Jean Rostand

                Comment


                • #53
                  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!!
                  Attached Files
                  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

                  Comment


                  • #54
                    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.

                    Attached Files
                    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

                    Comment


                    • #55
                      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

                      Comment


                      • #56
                        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

                        Comment


                        • #57
                          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!"

                          Comment


                          • #58
                            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

                            Comment


                            • #59
                              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.

                              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.
                              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

                              Comment


                              • #60
                                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

                                Comment

                                Working...
                                X