Home   Help Search Login Register  

Author Topic: A random sound script  (Read 985 times)

0 Members and 1 Guest are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
A random sound script
« on: 30 Dec 2005, 00:01:55 »
Hello,

I need sombody to make a script for random sounds I have recorded.

The script should wait until a group has detected the player, and then every 5-15 seconds, make the leader of that group "say" one of the random sounds until either the group has 3 members or less left alive, or the players group is dead or has moved 200 meters or farther away from the yelling group.

the sounds are named 01-43.  it is for a mission and credit will of course be given in the readme

thank you for taking intrest
« Last Edit: 30 Dec 2005, 00:02:24 by penguinman »

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:A random sound script
« Reply #1 on: 30 Dec 2005, 05:53:27 »
Can be done pretty quickly. I'm assuming you've already made the correct description.ext file and got the sounds all working right.

ok here it is: Put all the names of your sounds into soundlist, I'm too lazy to go all the way from 0 to 43.

Code: [Select]
#reset
_soundlist = ["sound0","sound1","sound2","sound3","sound4"]
_max = count _soundlist
_i = random _max
_i = _i - (_i mod 1)
_msg = _soundlist select _i
~5 + (random 10)
?(player distance (leader name_of_group) > 200):goto"reset"
?((!alive player)||(count units name_of_group < 4)):exit
(leader name_of_group) say _msg
goto"reset"

A few lines may be buggy in the conditions but I think you get the idea.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:A random sound script
« Reply #2 on: 30 Dec 2005, 08:34:41 »
thank you for making it,

I have used this sript in my test

Code: [Select]
_group = _this select 0
#start
@(player distance (leader _group) < 300)

#reset
_soundlist = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43"]
_max = count _soundlist
_i = random _max
_i = _i - (_i mod 1)
_msg = _soundlist select _i
~5 + (random 10)
?(player distance (leader _group) > 300):goto"start"
?((!alive player)||(count units _group < 4)):exit
(leader _group) say [_msg,50]
hint format ["-%1", _msg]
goto"reset"

I added a hint displaying which message was played. and a variable so I can use it for multiple groups

now ive tested thuroughly and ive got very odd results.

of all 01-43

the only ones that it will play a sound for are

39,20,19,15,35

when the hint shows one of the other numbers, it is just silent.

and whats really odd is, all of the sounds work in a trigger.do you know what is causing this problem?

thanks
« Last Edit: 30 Dec 2005, 08:36:16 by penguinman »

Offline 456820

  • Contributing Member
  • **
Re:A random sound script
« Reply #3 on: 30 Dec 2005, 10:03:18 »
are all the sounds classed under the Sounds class in the description or the Enviromental, Radio or Music etc etc

Some of them dont work in scripts but work in triggers and vice versa IIRC Sounds work in all so try that class if you havent

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:A random sound script
« Reply #4 on: 30 Dec 2005, 17:59:24 »
all the ones the work in the script(39,20,19,15,35) also work in a trigger.

I think their all the same, I just copied and pasted then edited the class, name, and file path in the description.ext for each one. How would you change the sound class?
« Last Edit: 30 Dec 2005, 18:01:06 by penguinman »

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:A random sound script
« Reply #5 on: 01 Jan 2006, 19:19:06 »
Im going to try switching out the ones that dont for ones that do, other then that, I think the script works fine, its just the sounds are screwy

nice job RujiK

thank you

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:A random sound script
« Reply #6 on: 09 Jan 2006, 22:29:48 »
i think i may know the problem
there are certain specifications required when making sound files for ofp:
(the ones i know of)
1. file type (.ogg)
2. must be mono not stereo
3. must play at 44100Hz

i think there are a few more but i don't remember. there are a number of tutes out there that give the exact specifications (and all of them) and you could probably find one in the editors depot. if not i know there is one on ofp.info

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:A random sound script
« Reply #7 on: 10 Jan 2006, 00:42:40 »
My goodness you may be right, I dont think they are all mono, I will convert them now and see if that works thank you

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:A random sound script
« Reply #8 on: 10 Jan 2006, 00:56:38 »
!!!!

It works!!

thank you so much TriggerHappy

It was that they werent all in mono. ;D