OWP: Custom Sound App
+2
HomerPepsi
TheGeneral
6 posters
Page 1 of 2
Page 1 of 2 • 1, 2
OWP: Custom Sound App
DOWNLOAD NOW!
This app will allow you to play custom sounds in DR. As long as the mission is coded to use those sounds.
download and place the unzipped folder in your DR directory. Always run it as Admin also.
There are full instructions in the read me file once you have unzipped it.
I have placed in a couple of my own custom sounds for you to play with and have a listen. If you want to use them in your missions you need to code these sounds into your mission using the EDX prefix. The command is:
This app will allow you to play custom sounds in DR. As long as the mission is coded to use those sounds.
download and place the unzipped folder in your DR directory. Always run it as Admin also.
There are full instructions in the read me file once you have unzipped it.
I have placed in a couple of my own custom sounds for you to play with and have a listen. If you want to use them in your missions you need to code these sounds into your mission using the EDX prefix. The command is:
- Code:
EDX:playOwpSound("yoursound.wav")
Last edited by Mdog on Fri 02 Aug 2013, 17:31; edited 2 times in total
Re: OWP: Custom Sound App
Mdog wrote:(file is being uploaded, hang tight for now!)
This app will allow you to play custom sounds in DR. As long as the mission is coded to use those sounds.
download and place the unzipped folder in your DR directory. Always run it as Admin also.
There are full instructions in the read me file once you have unzipped it.
I have placed in a couple of my own custom sounds for you to play with and have a listen. If you want to use them in your missions you need to code these sounds into your mission using the EDX prefix. The command is:
- Code:
EDX:playOwpSound("yoursound.wav")
Do you have to have the .wav's stored in the OFDR root directory? Or can we make a folder in data_win called sounds or something like that and have it read from there?
Re: OWP: Custom Sound App
no....There is a "sounds" folder already inside the OWP root. all you do is drag and drop your .wav sounds into there and code them to play through the editor.
Man this is taking a while to upload, if it goes for much longer I may have to take out the sounds I have in there.
when I get chance I'll throw up a tutorial.
This app will only give you one channel of sound so, playing other sounds over your existing one will cancel it out. You need to use an external program like audacity or reaver to mix it up a bit. I use audacity, it's free and easy to use aswell.
Audacity
Man this is taking a while to upload, if it goes for much longer I may have to take out the sounds I have in there.
when I get chance I'll throw up a tutorial.
This app will only give you one channel of sound so, playing other sounds over your existing one will cancel it out. You need to use an external program like audacity or reaver to mix it up a bit. I use audacity, it's free and easy to use aswell.
Audacity
Re: OWP: Custom Sound App
I use audacity as well. I was thinking about combat music and ambient music... Is there a way to tell if the player units are engaged or not?
Re: OWP: Custom Sound App
HomerPepsi wrote:I use audacity as well. I was thinking about combat music and ambient music... Is there a way to tell if the player units are engaged or not?
debug:getCurrentTarget I think is the command. Returns an empty string ("") if none.
Best way I know of. You could also use OFP:getNeatestEnemy where you pass true to the detected parameter. Also returns an empty string if none are detected.
Cheers
Guest- Guest
Re: OWP: Custom Sound App
HomerPepsi wrote:I use audacity as well. I was thinking about combat music and ambient music... Is there a way to tell if the player units are engaged or not?
you could use something like this:
- Code:
function onFiring(firingSoldierName, weaponComponentName, magazineComponentName, fireMode)
if weaponComponentName == "sa32qbz95m" then
EDX:playOwpSound("plafire.wav")end
if weaponComponentName == "sa38qbb95" and fireMode == "AUTOMODE" then
EDX:playOwpSound("plafire.wav")end
if weaponComponentName == "sa33qbz95a" then
EDX:playOwpSound("plafire.wav")
end
end
This is the code I used for the bullet crack effect I was trying to acheive, what you would do is replace weapon name with what your unit is carrying and the EDX:playOwpSound("plafire.wav") with EDX:playOwpSound("combatmusic.wav") or what ever you name it when you save it as a .wav file.
thats abasic way to do it.
Tvigs is for cases like a misfire and no enemies around so that you don't get the music playing when you don't need it.
first post updated but there are no sounds available I'll set up a serparate thread which may be ideal for others if like yourself make other custom sounds and they can all be downloaded from one spot.
Re: OWP: Custom Sound App
;D ive been waiting for this
nepgeargo- Points : 62
Reputation : 0
Join date : 2013-03-20
Re: OWP: Custom Sound App
HomerPepsi wrote:I was thinking about combat music and ambient music... Is there a way to tell if the player units are engaged or not?
Theory/Logic
1. use underfire function to kick start combat music. Disable event to prevent multiple firings.
2. check nearest enemy and distance from player at end of music to either replay combat music or play end combat sound. then switch to ambient music.
3. check nearest enemy and distance from player also at on death if current music is combat music.
a. If no enemy within range, play end combat sound. Then switch to ambient music.
b. If enemy within range, music continues uninterrupted.
4. Re-enable and control underfire events based upon audio file times
EDITED with corrections
Code...
Simply fill in the commented lines with your specific details.
- Code:
--underfire music script
function onEDXInitialized()
-- OFP:setInvulnerable("tjdagger",true)
combat_music = "combat_music.wav" --name of combat music file
combat_music_time = 94000 --needs to match the length of file
ambiant_music = "ambiant1.wav" --name of ambiant music file
ambiant_music_time = 204000 --needs to match the length of file
end_combat_music = "end_combat_music.wav" --name of end of combat sound file
end_combat_music_time = 13000 --needs to match the length of file
player_named = "tjdagger" -- name of player
music_dis_cut_off = 500 --distance from nearest enemy, to change from combat back to ambiant music.
current_music = ambiant_music -- music at start
music_time = ambiant_music_time
EDX:simpleTimer("musicChangeOver",3000)
end
function onUnderfire(underfireID, shooterID, method)
if OFP:isPrimaryPlayer(underfireID) or OFP:isSecondaryPlayer(underfireID) then
if OFP:getSide(shooterID) ~= OFP:getSide(player_named) then
OFP:disableEvent("onUnderfire")
current_music = combat_music
music_time = combat_music_time
EDX:serialTimer("musicChangeOver",500)
end
end
end
function checkMusic(who,tid)
EDX:deleteTimer(tid)
local side = OFP:getSide(who)
local nearE = OFP:getNearestEnemy(who,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(who,nearE)
if dis < music_dis_cut_off and dis ~= -1 then
current_music = combat_music
music_time = combat_music_time
elseif dis > music_dis_cut_off or dis == -1 then
OFP:enableEvent("onUnderfire")
if current_music == combat_music then
current_music = end_combat_music
music_time = end_combat_music_time
elseif current_music == end_combat_music then
current_music = ambiant_music
music_time = ambiant_music_time
elseif current_music == ambiant_music_time then
current_music = ambiant_music
music_time = ambiant_music_time
end
end
end
EDX:simpleTimer("musicChangeOver",500)
end
function musicChangeOver(tid)
EDX:deleteTimer(tid)
EDX:playOwpSound(current_music)
EDX:simpleTimer("checkMusic",music_time,player_named)
end
function onDeath(victim, killer)
if OFP:getSide(victim) ~= OFP:getSide(player_named) then
if current_music == combat_music then
local side = OFP:getSide(killer)
local nearE = OFP:getNearestEnemy(player_named,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(player_named,nearE)
if dis > music_dis_cut_off or dis == -1 then
EDX:simpleTimer("checkMusic",1000,player_named)
OFP:enableEvent("onUnderfire")
end
end
end
end
end
Haven't test it, but there it is. Let me know if it works.
Last edited by tjdagger on Fri 12 Apr 2013, 01:06; edited 1 time in total
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Re: OWP: Custom Sound App
tjdagger wrote:HomerPepsi wrote:I was thinking about combat music and ambient music... Is there a way to tell if the player units are engaged or not?
Theory/Logic
1. use underfire function to kick start combat music. Disable event to prevent multiple firings.
2. check nearest enemy and distance from player at end of music to either replay combat music or play end combat sound. then switch to ambient music.
3. check nearest enemy and distance from player also at on death if current music is combat music.
a. If no enemy within range, play end combat sound. Then switch to ambient music.
b. If enemy within range, music continues uninterrupted.
4. Re-enable and control underfire events based upon audio file times
Code...
Simply fill in the commented lines with your specific details.
- Code:
--underfire music script
function onEDXInitialized()
combat_music = "combat_music.wav" --name of combat music file
combat_music_time = 10000 --needs to match the length of file
ambiant_music = "ambiant_music.wav" --name of ambiant music file
ambiant_music_time = 10000 --needs to match the length of file
end_combat_music = "combat_end.wav" --name of end of combat sound file
end_combat_music_time = 1000 --needs to match the length of file
player_named = "tjdagger" -- name of player
music_dis_cut_off = 400 --distance from nearest enemy, to change from combat back to ambiant music.
current_music = ambiant_music -- music at start
EDX:serialTimer(musicChangeOver,500)
end
function onUnderfire(underfireID, shooterID, method)
if OFP:isPrimaryPlayer(underfireID) or OFP:isSecondaryPlayer(underfireID) then
if OFP:getSide(shooterID) ~= OFP:getSide(player_named) then
OFP:disableEvent("onUnderfire")
current_music = combat_music
music_time = combat_music_time
EDX:serialTimer(musicChangeOver,500)
end
end
end
function checkMusic(who,tid)
EDX:deleteTimer(tid)
local side = OFP:getSide(who)
local nearE = OFP:getNearestEnemy(who,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(who,nearE)
if dis < music_dis_cut_off then
current_music = combat_music
music_time = combat_music_time
elseif dis > music_dis_cut_off then
OFP:enableEvent("onUnderfire")
if current_music == combat_music then
current_music = end_combat_music
music_time = end_combat_music_time
elseif current_music == end_combat_music then
current_music = ambiant_music
music_time = ambiant_music_time
elseif current_music == ambiant_music_time then
current_music = ambiant_music
music_time = ambiant_music_time
end
end
end
EDX:serialTimer(musicChangeOver,500)
end
function musicChangeOver(tid)
EDX:deleteTimer(tid)
EDX:playOwpSound(current_music)
EDX:serialTimer(checkMusic,music_time,player_named)
end
function onDeath(victim, killer)
if OFP:getSide(victim) ~= OFP:getSide(player_named) then
if current_music == combat_music then
local side = OFP:getSide(killer)
local nearE = OFP:getNearestEnemy(player_named,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(who,nearE)
if dis < music_dis_cut_off then
EDX:serialTimer(checkMusic,500,player_named)
end
end
end
end
end
Haven't test it, but there it is. Let me know if it works.
Getting a crash and no music is being played. Debugger says this:
04/10/13 15:25:57: DEBUG [waypoints]: function onUnderfire on script mission
I added EDX:registerPlayer as well to the onEDXInitialized. Still no sounds.
Also anyway to loop sounds?
Re: OWP: Custom Sound App
What I would do for looping the sound is use an event handler with a timer to play the sound. making sure I knew the length of the sound to re-apply the timer again.
Not tried this out but it might have a miniscule gap between timers.
- Code:
EDX:simpleTimer("playmusic", 100)
function playmusic()
EDX:playOwpSound("yourSound.wav")
--use the length of the sound to replay the timer again
EDX:setTimer("playmusic", 10000) -- length of sound
end
Not tried this out but it might have a miniscule gap between timers.
Last edited by Mdog on Thu 11 Apr 2013, 00:20; edited 1 time in total
Re: OWP: Custom Sound App
And placing the EDX:simpleTimer("playmusic", 100) with the OnMissionStart or onEDXintialized functions?
Re: OWP: Custom Sound App
you can do yeah, that can go in any function. all it is, is calling the event handler, you could use a triggerzone if you wanted.
Re: OWP: Custom Sound App
The loop works well! Thanks Mdog! Now just to get the ambient combat bit working..
Re: OWP: Custom Sound App
Ok, I'll have to test it... hopefully get some time tonight.Getting a crash and no music is being played. Debugger says this:
04/10/13 15:25:57: DEBUG [waypoints]: function onUnderfire on script mission
I'm sure it will be some small little error. I didn't have time to source 3 suitable sound files to test it with, but I was confident with the code concept.
Will get back to you on this.
EDIT-- was something simple... I was calling functions as timers without quoting them as strings eg.
EDX:serialTimer(musicChangeOver,500) instead of EDX:serialTimer("musicChangeOver",500)
A simple typo.
Also did some fine tuning, fully working... code below and has been updated in previous post also.
- Code:
--underfire music script
function onEDXInitialized()
-- OFP:setInvulnerable("tjdagger",true)
combat_music = "combat_music.wav" --name of combat music file
combat_music_time = 94000 --needs to match the length of file
ambiant_music = "ambiant1.wav" --name of ambiant music file
ambiant_music_time = 204000 --needs to match the length of file
end_combat_music = "end_combat_music.wav" --name of end of combat sound file
end_combat_music_time = 13000 --needs to match the length of file
player_named = "tjdagger" -- name of player
music_dis_cut_off = 500 --distance from nearest enemy, to change from combat back to ambiant music.
current_music = ambiant_music -- music at start
music_time = ambiant_music_time
EDX:simpleTimer("musicChangeOver",3000)
end
function onUnderfire(underfireID, shooterID, method)
if OFP:isPrimaryPlayer(underfireID) or OFP:isSecondaryPlayer(underfireID) then
if OFP:getSide(shooterID) ~= OFP:getSide(player_named) then
OFP:disableEvent("onUnderfire")
current_music = combat_music
music_time = combat_music_time
EDX:serialTimer("musicChangeOver",500)
end
end
end
function checkMusic(who,tid)
EDX:deleteTimer(tid)
local side = OFP:getSide(who)
local nearE = OFP:getNearestEnemy(who,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(who,nearE)
if dis < music_dis_cut_off and dis ~= -1 then
current_music = combat_music
music_time = combat_music_time
elseif dis > music_dis_cut_off or dis == -1 then
OFP:enableEvent("onUnderfire")
if current_music == combat_music then
current_music = end_combat_music
music_time = end_combat_music_time
elseif current_music == end_combat_music then
current_music = ambiant_music
music_time = ambiant_music_time
elseif current_music == ambiant_music_time then
current_music = ambiant_music
music_time = ambiant_music_time
end
end
end
EDX:simpleTimer("musicChangeOver",500)
end
function musicChangeOver(tid)
EDX:deleteTimer(tid)
EDX:playOwpSound(current_music)
EDX:simpleTimer("checkMusic",music_time,player_named)
end
function onDeath(victim, killer)
if OFP:getSide(victim) ~= OFP:getSide(player_named) then
if current_music == combat_music then
local side = OFP:getSide(killer)
local nearE = OFP:getNearestEnemy(player_named,side,true) --mabye false?
if nearE then
local dis = OFP:getDistance(player_named,nearE)
if dis > music_dis_cut_off or dis == -1 then
EDX:simpleTimer("checkMusic",1000,player_named)
OFP:enableEvent("onUnderfire")
end
end
end
end
end
My working file mssn and audio files used for testing can be downloaded below
http://filebeam.com/47e7c228f3e1e04639c4c46df997436a
Last edited by tjdagger on Mon 20 May 2013, 05:58; edited 1 time in total (Reason for editing : replace dead link)
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Re: OWP: Custom Sound App
Hi, I am new here and interested to make some custom mission of my own...
Seems like I am way too late, some of the links are already dead.
Would really appreciate if anyone still have the OWP custom sound app and willing to share it. Thanks!
Seems like I am way too late, some of the links are already dead.
Would really appreciate if anyone still have the OWP custom sound app and willing to share it. Thanks!
MGRiz- Points : 10
Reputation : 1
Join date : 2019-03-05
Re: OWP: Custom Sound App
Welcome! I still have it. I will need to package it and upload it somewhere. I'll post here when I have a chance to do that. In the meantime, enjoy the forum. It's old and slow, but still aliveMGRiz wrote:Hi, I am new here and interested to make some custom mission of my own...
Seems like I am way too late, some of the links are already dead.
Would really appreciate if anyone still have the OWP custom sound app and willing to share it. Thanks!
Cheers!
--tvig
Re: OWP: Custom Sound App
Hi tvig
Thank you, really appriciate it!
Thank you, really appriciate it!
MGRiz- Points : 10
Reputation : 1
Join date : 2019-03-05
Re: OWP: Custom Sound App
I'm pretty sure you will find what you are looking for at this link.
https://operationflashpoint.forummotion.com/t482-nfmz1-files-moved#3649
--tvig
https://operationflashpoint.forummotion.com/t482-nfmz1-files-moved#3649
--tvig
Re: OWP: Custom Sound App
Thank you for the link! But unfortunately, the EDX didnt work after I replaced the root.lua. Do you know what is the problem?
MGRiz- Points : 10
Reputation : 1
Join date : 2019-03-05
Re: OWP: Custom Sound App
When you say it didn't work, can you state what you were trying to do, what you did to do it, and what happened?
--tvig
--tvig
Re: OWP: Custom Sound App
I tried to use the EDX in mission editor but it didn't work. First I replaced the root.lua with the EDX one. Then in mission editor, I import the EDX marker collection v2 to start. I tried to use some of the EDX commands either in onEDXInitialized or onMissionstart functio in level.lua but it still didnt work after run. For example, I tried to use the fog or weather command from EDX but it didnt change anything.
MGRiz- Points : 10
Reputation : 1
Join date : 2019-03-05
Re: OWP: Custom Sound App
Read the instructions in the mission.lua and level.lua files. They specifically instruct you not to use the level.lua script. Let me know if you are able to work through it.
--tvig
--tvig
Re: OWP: Custom Sound App
Sorry, I made a mistake. I tried to execute the code in mission.lua and it didn't work. I desperately tried in level.lua too though.
MGRiz- Points : 10
Reputation : 1
Join date : 2019-03-05
Page 1 of 2 • 1, 2
Similar topics
» Dragon Rising Walkthrough
» custom LUA functions
» Using custom timers
» custom sounds and ambient lighting
» User made Custom Sounds
» custom LUA functions
» Using custom timers
» custom sounds and ambient lighting
» User made Custom Sounds
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|