Post Reply 
 
Thread Rating:
  • 3 Votes - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial: Tropico 3 Music in Tropico 4
Author Message
rimlanin Offline
Comrade
***

Posts: 77
Joined: Aug 2010
Post: #1
Tutorial: Tropico 3 Music in Tropico 4
Hello, I, for one found the music of Tropico 4 unfitting the theme, because Tropico always struck me as a comedic, light-hearted game and the music was too serious.

This is a simple tut, I have tried on the Demo, but should work in the full version.

Go to: Tropico 4/Packs/boot and back up the file music.hpk (in case something bad happens, or you want the old music back).

Now, go the Tropico 3/Packs/boot and copy Music.hpk from there

Paste it back in the same directory, within the Tropico 4 folder and allow it to over-write.

Now join the game and Enjoy Tropico 3 music Smile

And yes, it should work the other way around (Trop 4 music in 3)
14-08-2011 10:00 AM
Find all posts by this user Quote this message in a reply
darius89 Offline
Member
***

Posts: 78
Joined: Mar 2011
Post: #2
RE: Tutorial: Tropico 3 Music in Tropico 4
(14-08-2011 10:00 AM)rimlanin Wrote:  Hello, I, for one found the music of Tropico 4 unfitting the theme, because Tropico always struck me as a comedic, light-hearted game and the music was too serious.

This is a simple tut, I have tried on the Demo, but should work in the full version.

Go to: Tropico 4/Packs/boot and back up the file music.hpk (in case something bad happens, or you want the old music back).

Now, go the Tropico 3/Packs/boot and copy Music.hpk from there

Paste it back in the same directory, within the Tropico 4 folder and allow it to over-write.

Now join the game and Enjoy Tropico 3 music Smile

And yes, it should work the other way around (Trop 4 music in 3)
Well done! I agree the music is too serious for Tropico and could do with being lighter, like the humorous theme. Thanks for finding a "work around", and last but not least welcome to the forum.

Viva El Presidente Smile
14-08-2011 11:11 AM
Find all posts by this user Quote this message in a reply
rimlanin Offline
Comrade
***

Posts: 77
Joined: Aug 2010
Post: #3
RE: Tutorial: Tropico 3 Music in Tropico 4
Thanks. Also good to see I am not the only one who found the musing unfitting Big Grin
14-08-2011 11:31 AM
Find all posts by this user Quote this message in a reply
Maximo Offline
Loyalist
*****

Posts: 338
Joined: Feb 2011
Post: #4
RE: Tutorial: Tropico 3 Music in Tropico 4
I've loved all of the music in the Tropico series so far (although going back to T1, the music is much more laid back and boring than I remember...as such I love the T3/T4 tunes).

Does this work for keeping the T4 music alongside the T3? Or is it a straight swap, you lose T4 tunes but get the T3 ones?

George W. Bush: "A dictatorship would be a heck of a lot easier, there's no question about it." El Presidente agrees. Cool
15-08-2011 04:46 PM
Find all posts by this user Quote this message in a reply
rimlanin Offline
Comrade
***

Posts: 77
Joined: Aug 2010
Post: #5
RE: Tutorial: Tropico 3 Music in Tropico 4
(15-08-2011 04:46 PM)Maximo Wrote:  I've loved all of the music in the Tropico series so far (although going back to T1, the music is much more laid back and boring than I remember...as such I love the T3/T4 tunes).

Does this work for keeping the T4 music alongside the T3? Or is it a straight swap, you lose T4 tunes but get the T3 ones?

Its a straight swap, you will lose the T4 music. I don't think there is a way to have them all, sadly.
15-08-2011 05:13 PM
Find all posts by this user Quote this message in a reply
ArmaDeFuego Offline
Posting Freak
*****

Posts: 311
Joined: Aug 2011
Post: #6
RE: Tutorial: Tropico 3 Music in Tropico 4
(15-08-2011 04:46 PM)Maximo Wrote:  I've loved all of the music in the Tropico series so far (although going back to T1, the music is much more laid back and boring than I remember

