Announcement

Collapse
No announcement yet.

New SLIC functions from patch

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

  • #16
    Elucidus,
    Since I had a little extra time on my hands I made a small example trigger on how obsoleting buildings might work. I implemented it the way I remember it from Civ1/Civ2, namely to destroy all obsolete buildings as soon the advance that makes them obsolete is discovered. One might want to implement it quite differently, but this is just an example. I didn't test this yet (I'm at uni right now, don't have the game here), so I can't guarantee that it will work. In fact, I don't even know what the syntax of the DestroyBuilding function is so I just guessed how it might work, I wouldn't be surprised if it doesn't work like this.

    Code:
    HandleEvent(GrantAdvance) 'BazaarObsolete' post {			// if someone obtains an advance
    city_t	tmpCity;
    int_t	i;
    int_t	tmpPlayer;
    int_t	advanceType;
    	advanceType = value[0];
    	tmpPlayer = player[0];				// init variables
    
    
    	if (advanceType == AdvanceDB(ADVANCE_BANKING)) {		// if advance in question is Banking
    		for (i = 0; i < tmpPlayer.cities; i = i + 1) {
    			GetCityByIndex(tmpPlayer, i, tmpCity);	// cycle through cities of player
    			if CityHasBuilding(city, "IMPROVE_BAZAAR") {	// if city has bazaar
    				DestroyBuilding(tmpCity, BuildingDB(IMPROVE_BAZAAR));	// destroy it
    			}
    		}
    	}
    }
    Harlan,
    I made a small example trigger for upgrading tile improvements as well. Same disclaimer as above.

    Code:
    HandleEvent(CreateImprovement) 'UpgradeFarms' post {		// if improvement creation is started
    location_t	tmpLoc;
    int_t	newPW;
    int_t	improveType;
    int_t	tmpPlayer;
    	tmpPlayer = player[0];
    	improveType = value[0]; // or is it value[1]?
    	tmpLoc = location[0];				// init variables
    
    
    	if (improveType = TerrainImprovementDB(TILEIMP_ADVANCED_FARM)) { // if improvement is advanced farm
    		if (TileHasImprovement(tmpLoc, TerrainImprovementDB(TILEIMP_FARM)) { // if farm present
    			newPW = tmpPlayer.pw + 100;
    			SetPW(tmpPlayer, newPW);			// give 100 pw back
    		}
    	}
    }
    I'm a little pressed for time myself but maybe someone else could work these events out to debug them and to add code for other buildings/improvements as well.
    [This message has been edited by Locutus (edited December 18, 2000).]
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #17

      Locutus,

      Thanks for the insight. I realize that controlling large parts of the AI is a bad idea. But my reasoning was that,

      1. I've done some experimentation with the AI files, and been unable to get it to attack - that really kills my enthusiasm for the game.

      2. Others better than I are already experimenting with AI settings, so I can wait for results there.

      3. My intention is not to control a large part of AI, but a couple of large armies. I've noticed that the AI often has armies bigger than mine, but they simply hang around its cities. So, I thought perhaps one could get control of a couple of these and do some tricks . But you're right, it might be a pain figuring out which if these armies are 'handging around' and which are truly needed. Hopefully, if I do move its large army for an attack, the AI will panic and build a replacement, so this problem will be resolved.

      Comment


      • #18
        Colorme,

        Well as far as lack of succes with the AI files goes: don't give up so easily, it took Wes and others a lot of time to get the hang of that for CtPI too. It just requires many, many hours of trying out all kinds of combinations of variables.

        Pchang,

        If you mean could it take away the movementpoints after retreating, yes it could but it could probably be done easier as well. There's a function AddMovement that might take negative values to remove movementpoints (-100 should suffice for any unit), though I'm not quite sure of that. But also, there's an SetUnloadMovement event that takes away movementpoints after unloading a ship, that can probably be called after a battle as well. But no matter how it's implemented, one could indeed use SLIC to remove movement points after a retreat.
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • #19
          Could the moveunits event be used to end the movement of any units which have retreated?
          “It is no use trying to 'see through' first principles. If you see through everything, then everything is transparent. But a wholly transparent world is an invisible world. To 'see through' all things is the same as not to see.”

          ― C.S. Lewis, The Abolition of Man

          Comment

          Working...
          X