Announcement

Collapse
No announcement yet.

Wonderful Reality

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

  • Immortal Wombat
    replied
    I hate that smilie.

    Leave a comment:


  • Martin Gühmann
    replied
    Originally posted by Pedrunn
    Martin, you are a genius!. The FinishImprovements fuction is working perfecly. It just cant come together with the CreateImprovements fuctions.
    Now one of the earliest bug that was with me since the beginning of the coding has come to a end.
    Yeah from the slic documentaion:

    To generate an event from SLIC:

    Event:EventName(arguments)


    Example (also see above):

    Event:KillUnit(unit, 0, -1);

    Generates a KillUnit event for the specified unit. Note that events always execute ASYNCHRONOUSLY. The event is added to a queue, and is executed only after all events added before it have finished executing. So in the above example, the units do not actually die until after the handler has finished executing.
    So this means for your original cose, Pedrunn, that the FinishImprovement function was used on a location[0] without tile imps only afterwards the tile imp is placed it will finish the tile imp.

    -Martin

    Leave a comment:


  • Pedrunn
    replied


    Party again!!!

    Martin, you are a genius!. The FinishImprovements fuction is working perfecly. It just cant come together with the CreateImprovements fuctions.
    Now one of the earliest bug that was with me since the beginning of the coding has come to a end.

    I only need to get the new capture options to work with it. After that case closed.

    EDIT:


    more Party!!!
    I dont know what have i changed but the code is totally fuctional now. The new capture options is compatible and the CreateUnit does work (I think i was too much of unexperienced slicer when i test it)

    And since party is never too much and i am so happy that every single apect of the code i disliked is now working properly

    Let's Celebrate!!!


    hangover
    Here is the updated version of the code.
    Attached Files
    Last edited by Pedrunn; August 19, 2002, 23:40.

    Leave a comment:


  • Immortal Wombat
    replied
    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.

    Leave a comment:


  • Pedrunn
    replied
    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.
    Last edited by Pedrunn; August 19, 2002, 18:42.

    Leave a comment:


  • Pedrunn
    replied
    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.

    Leave a comment:


  • Martin Gühmann
    replied
    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

    Leave a comment:


  • Immortal Wombat
    replied
    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.

    Leave a comment:


  • Pedrunn
    replied
    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.
    Last edited by Pedrunn; August 19, 2002, 15:56.

    Leave a comment:


  • Immortal Wombat
    replied
    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

    Leave a comment:


  • Immortal Wombat
    replied
    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
    Last edited by Immortal Wombat; August 19, 2002, 15:14.

    Leave a comment:


  • Pedrunn
    replied
    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

    Leave a comment:


  • Immortal Wombat
    replied
    Combined with the IsPlayerExpanding[]; code above, altered a bit, so that it does not prevent the SLIC-created improvments.

    -DAW4DADF

    Leave a comment:


  • Martin Gühmann
    replied
    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

    Leave a comment:


  • Immortal Wombat
    replied
    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;
    	}
    }

    Leave a comment:

Working...
X