Operation Flashpoint Dragon Rising OFDR Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

OWP: Custom Sound App

+2
HomerPepsi
TheGeneral
6 posters

Page 1 of 2 1, 2  Next

Go down

OWP: Custom Sound App Empty OWP: Custom Sound App

Post by TheGeneral Mon 08 Apr 2013, 19:10

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:

Code:
EDX:playOwpSound("yoursound.wav")


Last edited by Mdog on Fri 02 Aug 2013, 17:31; edited 2 times in total
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Mon 08 Apr 2013, 19:12

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?
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by TheGeneral Mon 08 Apr 2013, 19:19

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
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Mon 08 Apr 2013, 20:13

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?
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by Guest Mon 08 Apr 2013, 20:23

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 Very Happy
Anonymous
Guest
Guest


Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by TheGeneral Mon 08 Apr 2013, 20:26

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.
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by nepgeargo Wed 10 Apr 2013, 09:36

;D ive been waiting for this
nepgeargo
nepgeargo

Points : 62
Reputation : 0
Join date : 2013-03-20

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tjdagger Wed 10 Apr 2013, 15:15

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

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Wed 10 Apr 2013, 19:43

time in milliseconds correct?
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Wed 10 Apr 2013, 22:29

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?
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by TheGeneral Wed 10 Apr 2013, 23:06

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.

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
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Wed 10 Apr 2013, 23:20

And placing the EDX:simpleTimer("playmusic", 100) with the OnMissionStart or onEDXintialized functions?
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by TheGeneral Wed 10 Apr 2013, 23:29

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.
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by HomerPepsi Wed 10 Apr 2013, 23:31

The loop works well! Thanks Mdog! Now just to get the ambient combat bit working..
HomerPepsi
HomerPepsi
Veteran

Location : Adanac
Points : 87
Reputation : 2
Join date : 2012-12-18

http://filebeam.com/folder/10717

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by TheGeneral Thu 11 Apr 2013, 00:20

no probs. The other stuff you'll have to wait til Tj comes back to you.
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tjdagger Thu 11 Apr 2013, 05:35

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
Ok, I'll have to test it... hopefully get some time tonight.
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

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by MGRiz Tue 05 Mar 2019, 05:06

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!

MGRiz

Points : 10
Reputation : 1
Join date : 2019-03-05

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tvig0r0us Wed 06 Mar 2019, 00:27

MGRiz 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!
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 alive Smile

Cheers!
--tvig
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by MGRiz Thu 07 Mar 2019, 12:01

Hi tvig
Thank you, really appriciate it!

MGRiz

Points : 10
Reputation : 1
Join date : 2019-03-05

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tvig0r0us Sat 09 Mar 2019, 22:41

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
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by MGRiz Thu 14 Mar 2019, 07:13

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

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tvig0r0us Thu 14 Mar 2019, 23:22

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
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by MGRiz Fri 15 Mar 2019, 03:13

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

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by tvig0r0us Fri 15 Mar 2019, 05:31

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
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by MGRiz Fri 15 Mar 2019, 13:00

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

Back to top Go down

OWP: Custom Sound App Empty Re: OWP: Custom Sound App

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum