Gestion TC - Cities In Motion
Bienvenue sur le forum de la communauté Francophone de Cities in motion et du jeu en ligne : Gestion TC

"N'oubliez pas de participer à nos concours Wink "

Bonne lecture et bon jeu ...

Maxdyvendee
Gestion TC - Cities In Motion
Bienvenue sur le forum de la communauté Francophone de Cities in motion et du jeu en ligne : Gestion TC

"N'oubliez pas de participer à nos concours Wink "

Bonne lecture et bon jeu ...

Maxdyvendee


Gestion TC - Cities In Motion
 
AccueilDernières imagesRechercherS'enregistrerConnexion
-31%
Le deal à ne pas rater :
PC Portable Gamer Lenovo 15” – RTX 4060 Core i5-12450H RAM 16 Go ...
824.99 € 1199.99 €
Voir le deal

Partagez | 
 

 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Lemmy1916
Fondateur
Fondateur
Lemmy1916

Masculin Bélier Chien
Messages : 1019
Points : 6511
Réputation : 45
Date d'inscription : 12/02/2011
Age : 42
Localisation : nancy (54)
Humeur : pépère ....

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeLun 4 Juil - 16:28

2 mods créée par Macauman


[MOD][WIP] Rush Hour mod - Varying traffic and passengers flows by time of day/week

4 July - Version 2 - New feature: transit services will now shut down for the night during the quiet periods (Government building bug remains - see below)

Mod Description:
This mod aims to enhance the simulation by modeling traffic, passengers, and transit system flows based on time of day and week.

An alternate timeline has been laid on top of the default timeline. This timeline runs in 1 hour increments during the hours 7 AM to 9 AM, and from 5 PM to midnight. From midnight to 6 AM and 9 AM to 4 PM, block time is used to compress activity rate.

The working week - from Monday to Friday, and the non-working weekend is also simulated.

Every weekday, CiMs will get up and go to work, move about town, have lunch at a shop or at home, and head home at the end. On Friday evenings and weekends, they will head out and and go shopping or enjoy leisure time. Meanwhile, tourists, pensioners, and the unemployed have their own routines to follow and cater for.

Your transit company also runs on a schedule. All lines will shut down at night after 10PM, except Friday, when transit runs all night to keep all the drunkards off the road.

This is a work in progress, and your feedback and suggestions are welcomed.

The mod consists of 2 files:

C:\Program Files\Cities In Motion\metro\scripts\economy.script
C:\Program Files\Cities In Motion\metro\ui\minimap\minimap.script

I'm unable to post any attachments (a recent issue with this board - anyone else experience this?), so copy and past the following code into Notepad to create the 2 respective script files.

economy.script
Code:


$grid = MAIN.$grid;

MAIN.$economy = this;