"Cafe, cafe, cafe dame mas cafe!"

I also loved the song from T1 that was called "La Playa" I think..... "Playa donde yo naci, en esta misma playa donde morire..."

There's a ton of cool songs from T1. T3 has a few that I like, but I think overall I liked the music from T1 better.
15-08-2011 05:45 PM
Find all posts by this user Quote this message in a reply
BarbeQ Offline
Junior Member
**

Posts: 10
Joined: Aug 2011
Post: #7
RE: Tutorial: Tropico 3 Music in Tropico 4
That brings an idea to my mind. How about an addition to the radio station called "Radio Flashback". If you select this one to air, T4 will play the music from T1. Maybe something for a DLC-package??
28-08-2011 10:13 AM
Find all posts by this user Quote this message in a reply
Arcalis Offline
Newbie
*

Posts: 9
Joined: Aug 2011
Post: #8
RE: Tutorial: Tropico 3 Music in Tropico 4
Is there a way to create your own soundtracks for the game? I can see the .hpk being an issue though.
28-08-2011 10:26 AM
Find all posts by this user Quote this message in a reply
Ap2000 Offline
T4 is ugly, mang.
**

Posts: 48
Joined: Aug 2011
Post: #9
RE: Tutorial: Tropico 3 Music in Tropico 4
(28-08-2011 10:13 AM)BarbeQ Wrote:  That brings an idea to my mind. How about an addition to the radio station called "Radio Flashback". If you select this one to air, T4 will play the music from T1. Maybe something for a DLC-package??

That's probably not easy to do since the dev AND publisher is a different one and the licencing of the music is another thing.

Also, I doubt many people would buy it and thus converting the music wouldn't be really profitable.
28-08-2011 05:51 PM
Find all posts by this user Quote this message in a reply
BarbeQ Offline
Junior Member
**

Posts: 10
Joined: Aug 2011
Post: #10
RE: Tutorial: Tropico 3 Music in Tropico 4
Guess you are right. But hey! El Presidente has his dreams Wink
28-08-2011 08:27 PM
Find all posts by this user Quote this message in a reply
whybuybeta Offline
Member
***

Posts: 131
Joined: Feb 2008
Post: #11
RE: Tutorial: Tropico 3 Music in Tropico 4
(28-08-2011 05:51 PM)Ap2000 Wrote:  That's probably not easy to do since the dev AND publisher is a different one and the licencing of the music is another thing.

Also, I doubt many people would buy it and thus converting the music wouldn't be really profitable.

but it's fair use to add them on our own, as long as we don't distribute the original files.

(15-08-2011 05:13 PM)rimlanin Wrote:  Its a straight swap, you will lose the T4 music. I don't think there is a way to have them all, sadly.

(28-08-2011 10:26 AM)Arcalis Wrote:  Is there a way to create your own soundtracks for the game? I can see the .hpk being an issue though.

yes there is a way, with lua compiler and batch found here. it works exactly the same for t4, only difference is the playlist location was moved to .\game\sound\playlists. I was about to post an updated version for t4, but there is some bug that prevents the new character voices from playing on events once you have your custom playlist. if we can figure out how to fix that, it can be used for t4 with no problem.

if you don't mind playing without those voices (there is text and they only read off the first line anyway), you can use the updated batch below (copy and paste into luag.bat). with this I got a mix of about 35 tracks from t1/t3/t4 all working in the game, comments reference t3 but I edited all the file/folder locations to work for t4:

Code:
::
:: Tropico3 playlist generator batch:
:: - run this batch to generate and compile custom lua playlists from music directory.
::
:: directions:
:: -1. create .\music folder in root directory of your game install
:: -2. add/remove your ogg tracks there
:: -3. copy luac.exe and this luag.bat batch to your music folder
:: -4. run this whenever you add/change any music to generate a new playlist and enable it in game
:: -5. thanks to slserpent for the lua compiler, enjoy your new soundtrack!
::
:: IMPORTANT:
:: - this batch must be named luag.bat, and run in your music folder named .\music,
::   the folder should also be placed in the same directory as tropico3.exe in the root
::   of your game install, to prevent from creating/messing with any unwanted files.
::
:: - to undo this mod, just delete the generated playlists.lua file
::   from ..\data\sounds\playlists to restore the original music.
::
@echo off
title=LUA Playlist Generator

