Jump to content
Sign in to follow this  
Mantup

Help needed with phone ring/answer script & say3d looping.

Recommended Posts

Hello, I've really hit a brick wall on this. I would be extremely thankful to anyone who could help. I am an experienced mission maker, as far as working the in game editor I've been doing it since OFP. However, scripts to me may as well be written in a alien language... I am pretty good with using the init field "scripts" or commands but as far as creating a .sqf and all the workings with that I'm lost. I also already know about .ogg creation and placement in the mission folder ect. So I will proceed with my situation:

Situation One:

I have painstakingly furnished and modified a home with vanilla objects as well as ARP2 mod pack. In the series I've planned the player will be playing the role of a low level enforcer for the mob after the Altis war. In the ARP2 pack there are a couple house phone objects, can someone help me with making a script that would allow the phone to ring via say3ds and then the player be able to walk up to it and select a "Answer Phone" action from the scroll wheel which would que the audio dialogue?

Situation Two:

The first mission in the series is going to require a trip to a local party. I already have the .ogg sound file for the music, and the music must be emitting from the party location via say3d. This is about the best I can do without making a script, I have been able to produce the 3D sound with this but not a "turn on/off radio" toggle or able to have the song play in a loop.

I have made a trigger and have it set to Blu present and it's init I have: [box say3d "intro"] box being the object & intro the .ogg, this method works but has no toggle on/off and only plays the audio once.

in my Description.ext:

class CfgSounds

{

// List of sounds (.ogg files without the .ogg extension)

sounds[] = {intro,music};

// Definition for each sound

class intro

{

name = "intro"; // Name for mission editor

sound[] = {\sounds\intro.ogg, 0.2, 1.0};

titles[] = {0, ""};

};

class music

{

name = "music"; // Name for mission editor

sound[] = {\sounds\music.ogg, 0.4, 1.0};

titles[] = {0, ""};

};

};

I do not even have a init file, nor specific action script. I have tried using bits a pieces of other scripts from armaholic but they always end up with lots of errors ect. I would really be appreciative if anyone could help me out on this. I will check back here periodically and if anyone with these sort of skills could add me on Steam @ [Mantup] "no brackets" that would be great.

Thanks for taking the time to look over this and hopefully help.

Share this post


Link to post
Share on other sites

For your first situation:

After some triggered event (if using a trigger, put this in the onAct field):

nul = [nameOfPhone] execVM "phoneRing.sqf";

//phoneRing.sqf
_phone = (_this select 0);
glb_answerPhone = false;
publicVariable "glb_answerPhone";
_answerAction = _phone addAction ["Answer Phone", 
{ glb_answerPhone = true; publicVariable "glb_answerPhone"; }, 
[], 
6, 
true, 
true, 
"", 
"_this distance _target < 3"
];

while {!glb_answerPhone} do
{
   _phone say3D "sound";
   sleep x; //where x is the length of the sound file
};

_phone removeAction _answerAction;

You can use some of the same methods displayed above for your second issue as well.

Share this post


Link to post
Share on other sites

Thank you, will this loop the phone ringing until someone activates the answer?

Share this post


Link to post
Share on other sites
Thank you, will this loop the phone ringing until someone activates the answer?

Yeah it should, I'm not sure if there is a way to terminate a sound while it's playing though (in case the player answers in mid-ringing), other than maybe playing an empty sound, but I haven't messed with sounds much:

i.e.

//place this right above the removeAction line, but out of the while loop
_phone say3D "";

Share this post


Link to post
Share on other sites
I'm not sure if there is a way to terminate a sound while it's playing though (in case the player answers in mid-ringing)

I haven't tested it, but possibly deleting the source. That would mean you'd want to use some invisible helper object as the source though.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×