-
Couldn't load subscription status.
- Fork 19
Custom Sirens
Custom siren support was officially added in Version 71. All other methods done prior will not have desired results.
Photon previously relied on a large public table with numeric keys to store and access all sirens. Adding a custom siren previously involved copying the table and recreating within an addon, then adding the desired keys within. However, the copied table would frequently overwrite the Photon table when Photon updated, causing some users to lack updated sirens.
First of all, you should have your siren files ready. There are important requirements that you need to consider.
- Your sound files have to be supported by the game. To check if your files are supported, check the list of supported sound formats. (If the website is down try using the WaybackMachine).
- Your sound files should contain loop points. There are free tools in the internet like Wavosaur which will let you create them. If you have considered all this, then you can proceed with the next step.
Next, navigate to your addons folder and create a new folder for your addon. Inside this folder you create a folder named sound. The rest of the structure inside this folder is up to you, but you may want to follow a specific naming rule. Most sirens are saved in addons/my_custom_siren/sound/emv/sirens/. Inside this folder, create a folder named like your siren. Now put your sound files inside this folder.
'''Note:''' Your path should be unique. If somebody else is using the exact same path your or the other addon will be overwritten. To prevent this, put a unique identifier in the folder name. For example: addons/my_custom_siren/sound/emv/sirens/author_sirenname.
If you have your files ready, you can proceed with the lua files.
Go back inside the folder of your addon (addons/my_custom_siren/). Now create new folders so you get this path: addons/my_custom_siren/lua/autorun/photon/library/sirens/. Inside the sirens folder, create a new lua file. The name of this file must not contain any spaces or any special characters (_ and some other characters are allowed). Keep in mind that, like with the sound files, your name should be unique to prevent possible conflicts with other addons. An example for a good file naming is: addons/my_custom_siren/lua/autorun/photon/library/sirens/author_sirenname.lua.
Open the file with a text editor of your choice. You first want to check if photon is loaded or not. You can do that by putting if not EMVU then return end at the top of your file.
To register your custom siren you have to call the function EMVU.AddCustomSiren(string identifier, table data). A example for the finished function would look like:
EMVU.AddCustomSiren("my_custom_siren", {
Name = "My Custom Siren", -- Name visible in the context menu and in the HUD
Category = "My Name", -- Category in the context menu
Set = {
{
Name = "WAIL", -- Name visible in the HUD
Sound = "emv/sirens/author_sirenname/wail.wav", -- Path to sound file (relative to the sound folder)
Icon = "wail" -- Icon visible in the HUD
},
{
Name = "YELP",
Sound = "emv/sirens/author_sirenname/yelp.wav",
Icon = "yelp"
},
{
Name = "PHSR",
Sound = "emv/sirens/author_sirenname/phaser.wav",
Icon = "phaser"
}
},
Horn = "emv/sirens/author_sirenname/horn.wav", -- (Optional) Path to the horn sound file
Volume = 75 -- (Optional) Volume of the siren
})Save the file and start your game. If everything worked and you didn't get any lua errors you should be able to see your siren in the context menu. To spawn a car with your custom siren you have to edit EMV.Siren = "my_custom_siren" in your car file.