Announcement

Collapse
No announcement yet.

slic question

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

  • slic question

    Hi,

    I want to increase by one pop, each cities. I write the trigger below, but it did nothing.
    What's happen ?

    trigger 'IncreaseCities' when (g.year == 2) {
    CityIndex = 0;
    while(CityIndex < player.cities) {
    AddCityByIndex(g.player, CityIndex);
    AddPops(city.1,1);
    CityIndex = CityIndex + 1;
    }
    }
    Apolyton QuickStart for CTP PBEM

  • #2
    This will trigger at the beginning of each game turn, and will evaluate when the year = 2 (you already know this).

    However, this is before the beginning of the player turns, so "g.player" may not evaluate properly (which player would it reference?).

    There is an easy way around this. You can force the trigger to evaluate at the beginning of each player turn by changing the 'when' condition to '((g.year == 2) && (player.cities))'.

    The player.cities event will force the trigger to evaluate at the beginning of each player turn and will load the 'player' variable into the context so that you can use it.

    Since this is a one-turn-only trigger, you might want to add another trigger that cleans up in turn 3. Something like:

    trigger 'IncreaseCitiesCleanup' when (g.year == 3) {
    DisableTrigger('IncreaseCities');
    DisableTrigger('IncreaseCitiesCleanup');
    }

    If you add a lot of triggers, getting in the habit of doing this will help keep the game from slowing down from unnecessary triggers.

    Hope that helps.

    ------------------
    "Barbarism is the natural state of mankind... Civilization is unnatural. It is a whim of circumstance. And barbarism must always triumph."
    "Barbarism is the natural state of mankind... Civilization is unnatural. It is a whim of circumstance. And barbarism must always triumph."

    Comment


    • #3
      Thanks a lot. My triggers now are OK.
      --
      trigger 'IncreaseCities3' when (player.cities && (g.year == 3)) {
      CityIndex = 0;
      while((CityIndex < player.cities) && (Cityindex <= 5)) { // will be 10 instead of 5
      SetCityByIndex(1, player, CityIndex);
      AddPops(city, 1);
      CityIndex = CityIndex + 1;
      }
      }

      trigger 'CleanupYear4' when (g.year == 4) {
      DisableTrigger('IncreaseCities3');
      DisableTrigger('CleanupYear4');
      }
      [This message has been edited by slamp (edited December 05, 1999).]
      Apolyton QuickStart for CTP PBEM

      Comment

      Working...
      X