function updateEconomy() {
  $h = MAIN.$gameData.$economyHistory;
  if (MAIN.$gameData.$economyTarget > $h[#$h-1]) {
    $r = random(-0.4, 0.8);
    if (($h[] = $h[#$h-1] + $r * abs($r)) >= MAIN.$gameData.$economyTarget) {
      MAIN.$gameData.$economyTarget = random(-3.0, 0.0);
    }
  } else {
    $r = random(-1.333, 0.4);
    if (($h[] = $h[#$h-1] + $r * abs($r)) <= MAIN.$gameData.$economyTarget) {
      MAIN.$gameData.$economyTarget = random(1.0, 5.0);
    }
  }
  updateEnergyEconomy();
  updateCitizenEconomy();
  MAIN.$gameData.$electricityPriceHistory[] = MAIN.$gameData.$electricityPrice;
  MAIN.$gameData.$fuelPriceHistory[] = MAIN.$gameData.$fuelPrice;
  if (MAIN.$grid.citizens.count == 0) {
    MAIN.$gameData.$populationHistory[] = MAIN.$grid.citizens.getHomeCount() * random(0.95, 1.0);
    $temp = 3.0 - $h[#$h-1] * 0.1 - $h[#$h-2] * 0.1 - $h[#$h-3] * 0.1 - $h[#$h-4] * 0.1 - $h[#$h-5] * 0.1 - $h[#$h-6] * 0.1;
    MAIN.$gameData.$unemploymentHistory[] = int((1.0 + $temp * $temp) * random(0.95, 1.05));
  } else {
    MAIN.$gameData.$populationHistory[] = MAIN.$grid.citizens.count;
    MAIN.$gameData.$unemploymentHistory[] = MAIN.$grid.citizens.getUnemployment(GRID_CITIZEN_BLUE_COLLAR, GRID_CITIZEN_WHITE_COLLAR, GRID_CITIZEN_BUSINESS, GRID_CITIZEN_STUDENT) * 100.0;
  }
}

function updateEnergyEconomy() {
  $h = MAIN.$gameData.$economyHistory;
  MAIN.$gameData.$fuelPrice = int(120 * (1.0 + $h[#$h-1] * random(0.03, 0.08)));
  MAIN.$gameData.$electricityPrice = int(70 * (1.0 + $h[#$h-1] * random(0.02, 0.04)));
}

$interestMultiplier = [1.3, 1.3, 1.3, 1.0, 0.5, 0.5, 0.5];
$rewardMultiplier = [0.75, 0.75, 0.75, 1.0, 1.5, 1.5, 1.5];

function getInterest($margin) {
  $h = MAIN.$gameData.$economyHistory;
  return int($margin * (1.0 + $h[#$h-1] * 0.1) * 4.0 * $interestMultiplier[MAIN.$campaign.$campaign.$bankLevel]) * 0.25;
}

function getReward($price) {
  return int($price * $rewardMultiplier[MAIN.$campaign.$campaign.$bankLevel]);
}

function getPrice($price) {
  if ($price == 2000000000) return $price;
  $h = MAIN.$gameData.$economyHistory;
  $price = int(min(2000000000.0, $price * (1.0 + $h[#$h-1] * 0.05)));
  if ($price > 1000000) {
    $price = $price / 50000 * 50000;
  } else if ($price > 100000) {
    $price = $price / 5000 * 5000;
  } else if ($price > 10000) {
    $price = $price / 500 * 500;
  } else if ($price > 1000) {
    $price = $price / 50 * 50;
  } else if ($price > 100) {
    $price = $price / 10 * 10;
  }
  return $price;
}

function getWage($wage) {
  $h = MAIN.$gameData.$economyHistory;
  return int(min(2000000000.0, $wage * (1.0 + $h[#$h-4] * 0.05)));
}

function updateCitizenEconomy() {
  $h = MAIN.$gameData.$economyHistory;

  $priceMultiplier = 1.7 - $h[#$h-7] * 0.14;
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_BLUE_COLLAR, 0.11 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_WHITE_COLLAR, 0.09 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_BUSINESS, 0.03 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_STUDENT, 0.15 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_TOURIST, 0.07 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_PENSIONER, 0.13 * $priceMultiplier);
  $grid.citizens.setPriceSignificance(GRID_CITIZEN_UNEMPLOYED, 0.20 * $priceMultiplier);

  $workMultiplier = 0.1;
  $playMultiplier = 0.1;
  $visitMultiplier = 0.1;

  //Workers Weekday
    if ((MAIN.$mainClock.years) % 7 <= 4)
       //Weekday 08-16
      {if (MAIN.$mainClock.months >= 3)
         {if (MAIN.$mainClock.months <= 6)
            {$workMultiplier = 10;
            }
         }
       //Lunch 09-16
       if (MAIN.$mainClock.months >= 4)
         {if (MAIN.$mainClock.months <= 5)
            {$playMultiplier = 10;
            }
         }
      }   
       
  //Workers Weekend 09-16
   if ((MAIN.$mainClock.years) % 7 >= 5)
      {if (MAIN.$mainClock.months == 4)
         {$playMultiplier = 1;
         }         
      }   
      {if (MAIN.$mainClock.months >= 5)
         {if (MAIN.$mainClock.months <= 5)
            {$playMultiplier = 10;
            }         
         }
      }   
      
  //Friday Night 17-00
   if ((MAIN.$mainClock.years) % 7 == 4)
      {if (MAIN.$mainClock.months >= 6)
         {if (MAIN.$mainClock.months <= 12)   
            {$playMultiplier = 10;
            }
         }
      }
  //Day Visit 09-16
   if (MAIN.$mainClock.months >= 3)
      {if (MAIN.$mainClock.months <= 5)   
         {$visitMultiplier = 1;
         }
      }
      
  //Weekday Startup 07
   if ((MAIN.$mainClock.years) % 7 <= 4)
      {if (MAIN.$mainClock.months == 2)
         {foreach ($grid.lines.children())
            {.active = true;
            .$data["active"] = true;
            }
         }
      }
  //Mon-Thu Shutdown 22
   if ((MAIN.$mainClock.years) % 7 <= 3)   
      {if (MAIN.$mainClock.months == 11)
         {foreach ($grid.lines.children())
            {.active = false;
            .$data["active"] = false;
            }
         }
      }

  //Weekend Startup 08
   if ((MAIN.$mainClock.years) % 7 >= 5)
      {if (MAIN.$mainClock.months == 3)
         {foreach ($grid.lines.children())
            {.active = true;
            .$data["active"] = true;
            }
         }
      }
      
  //Weekend Shutdown 22
   if ((MAIN.$mainClock.years) % 7 >= 5)   
      {if (MAIN.$mainClock.months == 11)
         {foreach ($grid.lines.children())
            {.active = false;
            .$data["active"] = false;
            }
         }
      }
   

      
  $shoppingMultiplier = 1.0 + $h[#$h-7] * 0.05;
  // work, shopping, leisure, government
  $grid.citizens.setReasonProbability(GRID_CITIZEN_BLUE_COLLAR, 9 * $workMultiplier, 9 * $shoppingMultiplier * $playMultiplier, 9 * $playMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_WHITE_COLLAR, 9 * $workMultiplier, 9 * $shoppingMultiplier * $playMultiplier, 9 * $playMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_BUSINESS, 9 * $workMultiplier, 9 * $shoppingMultiplier * $playMultiplier, 9 * $playMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_STUDENT, 5 * $workMultiplier, 5 * $shoppingMultiplier * $playMultiplier, 5 * $playMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_TOURIST, 0, 1 * $shoppingMultiplier * $visitMultiplier, 1 * $visitMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_PENSIONER, 0, 1 * $shoppingMultiplier * $visitMultiplier, 1 * $visitMultiplier, 0);
  $grid.citizens.setReasonProbability(GRID_CITIZEN_UNEMPLOYED, 1 * $visitMultiplier, 1 * $visitMultiplier, 1 * $visitMultiplier, 0);
 
  $temp = 3.0 - $h[#$h-1] * 0.6;
  $grid.citizens.joblessRate = int(1.0 + $temp * $temp);

  $num = MAIN.$grid.citizens.count;
  if ($num == 0) $num = $grid.citizens.getHomeCount();
  if ($num < 18000) {
    $grid.citizens.carMultiplier = clamp(500.0 / max(1.0, $num - 22550.0) + 0.89, 0.0, 1.0) * MAIN.$campaign.$campaign.$privateCars * 0.01;
  } else {
    $grid.citizens.carMultiplier = clamp(9000.0 / max(1.0, $num - 1300.0) + 0.24, 0.0, 1.0) * MAIN.$campaign.$campaign.$privateCars * 0.01;
  }
}

event this.onDestroy::() {
  MAIN.$economy = null;

minimap.script
Code:

$window = MAIN.$window;
$settings = MAIN.$settings;
$desktop = MAIN.$desktop;
$grid = MAIN.$grid;
$player = MAIN.$player;
$strings = MAIN.$strings;

MAIN.$minimap = this;
$textureSize = 256;

$bg = MAIN.$ui.createHudElement(0, $desktop.height - 300, 264, 300, 2);

$icons = MAIN.$ui.createHudElement($bg.width-1, $desktop.height - 125, 52, 126, 2);
$icons.$content.setRect(1, 10, $icons.width, $icons.height-14);

$bg.$right.height = $icons.top - $bg.top - $bg.$right.top + 3;
with (new_control($bg)) {
  .setRect($bg.$right.left, $bg.$right.top + $bg.$right.height, $bg.$right.width - 1, $bg.height - $bg.$right.height - $bg.$right.top);
  .setImage("/metro/ui/background.dds");
  .visible = true;
  .canActivate = false;
  .sendToBack();
}

$datapanel = load "datapanel.script";
$undergroundForced = false;
$dataMode = GRID_VIEW_DEFAULT;
$forcedMode = 0;
$newsPin = null;
$disableTime = false;

$texture_map_pin = $window.video.new_texture("/metro/ui/minimap/map-pin.dds");
$texture_home_pin = $window.video.new_texture("/metro/ui/minimap/home-pin.dds");
$texture_work_pin = $window.video.new_texture("/metro/ui/minimap/work-pin.dds");
$texture_end_pin = $window.video.new_texture("/metro/ui/minimap/end-pin.dds");
$texture_start_pin = $window.video.new_texture("/metro/ui/minimap/start-pin.dds");
$texture_arrow_pin = $window.video.new_texture("/metro/ui/minimap/arrow-pin.dds");
$texture_petition_pin = $window.video.new_texture("/metro/ui/minimap/petition-pin.dds");
$texture_news_pin = $window.video.new_texture("/metro/ui/minimap/news-pin.dds");

$datapanelButton = MAIN.$ui.createChoiceButton($icons.$content, "self", 0, 0, 46, 49, "", toggleDatapanel, "/metro/ui/minimap/data.dds", "/metro/ui/minimap/data_se.dds", "/metro/ui/minimap/data_ho.dds");
$datapanelButton.setCropRect(8.0 / 64.0, 8.0 / 64.0, 46.0 / 64.0, 49.0 / 64.0);
MAIN.$ui.unselectChoiceButton($datapanelButton, $datapanelButton);
MAIN.$ui.setTooltip($datapanelButton, $strings.$map_dataview_hint, 1, 0);

$undergroundButton = MAIN.$ui.createChoiceButton($icons.$content, "self", 0, 49, 46, 49, "", toggleUndergroundView, "/metro/ui/minimap/layer.dds", "/metro/ui/minimap/layer_se.dds", "/metro/ui/minimap/layer_ho.dds");
$undergroundButton.setCropRect(8.0 / 64.0, 8.0 / 64.0, 46.0 / 64.0, 49.0 / 64.0);
MAIN.$ui.unselectChoiceButton($undergroundButton, $undergroundButton);
MAIN.$ui.setTooltip($undergroundButton, $strings.$map_underground_hint, 1, 0);

function toggleDatapanel() {
  if (!$datapanel.$hidden) {
    $datapanel.hide();
    MAIN.$ui.unselectChoiceButton($datapanelButton, $datapanelButton);
  } else {
    MAIN.$ui.selectChoiceButton($datapanelButton, $datapanelButton);
    $datapanel.show();
  }
}

function toggleUndergroundView() {
  $undergroundForced = false;
  if (MAIN.$grid.viewMode != GRID_VIEW_UNDERGROUND) {
    MAIN.$grid.viewMode = GRID_VIEW_UNDERGROUND;
    MAIN.$ui.selectChoiceButton($undergroundButton, $undergroundButton);
  } else {
    if ($forcedMode != 0) {
      MAIN.$grid.viewMode = $forcedMode;
    } else {
      MAIN.$grid.viewMode = $dataMode;
    }
    MAIN.$ui.unselectChoiceButton($undergroundButton, $undergroundButton);
  }
  MAIN.$gameUI.setCameraPos(MAIN.$gameUI.$cameraX, MAIN.$gameUI.$cameraZ);
}

with ($minimap = new_mapControl($bg.$content)) {
  .setRect(0, 0, 256, 256);
  .setShader("/metro/ui/minimap/minimap.shader");
  .targetModule = MAIN.$scene;
  .offset = vector(0.0, 0.0, 0.0);
  .scale = -1.0 / (3.0 * 1024.0);
  .zoom = 1.0;
  .zoomFactor = 0.0;// 0.015;
  .minVelocity = 0.0;
  .maxDistance = 1.0;
  .visible = true;
  .canActivate = false;
}

with ($overlay = new_control($bg)) {
  .setRect($bg.$content.left-2, $bg.$content.top-2, 260, 260);
  .setBorder(MAIN.$ui.$borderColor, 2);
  .visible = true;
  .canActivate = false;
  .clickThrough = true;
}

with ($citySeal = new_control($bg)) {
  .setRect(2, 4, 32, 32);
  $sealFound = false;
  if (MAIN.$scenario : false) {
    if (MAIN.$scenario.$location) {
      if (defined MAIN.$scenario.$location.$largeSeal) {
        if (file_exists(changeFileExt(MAIN.$scenario.$location.$largeSeal, "-small.dds"))) {
          .setImage("/"+changeFileExt(MAIN.$scenario.$location.$largeSeal, "-small.dds"));
          $sealFound = true;
        }
      }
    }
  }
  if (!$sealFound) .setImage("/metro/location-data/seals/generic-city.dds");
  .visible = true;
  .canActivate = false;
}
$cityName = changeFileExt(extractFileName(MAIN.$gridFileName), "");
if (MAIN.$scenario : false) {
  if (MAIN.$scenario.$location) {
    if (defined MAIN.$scenario.$location.$cityName) {
      $cityName = MAIN.$scenario.$location.$cityName;
    }
  }
}
MAIN.$ui.setTooltip($citySeal, "-", 0, -1);
if (MAIN.$scenario : false) {
  event $citySeal.onMouseOver::() {
    .$toolTipText = escapePattern(expandPattern($strings.$map_seal_hint, $cityName, MAIN.$grid.citizens.count));
  }
} else {
  event $citySeal.onMouseOver::() {
    .$toolTipText = escapePattern(expandPattern($strings.$map_seal_hint, $cityName, MAIN.$grid.citizens.getHomeCount()));
  }
}

with ($bottomArea = new_control($bg.$content)) {
  .setRect(0, $bg.$content.height - 17, 256, 17);
  .visible = true;
  .canActivate = false;
}


with ($date = new_control($bottomArea)) {
  .setRect(0, 2, 118, $bottomArea.height);
  MAIN.$ui.setTextFont(current);
  .textAlign = ALIGN_MIDDLE | ALIGN_RIGHT;
  .text = $strings.$map_date_pattern;
  $timeperiods = ["00:00-06:00", "07:00", "08:00", "09:00-16:00", "09:00-16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"];
  $weekdaysShort = ["Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun"];
  .setArg(0, macro(@MAIN.$mainClock.months) :: $timeperiods[$0-1]);
  .setArg(1, "-");
  .setArg(2, macro(@MAIN.$mainClock.years) :: $weekdaysShort[$0 % 7]);
  .visible = true;
  .canActivate = false;
  .clickThrough = false;
}
MAIN.$ui.setTooltip($date, "-", 0, -1);
event $date.onMouseOver::() {
  .$toolTipText = escapePattern(expandPattern($strings.$map_date_hint, $strings.$map_date_months[MAIN.$mainClock.months - 1], MAIN.$mainClock.days, MAIN.$mainClock.years, $strings.$map_date_weekdays[(MAIN.$mainClock.date + 5) % 7]));
}

$buttonNames = ["pause", "play", "fast", "faster"];
$gameSpeeds = [0.0, 1.0, 4.0, 10.0];
$buttons = [];
$selectedSpeed = (MAIN.$mainClock.speed == 0.0) ? 0 : 1;

for ($i = 0; $i < #$buttonNames; ++$i) {
  $buttons[$i] = MAIN.$ui.createChoiceButton($bottomArea, $bottomArea, 135 + $i * 22, 0, 22, 18, "", macro($i) :: selectSpeed($0), "/metro/ui/minimap/"+$buttonNames[$i]+".dds", "/metro/ui/minimap/"+$buttonNames[$i]+"_se.dds", "/metro/ui/minimap/"+$buttonNames[$i]+"_ho.dds");
  $buttons[$i].setCropRect(7.0 / 32.0, 6.0 / 32.0, 22.0 / 32.0, 18.0 / 32.0);
  MAIN.$ui.setTooltip($buttons[$i], $strings.$map_speed_hints[$i], 0, -1);
}
MAIN.$ui.selectChoiceButton($buttons[$selectedSpeed], $bottomArea);

function selectSpeed($index) {
  if ($disableTime && $index != 0) return;
  $selectedSpeed = $index;
  $gameSpeed = $gameSpeeds[$selectedSpeed];
  MAIN.$grid.timeSpeed = $gameSpeed;
  MAIN.$scene.particleEngine.timeSpeed = max(1.0, $gameSpeed);
  MAIN.$mainClock.speed = $gameSpeed * 10000.0;
  MAIN.$ui.selectChoiceButton($buttons[$index], $bottomArea);
  setRunSpeed("game", $gameSpeed);
}

event $minimap.mouseDown::["MouseLeft"]($x, $y) {
  $pos = $minimap.mapToWorldPosition($x, $y);
  MAIN.$gameUI.setCameraPos(vector_x($pos), vector_z($pos), true);
}

event $minimap.onMouseDrag::($x, $y, $dx, $dy) {
  $pos = $minimap.mapToWorldPosition($x, $y);
  MAIN.$gameUI.setCameraPos(vector_x($pos), vector_z($pos));
}

with ($viewport = new_mapViewport($minimap)) {
  .viewport = MAIN.$viewport;
  .visible = true;
  .canActivate = false;
  .clickThrough = true;
}

$texture = $window.video.new_texture();

$grid.renderMap($texture, $textureSize, $textureSize, 0);
$minimap.setImage($texture);

thread "gameUI" :: loop {
  wait 1.0;
  if ($forcedMode == 0) {
    $grid.renderMap($texture, $textureSize, $textureSize, $dataMode);
    if ($dataMode != GRID_VIEW_DEFAULT && MAIN.$grid.viewMode != GRID_VIEW_UNDERGROUND) {
      skip_frame;
      MAIN.$grid.viewMode = $dataMode;
    }
  } else {
    $grid.renderMap($texture, $textureSize, $textureSize, $forcedMode);
  }
};

function setDataMode($mode) {
  $dataMode = $mode;
  if ($forcedMode == 0) {
    $grid.renderMap($texture, $textureSize, $textureSize, $dataMode);
    if (MAIN.$grid.viewMode == GRID_VIEW_UNDERGROUND) {
      toggleUndergroundView();
    } else {
      MAIN.$grid.viewMode = $dataMode;
    }
  }
}

function forceMode($mode) {
  $forcedMode = $mode;
  if ($forcedMode == 0) {
    $datapanelButton.enabled = true;
    $datapanelButton.visibility = 1.0;
    $grid.renderMap($texture, $textureSize, $textureSize, $dataMode);
    if (MAIN.$grid.viewMode != GRID_VIEW_UNDERGROUND) MAIN.$grid.viewMode = $dataMode;
  } else {
    $datapanel.hide();
    MAIN.$ui.unselectChoiceButton($datapanelButton, $datapanelButton);
    $datapanelButton.enabled = false;
    $datapanelButton.visibility = 0.2;
    $grid.renderMap($texture, $textureSize, $textureSize, $forcedMode);
    if (MAIN.$grid.viewMode != GRID_VIEW_UNDERGROUND) {
      MAIN.$grid.viewMode = $forcedMode;
    }
  }
}

function update() {
  if ($forcedMode == 0) {
    $grid.renderMap($texture, $textureSize, $textureSize, $dataMode);
  } else {
    $grid.renderMap($texture, $textureSize, $textureSize, $forcedMode);
  }
}

function createRoute($object) {
  with ($route = new_mapRoute($minimap)) {
    .route = $object;
    .visible = true;
    .canActivate = false;
    .clickThrough = true;
    .setShader("/metro/shaders/path/route.shader");
    .sendToBack();
  }
  return $route;
}

function createPin($object, $color, $name = "", $pos = vector()) {
  with ($item = new_mapItem($minimap)) {
    .setRect(0, 0, 32, 32);
    if ($name != "") {
      .setImage("metro/ui/minimap/"+$name+"-pin.dds");
    } else {
      .setImage("metro/ui/minimap/map-pin.dds");
      .background = $color;
    }
    .targetModule = $object;
    .targetPos = $pos;
    .setFont("metro/ui/minimap/font", 0xFFFFFFFF, 5, 5);
    .textAlign = ALIGN_MIDDLE | ALIGN_CENTER;
    .setMargins(22, 4, 1, 21);
    .canRotate = false;
    .visible = true;
    .canActivate = false;
    .clickThrough = true;
  }
  return $item;
}

function setNewsPos($pos) {
  if ($newsPin == null) {
    $newsPin = createPin(null, 0xFFFFFFFF, "news", $pos);
  } else {
    $newsPin.targetPos = $pos;
  }
}

event $player.onModeChange::($oldMode) {
  skip_frame;
  if ($player.editMode == GRIDMODE_LAY_TRACK && $player.toolMode == GRIDMETRO_SUBWAY) {
    if (MAIN.$grid.viewMode != GRID_VIEW_UNDERGROUND) {
      toggleUndergroundView();
      $undergroundForced = true;
    }
  } else if ($undergroundForced) {
    toggleUndergroundView();
  }
}

event this.onDestroy::() {
  delete $bg;
  delete $icons;
  delete $datapanel;
  MAIN.$minimap = null;
}

GAME BALANCE ISSUE: Because there are no passengers and no service at night, you'll lose money unless you also install the MX mod. http://forum.paradoxplaza.com/forum/...ive-lines-only

KNOWN BUG - none of the government buildings (Police station, hospital, city hall, ministry, ect...) would shut down at night. I suspect it might be a bug elsewhere in the game code itself. There are currently 2 workarounds - either make sure no government buildings exist in the city (by demolishing), or use stevebone's suggestion below and extract the following files from \metro\objects\buildings\

cityhall\cityhall.script
dam-palace\dam_palace.script
government-offices\governmentoffices.script
hofburg\hofburg.script
hospital\hospital.script
parliament\parliament_house.script
\police-station\policestation.script
\police-station\policestationb.script

then delete the following line in each file
this.addVisitPlaces(GRID_VISIT_GOVERNMENT, XX);

This should eliminate the above buildings' governmental functions and bypass the bug.


Dernière édition par Lemmy1916 le Lun 4 Juil - 16:30, édité 1 fois
Revenir en haut Aller en bas
https://citiesinmotion.forumgaming.fr
Lemmy1916
Fondateur
Fondateur
Lemmy1916

Masculin Bélier Chien
Messages : 1019
Points : 6511
Réputation : 45
Date d'inscription : 12/02/2011
Age : 42
Localisation : nancy (54)
Humeur : pépère ....

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeLun 4 Juil - 16:29

[MOD] Maintenance, fuel, and wages fees mod - Active lines only

Mod Description:

This simple mod changes the way the game calculates maintenance and wages.

By default, maintenance, fuel, and wages are deducted from your account for all vehicles assigned to a line on your roster, even if that line is not active.

With this mod, maintenance, fuel, and wages will only be charged on lines and stops that are active.

The mod consists of the following file:

C:\Program Files\Cities In Motion\metro\scripts\player.script

Copy and past the following code into Notepad to create the script file.

player.script
Code:


$viewport = MAIN.$viewport;
$desktop = MAIN.$desktop;
$grid = MAIN.$grid;
$camera = MAIN.$camera;
$strings = MAIN.$strings;

MAIN.$playerData = this;
MAIN.$gameData = $data = load "/"+MAIN.$dataFileName;
checkExtraVehicles();
checkExtraBanks();

$tramBuildCount = 0;
$tramEndCount = 0;

if (MAIN.$scenario : false) {
  $scenarioData = MAIN.$scenario.$scenario;
  MAIN.$scenario.initEngineData();
  if ($data.$defaultValues : false) {
    $data.$lastYearCompanyValue = MAIN.$scenario.$scenario.$money;
    MAIN.$scenario.initGameData();
    $data.$defaultValues = false;
  }
} else {
  $scenarioData = null;
}

with (MAIN.$player = $player = new_gridPlayer($desktop)) {
  .setRect(0, 0, $desktop.width, $desktop.height);
  .visible = true;
  .active = true;
  .grid = $grid;
  .camera = $camera;
  .viewport = $viewport;
}

// Create hud layers
with (MAIN.$hud = $hud = new_control($player)) {
  .setRect(0, 0, $viewport.width, $viewport.height);
  .canActivate = false;
  .clickThroughSelf = true;
  .visible = true;//!(MAIN.$settings.$videoCaptureMode : false);
  .audible = true;
}
with (MAIN.$backHud = $backHud = new_control($hud)) {
  .setRect(0, 0, $viewport.width, $viewport.height);
  .canActivate = false;
  .clickThroughSelf = true;
  .visible = true;
  .audible = true;
}
with (MAIN.$frontHud = $frontHud = new_tracerOrganizer($hud)) {
  .setRect(0, 0, $viewport.width, $viewport.height);
  .canActivate = false;
  .clickThroughSelf = true;
  .visible = true;
  .audible = true;
}

function checkExtraVehicles() {
  $vehicles = MAIN.$level.getPlayerVehicles();
  foreach (keys $vehicles) {
    if (!(defined MAIN.$gameData.$availableVehicles[current])) {
      MAIN.$gameData.$availableVehicles[current] = $vehicles[current];
    }
  }
}

function checkExtraBanks() {
  $banks = MAIN.$level.getAvailableBanks();
  foreach (keys $banks) {
    if (!(defined MAIN.$gameData.$availableBanks[current])) {
      MAIN.$gameData.$availableBanks[current] = $banks[current];
    }
  }
}

function spendMoney($amount, $purchase = true) {
  if ($amount == 0) return true;
  if ($scenarioData == null) return true;
  if ($scenarioData.$money < $amount) return false;
  if ($scenarioData.$money != 2000000000) $scenarioData.$money -= $amount;
  if ($purchase) $data.$currentPurchases -= $amount;
  return true;
}

function earnMoney($amount, $sale = true) {
  if ($scenarioData == null) return;
  $wasMoney = $scenarioData.$money;
  if ($scenarioData.$money - 2000000000 + $amount >= 0) $scenarioData.$money = 2000000000;
  else $scenarioData.$money += $amount;
  if ($sale) $data.$currentSales += $amount;
  MAIN.$score.$maxPlayerMoney = max(MAIN.$score.$maxPlayerMoney, $scenarioData.$money);
  if ($wasMoney < 1500000 && $scenarioData.$money >= 1500000) MAIN.$achievement.unlock(16);
  if ($wasMoney < 10000000 && $scenarioData.$money >= 10000000) MAIN.$achievement.unlock(17);
}

function saveData($dataFileName) {
  $data.exportVariablesTo($dataFileName, "defaultValues", "fuelPrice", "electricityPrice", "customerHappiness", "employeeHappiness", "companyReputation", "currentProfit",
    "monthlyTicketProfit", "currentPenalties", "monthlyPenalties", "monthlyProfit", "currentPurchases", "vMaintenanceExpenses", "sMaintenanceExpenses", "energyExpenses",
    "loanExpenses", "wageExpenses", "purchaseExpenses", "monthlyExpenses", "totalMonthlyProfit", "serviceCoverage", "serviceCoverageHistory", "serviceUsage",
    "serviceUsageHistory", "availableVehicles", "vehiclePurchaseCount", "ownVehicles", "loanPayments", "lastLineIndex", "lines", "ticketPrices", "availableBanks",
    "totalMonthlyProfitHistory", "customerProfiles", "economyHistory", "economyTarget", "activeIcons", "maintenanceLevel", "wageLevel", "companyReputationHistory",
    "electricityPriceHistory", "fuelPriceHistory", "populationHistory", "companyDebtHistory", "passengersCarried", "lastIconID", "unemploymentHistory", "totalReputation",
    "carUsageHistory", "serviceUsages", "extraHappiness", "vehiclePriceMultiplier", "companyValue", "salesIncome", "currentSales", "companyValueHistory",
    "availableCampaigns", "advertisingCampaigns", "tickerItems", "maintenanceLevel2", "lastYearCompanyValue", "yearlyCustomerHappiness", "boardRating", "customerRating",
    "mostProfitableVehicle", "leastProfitableVehicle", "yearlyTasksCompleted", "lastYearTasksCompleted", "yearlyPassengersCarried", "lastYearPassengersCarried",
    "yearlyVehiclesSold", "lastYearVehiclesSold", "lastYearCoverage", "yearlyFires", "lastYearFires", "yearlyCollisions", "lastYearCollisions", "passengersCarriedHistory",
    "vehicleSpeedMultiplier", "vehicleEnergyMultiplier", "subventionCount", "transportedToMall", "maxYearlyVehicles", "baseCompanyValue");
  $data.scriptFilename = $dataFileName;
}

function updateEmployeeHappiness() {
  $baseWages = [1100, 1200, 1100, 1600];
  for ($i = 0; $i < 4; ++$i) {
    $data.$employeeHappiness[$i] = clamp(0.5 + ($data.$wageLevel[$i] - MAIN.$economy.getWage($baseWages[$i])) * ($i + 2) * 0.00025, 0.0, 1.0);
  }
}

function updateReputation() {
  $reputationMultipliers = [0.12, 0.12, 0.12, 0.40];
  $baseHappiness = 0.0;
  for ($i = 0; $i < 4; ++$i) {
    $baseHappiness += ($data.$employeeHappiness[$i] - 0.5) * $reputationMultipliers[$i];
  }
  $oldReputation = $data.$totalReputation;
  $data.$totalReputation = 0.0;
  for ($i = 0; $i < 7; ++$i) {
    $oldReputation2 = $data.$companyReputation[$i];
    $data.$companyReputation[$i] = clamp($baseHappiness + $data.$customerHappiness[$i] + $data.$extraHappiness[$i], 0.0, 1.0);
    $data.$totalReputation += $data.$companyReputation[$i] * 0.14285;
//    if ($oldReputation2 < 0.890 && $data.$companyReputation[$i] >= 0.890) {
//      MAIN.$petitionbar.addTickerText(1, escapePattern(expandPattern($strings.$newsticker_highReputations_text[$i], MAIN.$scenario.getCityName())));
//    } else if ($oldReputation2 > 0.510 && $data.$companyReputation[$i] <= 0.510) {
//      MAIN.$petitionbar.addTickerText(0, escapePattern(expandPattern($strings.$newsticker_lowReputations_text[$i], MAIN.$scenario.getCityName())));
//    }
  }
  foreach ($grid.lines.children()) {
    .attractiveness = $data.$totalReputation;
  }
  MAIN.$score.$minReputation = min(MAIN.$score.$minReputation, $data.$totalReputation);
  MAIN.$score.$maxReputation = max(MAIN.$score.$maxReputation, $data.$totalReputation);
  if ($oldReputation < 0.700 && $data.$totalReputation >= 0.700) MAIN.$achievement.unlock(6);
  if ($oldReputation < 0.995 && $data.$totalReputation >= 0.995) MAIN.$achievement.unlock(7);
  if ($oldReputation > 0.004 && $data.$totalReputation <= 0.004) MAIN.$achievement.unlock(8);
  if ($oldReputation < 0.890 && $data.$totalReputation >= 0.890) {
    MAIN.$petitionbar.addTickerText(1, escapePattern(expandPattern($strings.$newsticker_reputation2_text, MAIN.$campaign.$campaign.$companyName)));
  } else if ($oldReputation < 0.730 && $data.$totalReputation >= 0.730) {
    $citizen = MAIN.$grid.citizens.getRandomCitizen();
  //  if ($citizen) {
  //    MAIN.$petitionbar.addTickerText(1, escapePattern(expandPattern($strings.$newsticker_reputation1_text, MAIN.$secondaryView.getCitizenName($citizen))), MAIN.$secondaryView.getCitizenPosition($citizen));
  //  }
  }
}

function updateCompanyValue() {
  if ($scenarioData == null) return;

  $data.$companyValue = $scenarioData.$money + $data.$baseCompanyValue;
  foreach (keys $data.$ownVehicles) {
    $vehicleData = $data.$ownVehicles[current];
    $object = MAIN.$grid.getGridObject($vehicleData["name"]);
    $data.$companyValue += int($object.$price * $vehicleData["condition"]);
  }
  /*$count = MAIN.$grid.lines.getStopCount();
  for ($i = 0; $i < $count; ++$i) {
    $stop = MAIN.$grid.lines.getStop($i);
    if (($stop.getFlags() & GRID_ITEM_TEMP) == 0) {
      $model = $stop.getModel();
      if (defined $model.$price) {
        $data.$companyValue += $model.$price;
      }
    }
  }*/
  foreach ($data.$advertisingCampaigns) {
    $data.$companyValue += current["months"] * int($data.$availableCampaigns[current["type"]][1] * MAIN.$grid.citizens.count);
  }
  foreach ($data.$loanPayments) {
    $data.$companyValue -= current["amount"];
  }
  $data.$companyValue = max(0, $data.$companyValue);
}

event MAIN.$grid.citizens.onCitizenArrive::($citizen) {
  if ($citizen.getState() == GRID_CITIZEN_TRAVEL) {
    ++$data.$passengersCarried;
    ++MAIN.$score.$passengersTransported[$citizen.getClass()];
    if (++MAIN.$score.$totalTransported == 10000) MAIN.$achievement.unlock(1);
    $transportsUsed = $citizen.usedTransport();
    MAIN.$score.$maxTransportsUsed = max(MAIN.$score.$maxTransportsUsed, $transportsUsed);
    if ($transportsUsed >= 5) MAIN.$achievement.unlock(24);
    $source = $citizen.getStart();
    $target = $citizen.getTarget();
    if ($source == null || $target == null) return;
    if ($citizen.usedTransport(TRANSPORTLINE_HELICOPTER)) {
      if ($target.getModel().idName == "shoppingcenter") {
        $num = ++$data.$transportedToMall;
        MAIN.$score.$maxTransportedToMall = max(MAIN.$score.$maxTransportedToMall, $num);
        if ($num == 500) MAIN.$achievement.unlock(36);
      }
    }
    foreach (values MAIN.$scenario.$scenario.$objectives) {
      if (defined current["arrived"]) {

        if (defined current["total"]) current["total"]++;

        if (defined current["transportType"]) {
          if (!$citizen.usedTransport(current["transportType"])) continue;
        }

        if (defined current["citizenType"]) {
          if ($citizen.getClass() != current["citizenType"]) continue;
        }

        $radius = 10.0;
        if (defined current["radius"]) $radius = current["radius"];

        $posIndex = 0;
        while (defined current["sourcePos"+$posIndex]) {
          if (vector_length($source.position - current["sourcePos"+$posIndex]) <= $radius) {
            $posIndex = 0;
            break;
          }
          ++$posIndex;
        }
        if ($posIndex > 0) continue;

        $posIndex = 0;
        while (defined current["targetPos"+$posIndex]) {
          if (vector_length($target.position - current["targetPos"+$posIndex]) <= $radius) {
            $posIndex = 0;
            break;
          }
          ++$posIndex;
        }
        if ($posIndex > 0) continue;

        if (defined current["visitType"]) {
          if (current["visitType"] == GRID_VISIT_WORK) {
            if ($target != $citizen.getWorkplace()) continue;
          }
        }

        current["arrived"]++;
      }
    }
  }
}

function updateMonthlyProfit() {
  $data.$energyExpenses = 0;

  $data.$vMaintenanceExpenses = 0;
  $numVehicles = 0;
  foreach ($grid.lines.children())
  {if (.active == true)
    {foreach (.getVehicles())
     {
      $transportVehicle = current;
      $vehicleData = $data.$ownVehicles[.$id];
      $vehicle = MAIN.$grid.getGridObject($vehicleData["name"]);
      $vehicleData["fuelExpenses"] = -int(int($vehicle.$fuelConsumption * $data.$vehicleEnergyMultiplier[$vehicle.$type]) * $data.$fuelPrice) - int(int($vehicle.$electricityConsumption * $data.$vehicleEnergyMultiplier[$vehicle.$type]) * $data.$electricityPrice);
      $data.$energyExpenses += $vehicleData["fuelExpenses"];
      $data.$vMaintenanceExpenses -= int($data.$maintenanceLevel[$vehicle.$type] * $vehicle.$price * 0.0005);
      ++$numVehicles;
      if ($vehicle.$type == 2) ++$numVehicles;
      }
   }
  }

  $data.$wageExpenses = -$numVehicles * $data.$wageLevel[0] - (($numVehicles+4)/5) * $data.$wageLevel[1] - (($numVehicles+2)/3) * $data.$wageLevel[2] - (($numVehicles+3)/4) * $data.$wageLevel[3];

  $data.$sMaintenanceExpenses = 0;
  $stopCount = $grid.lines.getStopCount();
  for ($i = 0; $i < $stopCount; ++$i) {
    $stop = $grid.lines.getStop($i);
    if (($stop.getFlags() & GRID_ITEM_TEMP) == 0) {
      if ($stop.passengerCount >= 0.1)
      {$data.$sMaintenanceExpenses -= int($data.$maintenanceLevel2[$stop.type] * $stop.getModel().$maintenanceCost * 0.01);
      }
   }
  }

  $data.$loanExpenses = 0;
  for ($i = #$data.$loanPayments-1; $i >= 0; --$i) {
    $loan = $data.$loanPayments[$i];
    $payment = int(MAIN.$hqpanel.calculateMonthlyPayment($loan["amount"], $loan["interest"], $loan["months"]));
    $data.$loanExpenses -= $payment;
  }

  $data.$purchaseExpenses = $data.$currentPurchases;
  $data.$salesIncome = $data.$currentSales;

  $data.$monthlyExpenses = $data.$vMaintenanceExpenses + $data.$sMaintenanceExpenses + $data.$energyExpenses + $data.$loanExpenses + $data.$wageExpenses + $data.$purchaseExpenses + $data.$advertisingExpenses;

  $data.$monthlyProfit = $data.$salesIncome + $data.$monthlyPenalties;
  for ($i = 0; $i < 5; ++$i) {
    $data.$monthlyProfit += $data.$monthlyTicketProfit[$i];
  }

  $data.$totalMonthlyProfit = $data.$monthlyProfit + $data.$monthlyExpenses;
}

event MAIN.$mainClock.onMonth::() {
  if ($scenarioData == null) return;

  foreach ($grid.lines.children()) {
    foreach (.getVehicles()) {
      $transportVehicle = current;
      $vehicleData = MAIN.$gameData.$ownVehicles[.$id];
      $vehicle = MAIN.$grid.getGridObject($vehicleData["name"]);
      $maintenanceLevel = MAIN.$gameData.$maintenanceLevel[$vehicle.$type];
      $targetCondition = 1.0 / (1.0 + $transportVehicle.travelDistance / (200000.0 * (0.1 + $vehicle.$reliability * 0.9) * (0.1 + $maintenanceLevel * 0.009)));
      $vehicleData["condition"] = $transportVehicle.condition = $vehicleData["condition"] * 0.8 + $targetCondition * 0.2;
      $vehicleData["monthlyInCome"] = $vehicleData["moneyEarned"];
      $vehicleData["moneyEarned"] = 0;
      $transportVehicle.attractiveness = $vehicle.$attractiveness * $vehicleData["condition"];
      $vehicleData["travelDistance"] = $transportVehicle.travelDistance;
      $vehicleData["passengersTransported"] = $transportVehicle.passengersTransported;
      $vehicleData["yearlyProfit"] += $vehicleData["monthlyInCome"] + $vehicleData["fuelExpenses"] - int($data.$maintenanceLevel[$vehicle.$type] * $vehicle.$price * 0.0005);
    }
  }

  updateMonthlyProfit();
  $data.$currentPurchases = 0;
  $data.$currentSales = 0;
  $data.$advertisingExpenses = 0;

  $wasDebtPaid = MAIN.$score.$debtPaid;
  $totalDebt = 0;
  for ($i = #$data.$loanPayments-1; $i >= 0; --$i) {
    $loan = $data.$loanPayments[$i];
    $payment = int(MAIN.$hqpanel.calculateMonthlyPayment($loan["amount"], $loan["interest"], $loan["months"]));
    $loan["amount"] -= $payment - int($loan["amount"] * ($loan["interest"] / 1200.0));
    if (--$loan["months"] == 0) {
      array_splice($data.$loanPayments, $i, 1);
    } else {
      $totalDebt += $loan["amount"];
    }
    MAIN.$score.$debtPaid += $payment;
  }
  for ($i = #$data.$advertisingCampaigns-1; $i >= 0; --$i) {
    $campaign = $data.$advertisingCampaigns[$i];
    for ($j = 0; $j < 7; ++$j) {
      $data.$extraHappiness[$j] += $data.$availableCampaigns[$campaign["type"]][2][$j] * 0.1;
    }
    if (--$campaign["months"] == 0) {
      array_splice($data.$advertisingCampaigns, $i, 1);
    }
  }

  $stopCount = $grid.lines.getStopCount();
  for ($i = 0; $i < $stopCount; ++$i) {
    $stop = $grid.lines.getStop($i);
    if (($stop.getFlags() & GRID_ITEM_TEMP) == 0) {
      $stop.attractiveness = $stop.getModel().$attractiveness * (1.167 - 0.2 / (MAIN.$gameData.$maintenanceLevel2[$stop.type] * 0.01 + 0.2));
    }
  }

  $scenarioData.$money += $data.$monthlyExpenses - $data.$purchaseExpenses - $data.$advertisingExpenses;

  for ($i = 0; $i < 5; ++$i) {
    $data.$monthlyTicketProfit[$i] = $data.$currentProfit[$i];
    $data.$currentProfit[$i] = 0;
  }
  $data.$monthlyPenalties = $data.$currentPenalties;
  $data.$currentPenalties = 0;

  $oldCoverage = $data.$serviceCoverage;
  $data.$totalMonthlyProfitHistory[] = $data.$totalMonthlyProfit;
  $data.$serviceCoverage = $grid.citizens.getCanTravelCount(-1) * 100.0 / max(1, $grid.citizens.getTravelCount(-1) + $grid.citizens.getDriveCount(-1) + $grid.citizens.getWalkCount(-1));
  $data.$serviceCoverageHistory[] = $data.$serviceCoverage;
  $data.$serviceUsage = $grid.citizens.getTravelCount(-1) * 100.0 / max(1, $grid.citizens.getCanTravelCount(-1));
  $data.$serviceUsageHistory[] = $data.$serviceUsage;
  for ($i = 0; $i < 7; ++$i) {
    $data.$serviceUsages[$i] = $grid.citizens.getTravelCount($i) * 100.0 / max(1, $grid.citizens.getCanTravelCount($i));
    if ($data.$extraHappiness[$i] > 0.0) $data.$extraHappiness[$i] = max(0.0, $data.$extraHappiness[$i] - 0.02);
      else $data.$extraHappiness[$i] = min(0.0, $data.$extraHappiness[$i] + 0.02);
    $data.$yearlyCustomerHappiness += $data.$customerHappiness[$i] * 0.0119047619;
  }
  $data.$carUsageHistory[] = $grid.citizens.getDriveCount(-1) * 100.0 / max(1, $grid.citizens.getTravelCount(-1) + $grid.citizens.getDriveCount(-1) + $grid.citizens.getWalkCount(-1));
  $data.$companyReputationHistory[] = $data.$totalReputation * 100.0;
  $data.$companyDebtHistory[] = $totalDebt;
//  if ($grid.citizens.getPriceTooHighCount(-1) * 100.0 / max(1, $grid.citizens.getCanTravelCount(-1)) > 20.0) {
//    MAIN.$petitionbar.addTickerText(0, $strings.$newsticker_priceTooHigh_text);
//  }
  if (MAIN.$economy : false) {
    MAIN.$economy.updateEconomy();
  }
  $data.$passengersCarriedHistory[] = $data.$passengersCarried;
  $data.$yearlyPassengersCarried += $data.$passengersCarried;
  $data.$passengersCarried = 0;
  updateEmployeeHappiness();
  updateReputation();
  updateCompanyValue();
  $data.$companyValueHistory[] = $data.$companyValue;
  $grid.citizens.resetTripCounts();
  if (MAIN.$hqpanel : false) {
    MAIN.$hqpanel.updatePanel();
  }
  if (MAIN.$graphspanel : false) {
    MAIN.$graphspanel.updateGraphs();
  }

  if (#$data.$totalMonthlyProfitHistory >= 3) {
    $num = 0;
    for (; $num < 3; ++$num) {
      if ($data.$totalMonthlyProfitHistory[#$data.$totalMonthlyProfitHistory-1-$num] < 50000) break;
    }
    MAIN.$score.$maxProfitMonths = max(MAIN.$score.$maxProfitMonths, $num);
    if ($num >= 3) MAIN.$achievement.unlock(9);
  }
  MAIN.$score.$maxMonthlyProfit = max(MAIN.$score.$maxMonthlyProfit, $data.$totalMonthlyProfit);
  if ($data.$totalMonthlyProfit >= 150000) MAIN.$achievement.unlock(10);
  MAIN.$score.$maxCoverage = max(MAIN.$score.$maxCoverage, $data.$serviceCoverage);
  if ($data.$serviceCoverage >= 10.0) MAIN.$achievement.unlock(11);
  if ($data.$serviceCoverage >= 99.9) MAIN.$achievement.unlock(12);
  //for ($i = 0; $i < 7; ++$i) {
    //if ($data.$serviceUsages[$i] >= 50.0) MAIN.$achievement.unlock(55 + $i*2);
    //if ($data.$serviceUsages[$i] >= 80.0) MAIN.$achievement.unlock(56 + $i*2);
  //}
  if ($wasDebtPaid < 1000000 && MAIN.$score.$debtPaid >= 1000000) MAIN.$achievement.unlock(14);
  if ($wasDebtPaid < 2000000 && MAIN.$score.$debtPaid >= 2000000) MAIN.$achievement.unlock(15);
  if ($oldCoverage < 84.0 && $data.$serviceCoverage >= 84.0) {
    MAIN.$petitionbar.addTickerText(1, $strings.$newsticker_coverage_text);
  }
  $h = $data.$economyHistory;
  if ($h[#$h-1] > 0.0 && $h[#$h-2] <= 0.0) {
    if ($h[#$h-1] > $h[#$h-2] && $h[#$h-1] > $h[#$h-3] && $h[#$h-1] > $h[#$h-4] && $h[#$h-1] > $h[#$h-5]) {
      MAIN.$petitionbar.addTickerText(1, escapePattern(expandPattern(MAIN.$strings.$newsticker_economicBoom_text, MAIN.$scenario.getCityName())));
    }
  } else if ($h[#$h-1] < 0.0 && $h[#$h-2] >= 0.0) {
    if ($h[#$h-1] < $h[#$h-2] && $h[#$h-1] < $h[#$h-3] && $h[#$h-1] < $h[#$h-4] && $h[#$h-1] < $h[#$h-5]) {
      MAIN.$petitionbar.addTickerText(0, escapePattern(expandPattern(MAIN.$strings.$newsticker_economicDrop_text, MAIN.$scenario.getCityName())));
    }
  }
  $h = $data.$unemploymentHistory;
  if ($h[#$h-1] >= 12.0 && $h[#$h-2] < 12.0) {
    MAIN.$petitionbar.addTickerText(0, escapePattern(expandPattern(MAIN.$strings.$newsticker_unemploymentIncrease_text, MAIN.$scenario.getCityName(), $h[#$h-1])));
  } else if ($h[#$h-1] <= 9.0 && $h[#$h-2] > 9.0) {
    MAIN.$petitionbar.addTickerText(1, escapePattern(expandPattern(MAIN.$strings.$newsticker_unemploymentDecrease_text, MAIN.$scenario.getCityName(), $h[#$h-1])));
  }
}

event this.onDestroy::() {
  delete $player;
  delete $data;
  MAIN.$player = null;
  MAIN.$playerData = null;
  MAIN.$gamedata = null;
Revenir en haut Aller en bas
https://citiesinmotion.forumgaming.fr
Jean-Mahmoud
Confirmé
Confirmé


Masculin Balance Serpent
Messages : 64
Points : 4949
Réputation : 22
Date d'inscription : 20/03/2011
Age : 34
Localisation : L'Ipicerie di Paris
Humeur : Bijouuuuur !

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeMer 2 Nov - 2:50

Alors là... Si ce mod fonctionne, c'est à en faire comme ton avatar, Lemmy Cool
Revenir en haut Aller en bas
Yan
Petit nouveau
Petit nouveau


Messages : 6
Points : 4890
Réputation : 1
Date d'inscription : 24/02/2011

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeMer 7 Mar - 11:20

Salut les gars Smile ,

Je souhaite relancer ce sujet car j'ai trouvé la présentation du mods "Rush Hour mods" foutument interresante, çà pimentera la simu d'ingrédients de réalisme supplémentaire jamais superflus Very Happy !!...

Quelqu'un d'entre vous l'aurait-il éssayé et pourrait-il me donner un retour avant que je m'aventure à le télécharger Suspect ?!!...

J'attends impatiemment vos réponses please Wink !!

Merci
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeMer 7 Mar - 17:20

Mais on là où ce mod ?? Faut le faire sois même ... Moi et l'anglais ça fait 40 désolé XD
Revenir en haut Aller en bas
http://www.tcfrance.net/
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeMer 7 Mar - 17:49

Je pense l'avoir installé et ça à pas l'air de fonctionner j'arrive pas à lancer une seule partie ... La barre de chargement se bloque à 45% environ ...
Revenir en haut Aller en bas
http://www.tcfrance.net/
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 19:03

pimpim76 a écrit:
Mais on là où ce mod ?? Faut le faire sois même ... Moi et l'anglais ça fait 40 désolé XD

pimpim76 a écrit:
Je pense l'avoir installé et ça à pas l'air de fonctionner j'arrive pas à lancer une seule partie ... La barre de chargement se bloque à 45% environ ...

Il faut copier/coller les codes dans le(s) fichier(s) indiqué(s), en respectant bien leur(s) dossier(s)... Oui, le gars du forum d'où ça provient avait des soucis avec les fichiers joints, voilà pourquoi il faut copier/coller.


Dernière édition par Vercingétorix353 le Jeu 8 Mar - 19:38, édité 1 fois (Raison : Faute de frappe)
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 19:41

Vercingétorix353 a écrit:
pimpim76 a écrit:
Mais on là où ce mod ?? Faut le faire sois même ... Moi et l'anglais ça fait 40 désolé XD

pimpim76 a écrit:
Je pense l'avoir installé et ça à pas l'air de fonctionner j'arrive pas à lancer une seule partie ... La barre de chargement se bloque à 45% environ ...

Il faut copier/coller les codes dans le(s) fichier(s) indiqué(s), en respectant bien leur(s) dossier(s)... Oui, le gars du forum d'où ça provient avait des soucis avec les fichiers joints, voilà pourquoi il faut copier/coller.

Justement j'ai tous bien suivi et ça marche pas je suis toujours bloqué =(
Revenir en haut Aller en bas
http://www.tcfrance.net/
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 19:49

Dans Mes Documents/Cities in Motion, il y a un fichier log_metro.txt . Tu peux me le montrer s'il te plaît ?
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 19:50

Le voilà ! (Merci pour l'aide)

Citation :
Opened log in "userdata/log_metro.txt".
Version: 1.0.21
initializing FMOD...
[done]
initializing OpenGL-window...
[done]
Loaded language "fr"
Engine initialization finished
Loading ui...
[done]
Loading addon "addons/mappack01"...
[done]
Loading addon "addons/munich"...
[done]
Loading addon "addons/stationpack01"...
[done]
Loading addon "addons/tokyo"...
[done]
Loading addon "addons/vehiclepack04"...
[done]
Loading achievements...
[done]
Loading main menu...
[done]
Start scenario "metro/scenarios/sandbox.scenario"
Loading game...
Error: Compiler error in "metro/scripts/player.script" at line 448: "}" expected but "" found!
Error: Runtime error in "metro/ui/minimap/minimap.script" at line 299: Undefined member name "onModeChange"!
Error: Runtime error in "metro/ui/secondaryview/secondaryview.script" at line 808: Undefined member name "onSelectObject"!
Error: Runtime error in "metro/ui/hoverinfo/hoverinfo.script" at line 173: Undefined member name "onHoverObject"!
Error: Runtime error in "metro/scripts/controls.script" at line 3: Undefined member name "keyDown"!
Error: Runtime error in "metro/scripts/ui.script" at line 160: Undefined member name "onDeactivate"!
Revenir en haut Aller en bas
http://www.tcfrance.net/
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 19:57

"Error: Compiler error in "metro/scripts/player.script" at line 448: "}" expected but "" found!"

Il a dû y avoir soit une erreur de copier-coller, soit une erreur de crochet fermant même dans le code publié ici.

Il manque un crochet fermant aux alentours de la ligne 448.

Edit : à la fin effectivement, il manque un "}" comme je peux le voir dans le post de Lemmy. Rajoute-le.
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 20:02

Donc si j'ai bien trouvé c'est là :

Code:
event this.onDestroy::() {
  delete $player;
  delete $data;
  MAIN.$player = null;
  MAIN.$playerData = null;
  MAIN.$gamedata = null;

Et donc je remplace par ça :

Code:
event this.onDestroy::() {
  delete $player;
  delete $data;
  MAIN.$player = null;
  MAIN.$playerData = null;
  MAIN.$gamedata = null;
}
Revenir en haut Aller en bas
http://www.tcfrance.net/
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 20:05

Voilà, c'est ça.

Je me demande ce qu'il s'est passé pour que le crochet final soit oublié...

Si ça ne marche pas, vérifie si les autres erreurs n'apparaissent pas dans le log après avoir réessayé de lancer ta partie.
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeJeu 8 Mar - 20:08

Et ça fonctionne !

Merci bien Vercingétorix =D
Maintenant je vais bien voir ce que donne ce mods ^^
Revenir en haut Aller en bas
http://www.tcfrance.net/
Yan
Petit nouveau
Petit nouveau


Messages : 6
Points : 4890
Réputation : 1
Date d'inscription : 24/02/2011

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 10:26

Salut les amis Smile ,

çà semble être en bonne voie pour la correction et l'installation du code à ce que je vois:lol: ..."pimpim76", j'attends impatiemment de tes nouvelles pour me dire ce que t'en penses Smile Wink !!...Et pendant que j'y réfléchis, si on doit démobiliser certaines rames de métro durant les heures creuses créées avec ce module, faudra bien que comme dans la réalité on leur crée des voies de remisage aux terminus pour qu'elles ne gênent pas la rotation des autres rames, comment va-t-on procéder, peut-on retravailler librement ces derniers Suspect?!! ...

Soit dit en passant, quelqu'un pourrait-il me dire si on a pu créer des dépôts pour les métros, et si oui où est-ce que je pourrais en trouver Suspect ?!!..
Revenir en haut Aller en bas
MP73
Admin
Admin
MP73

Masculin Scorpion Singe
Messages : 162
Points : 5105
Réputation : 16
Date d'inscription : 16/02/2011
Age : 43
Localisation : Marseille

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 16:51

Yan a écrit:
Soit dit en passant, quelqu'un pourrait-il me dire si on a pu créer des dépôts pour les métros, et si oui où est-ce que je pourrais en trouver Suspect ?!!..

Bonjour,

Il en était question (vu sur un site allemand), mais il semblerait que depuis septembre le projet soit tombé aux oubliettes... Crying or Very sad

Pour en revenir au sujet principal, vos impressions sur ce mod? Very Happy
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 18:41

Je suis pas trop fan ... Quand les lignes réouvrent les trains repartent à la queue leu leu et c'est nawak ... Ils auraient dû juste programmer de façon à ce que les rames bougent plus et reste sur place à une station pour garder une cadence logique ...

Après c'est bizarre de plus voir un seul métro à 22h et d'attendre 7h pour en ravoir ... Tête réhabiliter les horaires pour faire 6h 0h en circulations et 0h 6h fermé ...
Revenir en haut Aller en bas
http://www.tcfrance.net/
MP73
Admin
Admin
MP73

Masculin Scorpion Singe
Messages : 162
Points : 5105
Réputation : 16
Date d'inscription : 16/02/2011
Age : 43
Localisation : Marseille

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 19:24

Ok, c'est bien ce que je craignais, les trains à la quel leu leu!
le cadencement des rames, çà m'a toujours perturbé d'avoir à le gérer soi-même...!

pimpim76 a écrit:
Ils auraient
dû juste programmer de façon à ce que les rames bougent plus et reste
sur place à une station pour garder une cadence logique ...

A 200% d'accord avec toi! (Si seulement y'avait un mod pour çà!)

Par contre qu'en est-il des flux de passagers passé les 22 h? Y'a plus grand monde de partout ou bien y'a de l'affluence qu'autour des zones de loisirs?

Y'a plus de métro après 22h?? Shocked
(Remarque çà devrait pas me choquer, y'a plus de métro après 22h30 en semaine à Marseille! lol)
Revenir en haut Aller en bas
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet:    2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 19:27

La nuit les bâtiments sont automatiquement fermés (sauf ceux du "Gouvernement" à la base à cause d'un bug, mais ils disent comment résoudre le problème).
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 20:38

Je sais pas si c'est possible de faire un mod où les rames s'arrêtent en pleine voie ... Vu qu'en faite le mod ferme les lignes donc les trains disparaissent ...
Revenir en haut Aller en bas
http://www.tcfrance.net/
Vercingétorix353
Champion
Champion


Masculin Verseau Buffle
Messages : 338
Points : 5157
Réputation : 21
Date d'inscription : 28/07/2011
Age : 26
Localisation : Paris
Humeur : ça dépend de mon humeur ;)

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 20:52

Si seulement ça faisait comme la ligne 14 du métro de Paris : les trains arrêtent leur service dans les stations !
Revenir en haut Aller en bas
pimpim76
Expert
Expert


Masculin Capricorne Serpent
Messages : 79
Points : 4979
Réputation : 1
Date d'inscription : 13/02/2011
Age : 34
Localisation : Rouen
Humeur : mortellement drôle

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitimeVen 9 Mar - 21:21

Ce qu'il manque au jeu c'est un côté gestion, tu crée des voies de rangement et tu donnes ordre au train de s'y garer ou de s'en dégarer dès que tu le souhaites ...
Revenir en haut Aller en bas
http://www.tcfrance.net/
Contenu sponsorisé




2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Empty
MessageSujet: Re: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod   2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Icon_minitime

Revenir en haut Aller en bas
 

2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» [Mapping] Ajouter les véhicules en déco dans l'éditeur de carte

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Gestion TC - Cities In Motion :: 2 mods : Rush hour mod et Maintenance, fuel, and wages fees mod Telech :: Cities in motion :: Les Mods-