:: look for tropico/music/compiler
echo.
echo ::
cd ..
if not exist tropico4.exe echo :: tropico3 not found! aborting. & goto end
if not exist .\music\luag.bat echo :: halp I'm lost! & echo :: make sure you have properly named and copied this batch to the music directory. & goto end
if exist .\music\luac.exe (echo :: looking for ogg files...) else (echo :: lua compiler not found! & echo :: This batch is to be run with luac.exe in your music directory. & goto end)
cd music
echo ::

:: generate playlist
set _txt=playlists.txt
set _anum=0
echo namespace("Playlists") > %_txt%
echo DefaultSilenceChance = 25 >> %_txt%
echo DefaultSilenceDuration = 15000 >> %_txt%
echo DefaultCrossfadeTime = 3000 >> %_txt%
echo BattleMusicTimeout = 60000 >> %_txt%
echo AllTracks = {} >> %_txt%
for /f "tokens=*" %%g in ('dir /b *.ogg') do (call :trackn "%%g")
echo ::
if %_anum% equ 0 (echo :: no tracks found! let's make some music. & goto end) else (echo :: %_anum% tracks found! & goto luac)

:: fill array elements - format:
:: AllTracks[N] = {path="Music/<filename>", frequency=100, SilenceDuration=DefaultSilenceDuration, SilenceChance=DefaultSilenceChance}
:trackn
set /a _anum+=1
echo :: found: %~1 & echo AllTracks[%_anum%] = {path="music/%~1", frequency=100, SilenceDuration=DefaultSilenceDuration, SilenceChance=DefaultSilenceChance} >> %_txt%
goto :eof

:: compile playlist
:luac
set _pldir=..\game\sound\playlists
echo ::
echo :: compiling playlist...
if not exist %_pldir% md %_pldir%
luac -o "%_pldir%\playlists.lua" %_txt%
if errorlevel 1 (echo :: lua error! & goto end) else (echo :: playlist written to %_pldir%\playlists.lua.)
echo ::
echo :: thanks to slserpent for the lua compiler!
echo ::

:: viva el presidente
:end
echo :: press a key to quit...
echo ::
echo.
pause >nul
::
(This post was last modified: 28-08-2011 10:33 PM by whybuybeta.)
28-08-2011 10:30 PM
Find all posts by this user Quote this message in a reply
Ap2000 Offline
T4 is ugly, mang.
**

Posts: 48
Joined: Aug 2011
Post: #12
RE: Tutorial: Tropico 3 Music in Tropico 4
(28-08-2011 10:30 PM)whybuybeta Wrote:  
(28-08-2011 05:51 PM)Ap2000 Wrote:  That's probably not easy to do since the dev AND publisher is a different one and the licencing of the music is another thing.

Also, I doubt many people would buy it and thus converting the music wouldn't be really profitable.

but it's fair use to add them on our own, as long as we don't distribute the original files.

Haven't said anything about that.
28-08-2011 10:34 PM
Find all posts by this user Quote this message in a reply
ChrisG683 Offline
Newbie
*

Posts: 7
Joined: Aug 2011
Post: #13
RE: Tutorial: Tropico 3 Music in Tropico 4
(14-08-2011 10:00 AM)rimlanin Wrote:  Hello, I, for one found the music of Tropico 4 unfitting the theme, because Tropico always struck me as a comedic, light-hearted game and the music was too serious.


Amen to that, I really don't like the whole audio feel of Tropico 4 (music, voice acting, etc.). Plus Juanito is gone!

I'll be bookmarking this for future reference if I get the game though, thanks!
29-08-2011 05:39 PM
Find all posts by this user Quote this message in a reply
Luukkie Offline
Newbie
*

Posts: 2
Joined: Aug 2011
Post: #14
RE: Tutorial: Tropico 3 Music in Tropico 4
Quote:yes there is a way, with lua compiler and batch found here. it works exactly the same for t4, only difference is the playlist location was moved to .\game\sound\playlists. I was about to post an updated version for t4, but there is some bug that prevents the new character voices from playing on events once you have your custom playlist. if we can figure out how to fix that, it can be used for t4 with no problem.

Thanks so much for pointing out where the problem was! The right folder and everything works again Smile Now I can just copy my well-chosen selection of Cuban music to Tropico 4!
Make sure you get the new compiler out and get the props!

I didn't know for sure how to edit .bat files
So here is how I did it:

1. Make a selection of music you think is perfect for the game.
2. Turn them into .ogg files instead of mp3.
3. Put them into a folder named Music in your Tropico 3 main folder.
4. From this folder run the beforementioned luac.bat (with luac.exe) compiler that you can still download for tropico 3.
5. Move this Music folder to the root folder of Tropico 4
6. Get the playlists.lua file from your tropico 3/Data/Sounds/Playlists folder
7. Put this file in the folder Tropico 4/Game/Sound/Playlists
8. Have absolute power over the music!

I also opened and added the Tropico 4 Music.hpk pack afterwards to make sure some sound effects are intact. I used HPK archiver by a guy named FordGT90Concept.
(This post was last modified: 31-08-2011 09:42 AM by Luukkie.)
31-08-2011 09:24 AM
Find all posts by this user Quote this message in a reply
whybuybeta Offline
Member
***

Posts: 131
Joined: Feb 2008
Post: #15
RE: Tutorial: Tropico 3 Music in Tropico 4
^^yep that playlist location is really the only thing different in t4 that I know of, if you use the batch I pasted above those locations have already been edited for you.

did you run into any problems with character voices after changing the playlist? the environment sounds didn't need to be copied for them to work afaik, but after I did this all the task dialogues don't work anymore. this is the only thing keeping me from using it so far, and I didn't want to post that with some bug that would prevent other sounds from working.
31-08-2011 03:59 PM
Find all posts by this user Quote this message in a reply
Luukkie Offline
Newbie
*

Posts: 2
Joined: Aug 2011
Post: #16
RE: Tutorial: Tropico 3 Music in Tropico 4
Indeed the cartoony characters used to say the first sentence of a message out loud. That doesn't happen anymore, but in my case it was a very welcome solution; I was constantly distracted by them when I wanted to read quickly what was going on.
I hope you find a solution for it anyways! Cheers
31-08-2011 07:11 PM
Find all posts by this user Quote this message in a reply
Wisq Offline
Junior Member
**

Posts: 13
Joined: Sep 2011
Post: #17
RE: Tutorial: Tropico 3 Music in Tropico 4
Used this to include all Tropico 1/3/4 tracks in the rotation. 66 tracks in all, waaaay better than the 13 that come with the game.

I agree, the loss of voices is actually a net positive. No offence to the voice actors, they did an okay job, but some things are just better left unvoiced. I can read way faster than I can listen.

It also nuked the main menu music. But the music is back once you get to the campaign selection screen. Also, Presidente's speeches still play fine, although they don't lower the music volume. (Not sure if they ever did.)
(This post was last modified: 03-09-2011 08:48 AM by Wisq.)
03-09-2011 08:48 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #18
RE: Tutorial: Tropico 3 Music in Tropico 4
Each map also has its own playlist inside its HPK. Though from what I've seen they're just listed as playing from the main one.

Something to bear in mind if you wanted to mess with the maps (i.e. make your own for sandbox mode).

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
12-09-2011 05:52 AM
Find all posts by this user Quote this message in a reply
degrees57 Offline
Junior Member
**

Posts: 12
Joined: Nov 2009
Post: #19
RE: Tutorial: Tropico 3 Music in Tropico 4
Does this work for the Steam edition of Tropico 4? I am having trouble finding the playlist file.
08-10-2011 07:28 PM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #20
RE: Tutorial: Tropico 3 Music in Tropico 4
(08-10-2011 07:28 PM)degrees57 Wrote:  Does this work for the Steam edition of Tropico 4? I am having trouble finding the playlist file.

As said above, it's in Game/Sound/Playlists. However, to get access to that, you need to extract the HPK to get that file.

If you don't want to extract the HPK, just create a folder somewhere (C:\Testing\) and inside that create "Game" then inside that "Sound", then instead that "Playlists" (so you now have C:\Testing\Game\Sound\Playlists) then save this into the directory:

Code:
-- Tropico 4
Playlists = {
    DefaultSilenceChance = 25,
    DefaultSilenceDuration = 15000,
    DefaultCrossfadeTime = 3000,
    DefaultFadeTime = 1500,
    BattleMusicTimeout = 60000,
    AllTracks = {
        {
            path = "Music/Track1.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track2.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track3.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track4.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track5.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track6.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track7.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track8.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track9.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track10.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track11.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track12.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
        {
            path = "Music/Track13.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },
    }
    MainMenu = {
        {
            path = "Music/Track8.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 0
        }
    },
    Empty = {}
}
Playlists.Default = Playlists.AllTracks

That's the Tropico 4 Playlist file (reversed, not as you'd see it). Then use the HPK Extractor to archive C:\testing (as you need to keep "Game" and everything below it). Put that HPK in your Tropico 4\Packs\boot\persist folder, and make sure the name is alphabetically after "Game" (so "Playlist.hpk" should be fine).

Edit the file as much as you want.

Oh, and it's probably worth noting that if it's anything like what I've been playing with in the recent past:

Code:
        {
            path = "E:/MyOggMusicFileFolder/ItsALivingThing.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },

should work.

I really don't know:
a) why they bothered compiling it in the first place;
b) why they obscured the format in that batch.

I'll just put T3's code here for safe keeping (minus code for the demo, because there's no point having that):

Code:
-- Tropico 3
namespace("Playlists")
DefaultSilenceChance = 25
DefaultSilenceDuration = 15000
DefaultCrossfadeTime = 3000
BattleMusicTimeout = 60000

AllTracks = {
    {path = "Music/Track1.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track2.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track3.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track4.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track5.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track6.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track7.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track8.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track9.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track10.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track11.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track12.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track13.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track14.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25},
    {path = "Music/Track15.ogg", frequency = 100, SilenceDuration = 15000, SilenceChance = 25}
}

Empty = {}



In both cases, I recommend the external HPK as an update won't brick your playlist.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 08-10-2011 09:30 PM by Swixel.)
08-10-2011 09:29 PM
Find all posts by this user Quote this message in a reply
degrees57 Offline
Junior Member
**

Posts: 12
Joined: Nov 2009
Post: #21
RE: Tutorial: Tropico 3 Music in Tropico 4
(08-10-2011 09:29 PM)Swixel Wrote:  
(08-10-2011 07:28 PM)degrees57 Wrote:  Does this work for the Steam edition of Tropico 4? I am having trouble finding the playlist file.

As said above, it's in Game/Sound/Playlists. However, to get access to that, you need to extract the HPK to get that file.

If you don't want to extract the HPK, just create a folder somewhere (C:\Testing\) and inside that create "Game" then inside that "Sound", then instead that "Playlists" (so you now have C:\Testing\Game\Sound\Playlists) then save this into the directory:

(snip)

That's the Tropico 4 Playlist file (reversed, not as you'd see it). Then use the HPK Extractor to archive C:\testing (as you need to keep "Game" and everything below it). Put that HPK in your Tropico 4\Packs\boot\persist folder, and make sure the name is alphabetically after "Game" (so "Playlist.hpk" should be fine).

Edit the file as much as you want.

Thank you Swixel. I had extracted the Music.HPK, and expected to see the folder structure and playlists file in there somewhere. Didn't realize I was going to have to manually make a Game/Sound/Playlists and turn it into an additional HPK.

Thanks for the knowledge transfer. Smile
09-10-2011 12:24 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #22
RE: Tutorial: Tropico 3 Music in Tropico 4
Oh, you can extract it and then rebuild it as they said. It's in there like they said, but the way I'm suggesting means that you won't have to worry about the game updating anything other than the music.

If you want custom ogg data you could even make a new folder (e.g. "MyMusic" as the root) so that your folder would contain something like:

Code:
MyMusic/ItsALivingThing.ogg
Game/Sound/Playlists

And then setup the instance/additional stuffl ike this:
Code:
{
            path = "MyMusic/ItsALivingThing.ogg",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        },

I mean, I'm not sure they'd bother updating the music archive, but you can always just add more that way, and it's safer this way.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
09-10-2011 12:36 AM
Find all posts by this user Quote this message in a reply
whybuybeta Offline
Member
***

Posts: 131
Joined: Feb 2008
Post: #23
RE: Tutorial: Tropico 3 Music in Tropico 4
(09-10-2011 12:36 AM)Swixel Wrote:  I mean, I'm not sure they'd bother updating the music archive, but you can always just add more that way, and it's safer this way.

I'm not following your reasoning behind repacking another hpk, since our old method just compiled the custom playlist to an internal directory that doesn't actually exist in the original package. this exploits the fact that the engine gives precedence to extracted files over the packed ones, so updates should not be messing with files that are not replacing any part of the game.

if I'm understanding this right the missing audio we are getting probably has to do with the new lua format here, but now my problem is that slserpent's compiler keeps throwing an exception due to the nested brackets. know of any way around this?

I just want to avoid repacking hpks if possible, since this adds a manual step to the compilation. not sure if you're skipping the step of compiling this lua here, or does the script actually run without first compiling? if so this might be the only way to get it working properly, unless the compiler gets updated.
(This post was last modified: 19-10-2011 09:11 AM by whybuybeta.)
19-10-2011 09:09 AM
Find all posts by this user Quote this message in a reply
Timo Offline
Kalypso Media
**********
Administrators

Posts: 4,524
Joined: Apr 2009
Post: #24
RE: Tutorial: Tropico 3 Music in Tropico 4
Code:
MyMusic/ItsALivingThing.ogg

Good choice, thumbs up!

El Presidente on Twitter | Official Tropico 4 Steam Community Group | Tropico 4 on Facebook
19-10-2011 09:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #25
RE: Tutorial: Tropico 3 Music in Tropico 4
(19-10-2011 09:09 AM)whybuybeta Wrote:  I'm not following your reasoning behind repacking another hpk, since our old method just compiled the custom playlist to an internal directory that doesn't actually exist in the original package. this exploits the fact that the engine gives precedence to extracted files over the packed ones, so updates should not be messing with files that are not replacing any part of the game.

The engine reads things outside of HPKs? That's ... seriously weird. It really shouldn't be doing that, but I didn't look too deeply into where it does and doesn't do it, as what I needed to overload for modding is fairly locked down Wink My experience is that it ignores what's outside of the HPKs unless a certain flag is tripped (unless you've done some seriously interesting things, it shouldn't be loading). That said, it may make exceptions, as I only looked into HPK loading (as it makes the most sense).

You don't need to compile -- you didn't in Tropico 3 either. In fact, reading byte-compiled Lua is new, and removing the ability to read uncompiled Lua would break random maps, which generates raw lua and then reads it (no, you can't do anything cool with it) Wink

(19-10-2011 09:09 AM)whybuybeta Wrote:  I'm not following your reasoning behind repacking another hpk, since our old method just compiled the custom playlist to an internal directory that doesn't actually exist in the original package.

if I'm understanding this right the missing audio we are getting probably has to do with the new lua format here, but now my problem is that slserpent's compiler keeps throwing an exception due to the nested brackets. know of any way around this?

The compiler shouldn't need updating. The music/playlist file uses a slightly different format to what Tropico 3 did, but it should work due to namespacing being roughly equivalent to the tabled approach used. I'm not sure what he did to modify his version, but looking back at what he did, and comparing his output to mine, there are some very minor differences (mostly that I didn't compile in debugging/decompiling support Wink).

As for packing into an internal directory I'm a little confused. T4 has 13 tracks, T3 had 15. The difference in count is probably the reason you've got missing music, unless you replaced the playlist. Though that only applies going backwards, to clarify that point.

Anyway, I've put together a Win32 version of the customised compiler (and CLI and DLL in that lzma) I hacked up, which you're welcome to use, but you don't need to compile it (except for a trivial speed bonus, which is moot on a single-load file). It works on T3 and T4 for me.

If you want more tracks, you modify the Tropico 4 playlist file I pasted below, you put it into an HPK, drop it into the directory, and dance. You can put more music into HPKs, or you can link to files on the disk. I add my own HPK, rather than using the internal files, because if/when an update occurs overloading the internal one (or, if it's working externally, that hole gest plugged), I control the music even if the original music file (or whatever's housing the playlist -- game.hpk I believe) gets overwritten.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 19-10-2011 01:29 PM by Swixel.)
19-10-2011 10:01 AM
Find all posts by this user Quote this message in a reply
whybuybeta Offline
Member
***

Posts: 131
Joined: Feb 2008
Post: #26
RE: Tutorial: Tropico 3 Music in Tropico 4
(19-10-2011 10:01 AM)Swixel Wrote:  As for packing into an internal directory I'm a little confused. T4 has 13 tracks, T3 had 15. The difference in count is probably the reason you've got missing music, unless you replaced the playlist. Though that only applies going backwards, to clarify that point.

check out the script I posted above, that was the previous method I was using to automate the playlist compilation. all it did was parse your custom music dir, then write the paths to an lua based on what oggs were in there, before compiling through luac. there was no manual editing or hpk repacking involved, just writing the custom lua to a matching path from the original playlist hpk. this was very convenient since the game would just run that list instead of the original, there was no danger of conflicting with updates when we did not need to touch the game files.

number of tracks did not matter before since the lua assigned them all to an ordered list (eg. alltracks[n] = {some_file_path}) that would get played randomly, this is not matching the t3 lua format you have posted above, I got mine from what was reversed in this discussion here. with t4 I just used the old t3 format, which caused the voice tracks not to trigger, but all music worked fine.

as for running this lua uncompiled, can you go through the steps that got this to work for you? I tried using the hpk path (.\game\sound\playlists\playlists.lua) and also repacking the plain text to an hpk in the .\packs\boot\persist location you mentioned above, neither of those are working here. it would be great if we could eliminate the compiling step as well, with the method above you could just rerun the script whenever you felt like adding music.

but whatever changes have been made to formatting, the engine still behaves the same in t4 as it did in t3. if you have any external lua in relative paths matching their hpks, it will run those instead of the original package, this is only working in compiled form for me though. I don't know enough to reverse the original files, but if we can get this formatted to play nice with the new map based scripting, we could get our easy one click tool back without affecting other in game sounds.
20-10-2011 05:04 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #27
RE: Tutorial: Tropico 3 Music in Tropico 4
Well I can't tell you why it's not working ... I reversed the T3 format myself and that works for me if I put it in place. The same goes for T4.

I always HPK repack as it parses fine, is portable, etc.. Leaving it out of the directory for Tropico 3 may work, but with T4 I didn't have any luck modifying buildings early on with extracted files, but I needed access to something which probably breaks if I override it outside of the virtual file system (VFS, for future reference, as I'm too lazy to retype most of the time).

The format is the same though, but it's put together with a different syntax:

Table construction:
AllTracks[n] = {} is the same as appending it to the table with
table.insert(AllTracks, {})
which is the same as
AllTracks = { {} } -- index = 1, it's the first, lua starts at 1, go figure

Tables/Namespaces:
Using the namespace is the same as going:
Playlists = {}
... your AllTracks building code ...
Playlists.AllTracks = AllTracks


Map Playlists
RedCanyon's playlist is just this:
Code:
return "AllTracks"

So whatever's calling it is just pulling the string-index ("AllTracks"), yielding Playlists.AllTracks.

I'm really not sure what's missing, as mine's working fine.

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
20-10-2011 05:18 AM
Find all posts by this user Quote this message in a reply
ezwip Offline
Member
***

Posts: 146
Joined: Nov 2010
Post: #28
RE: Tutorial: Tropico 3 Music in Tropico 4
I use the the lua compiler method. It works great but doesn't fade out when announcements come on. It did do this in T3. Perhaps I need to edit something to achieve that effect. Anyone know how to fix this?
(This post was last modified: 20-10-2011 05:25 AM by ezwip.)
20-10-2011 05:19 AM
Find all posts by this user Quote this message in a reply
Swixel Offline
Epic Member
*******

Posts: 1,087
Joined: Sep 2011
Post: #29
RE: Tutorial: Tropico 3 Music in Tropico 4
I'll be damned, it works fine externally for that. My guess is I'm doing something beyond evil elsewhere (okay, it's not a guess, I am doing evil things elsewhere) and the load sequence is screwed up as a result. Time to nest me some magic.

Here's my test code for overloading in the way you were (read: not in any packs):
Code:
-- Tropico 4 test 'list'
Playlists = {
    DefaultSilenceChance = 25,
    DefaultSilenceDuration = 15000,
    DefaultCrossfadeTime = 3000,
    DefaultFadeTime = 1500,
    BattleMusicTimeout = 60000,
    AllTracks = {
        {
            path = "E:/iTunes/The Orion Experience/NYC Girl/01-the_orion_experience-nyc_girl.wav",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 25
        }
    },
    MainMenu = {
        {
            path = "E:/iTunes/The Orion Experience/NYC Girl/01-the_orion_experience-nyc_girl.wav",
            frequency = 100,
            SilenceDuration = 15000,
            SilenceChance = 0
        }
    },
    Empty = {}
}
Playlists.Default = Playlists.AllTracks

I suppose the other reason I'm packing is that I HPK it, then tarball the collection, version control it to the laptop, then run post-hg scripts to extract and run, and that's be more painful with more files Wink

@ezwip:

Find

Code:
echo DefaultSilenceChance = 25 >> %_txt%
echo DefaultSilenceDuration = 15000 >> %_txt%
echo DefaultCrossfadeTime = 3000 >> %_txt%
echo BattleMusicTimeout = 60000 >> %_txt%

add

Code:
echo DefaultFadeTime = 1500 >> %_txt%

Lack of fade time is most likely the issue.

edit: oops :3

"I am not ashamed to confess I am ignorant of what I do not know" ― Cicero.

"You had to hand it to the Patrician, he admitted grudgingly. If you didn't, he sent men to come and take it away." ― Terry Pratchett (Guards! Guards!)
(This post was last modified: 20-10-2011 05:30 AM by Swixel.)
20-10-2011 05:27 AM
Find all posts by this user Quote this message in a reply
Tropi'je Offline
Epic Member
*******

Posts: 1,807
Joined: Nov 2009
Post: #30
RE: Tutorial: Tropico 3 Music in Tropico 4
Is it possible to take all the music, the stuff from t1, t1 paradise island, t3, and t4, and then have it all run as random playlists?


I own all including the pirates cove, though i never played that one..

Basically i have tropico reloaded, and the stand-a-lone T1 disk, t3+AP expansion, and obviously t4..

It would be nice to just take all the music and let it run at random, but im not really into coding LUA, or any of that other stuff.. I sorta just skimmed all the stuff you guys were writing about it. Maybe if you can do it and its not that complicated i might give it a shot. too bad there are rights issues, keeping someone from just making a nice little DL pack that you could just install and do it for all those that arnt that skilled with mods.. Wink
20-10-2011 05:31 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | kalypso media :: website | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication