• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

douglasrac

General
24 Badges
Feb 23, 2011
2.300
184
  • Cities in Motion 2
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis III Complete
  • Divine Wind
  • Heir to the Throne
  • Cities in Motion
  • Magicka
  • Cities: Skylines - Campus
  • Prison Architect
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Natural Disasters
  • Stellaris Sign-up
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Magicka 2
  • Magicka: Wizard Wars Founder Wizard
  • 500k Club
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Cities: Skylines
As we know each region in the game has it's music (Plain game, some musics, Tokyo music for Japan region, U.S Cities etc). But when I create a whole new region how can I define what kind of music it will be played during sandbox?
 
The file metro\scripts\ambience.script is responsible for choosing music.
It chooses the music by era:
Era 0: Until 1944
Era 1: 1945 -1969
Era 2: 1970 -1994
Era 3: 1995 and after

UPDATE:
After a long search I found this:
Inside the file: usa\scripts\game.script, there is a function that loads the USA music in any region that loads the statue of liberty or lombard street.
Also, inside tokyo\scripts\game.script you can find the function that loads the tokyo music.
 
Last edited:
Thanks that helped.

But I don't know how to make it to load the main musics instead of Tokyo.
To not load USA I just changed the objects name of Statue of Liberty and Lombard Street. But Tokyo script just loads it. I try to create a ambience.script and load it but it doesnt work. I think the problem is because mods that load Monorail and Trolley buses have a game.script and that will load the musics.
I also can't create a game.script for my region because that would mean merge both game.script (Tokyo and USA) and that will add several conflicts.
 
Current progress:
I created game.script and added a folder named "music" to the mod with mp3 files inside.
This is my game.script file:
$grid = MAIN.$grid;

function updateERA($year) {
}

if ($grid.getGridObject("cityflag_israel")) {
MAIN.$ambience.$musicFileNames = [
"addons/IsraelMod/music/truck.mp3",
"addons/IsraelMod/music/truck.mp3",
"addons/IsraelMod/music/truck.mp3",
"addons/IsraelMod/music/truck.mp3"
];

if (MAIN.$ambience.$music) {
delete MAIN.$ambience.$music;
MAIN.$ambience.$music = null;
}
}
The when loading Tokyo, New York and SF, they load with the correct music.
When I load a city in the Israel regoin (my mod), it loads with my music.
BUT: All European cities load with my music instead of the original game music.

I don't have a mod that loads Monorail and and Trolley buses to all regoins.
 
But you are doing the same as USA approach. You are bounding the music load to an specific object you only have in Israel.
What if I create a city in Israel region and don't put an Israel flag?

And this is the whole content of your game.script? What happened to the rest of the content? The game gets from the original game.script or just don't get it? Because if the rest of the code is not there, I think eventually there will be an error. It's important content.
 
That's true. I am still looking for a way to recognize the region without referring to a specific item, but I am not sure it is possible.
From what I have seen, CO uses unique items from maps to recognize different maps and regions. In SF it is sometimes recognized by the cable cars or by lombard street.

The weird part is that the game loads my music even in European maps (Amsterdam, Helsinki etc.). Those cities doesn't have Israel flag.
 
I just figured a way out:
$grid.getGridObject("object_name") is checking if the object is available in the region, it doesn't matter if the object is actually placed in the map.
So, you need to have an object which is completely unique to your region.
Since you already changed the name of the Statue of Liberty so the game will not load the USA music, use the "new" name you gave it, and it will load the music you want. Even if you don't actually place the statue in the map.
 
Great! Thanks. But what about the rest of the game.script file?
I will load my music in a /scripts/music.script and see how it goes.


Ok it works as game.script inside the region folder. The rest of the codes is loaded from original file.
Thanks.
 
Last edited: