OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman 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
-
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.
#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.
-
thank you for making it,
I have used this sript in my test
_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
-
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
-
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?
-
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
-
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
-
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
-
!!!!
It works!!
thank you so much TriggerHappy
It was that they werent all in mono. ;D