• 0
monkeybrain

Creating a activation trigger

Question

I was playing around with triggers in editor and wanted to see if it worked on exile so i put this into the SQM in exile.
 

class Entities
    {
    items=1;

class Item0
        {
            dataType="Trigger";
            position[]={9070.1221,130.87619,16045.862};
            class Attributes
            {
                onActivation="playsound""song"";";
                sizeA=100;
                sizeB=100;
                repeatable=1;
                activationBy="ANY";
                isRectangle=1;
            };
            id=252;
            type="EmptyDetectorAreaR50";
            atlOffset=0.40499878;
            };
            };

Works in editor, how would I get it to work in exile? Is it even possible? :P

Thanks

Share this post


Link to post
Share on other sites

22 answers to this question

  • 0

No, rather on what code was used to play the sound.  You can use the exact same 'play sound' code contained within that script, as it is for MP and not SP.

You take that command(s) and place them into YOUR script.

:)

Share this post


Link to post
Share on other sites
  • 0
On 17/11/2017 at 2:18 AM, Z80CPU said:

No, rather on what code was used to play the sound.  You can use the exact same 'play sound' code contained within that script, as it is for MP and not SP.

You take that command(s) and place them into YOUR script.

I know you are trying so hard to help..  I have read & re-read your last comments,  they have just confused me. :$ 
 I  don't understand what you are trying to say... I DO understand that when u know how to do something, it is easy as pie... but when (like me) you're trying to make head and tails from something you don't fully understand, it's not so clear. Is there any chance you could try again to explain with a little more clarity.. think idiot friendly!  ;) 

Edited by Numbat177

Share this post


Link to post
Share on other sites
Advertisement
  • 0

hahah...nah, you're not an idiot!  Idiots do not ask questions!  ;)

I went back and looked, I never posted the example I was talking about.  My mistake and I am sorry!

On the activation field of the trigger, you place the sound command:

playSound "YourSoundHere";

(You do NOT need to use the above 'yourscript.sqf' that he lists, JUST THE TRIGGER)

 

Done!

See PlaySound

 

- Add item to your Description.Ext as shown by example in listed post

- Add playsound command to trigger activation field

 

That should be it!

 

When you modify the EXT file, I would use a VERY UNIQUE name for your sound as not to conflict with any other sound name.

Example:  NumBatt177_Sound_001

:)

 

Edited by Z80CPU
  • Like 1

Share this post


Link to post
Share on other sites
  • 0
6 hours ago, Z80CPU said:

hahah...nah, you're not an idiot!  Idiots do not ask questions!  ;)

I went back and looked, I never posted the example I was talking about.  My mistake and I am sorry!

Regarding the idiot status... yet to be confirmed! hahah

Ok so THAT makes a little more sense, loosening the straightjacket (but not removing just yet).

After a few unsuccessful variations of the trigger sqf, I  placed the playSound "YourSoundHere"; at the very top of my sqf, just to test, the sound played on the server, (THANK YOU FOR THAT) YAAAAAY getting closer!!!! xD...

I know the descript and iniplayer files are all good it's the trigger inside the sqf call that's killing me... I have googled myself silly, to try and find correct trigger call method, but am finding nought...  at the moment, in my sqf I have the following:

Spoiler

class Item1 
    {
        dataType="Trigger";
        position[]={16719.416,3.2958221,10335.763};
        class Attributes
        {
            //condition=            "call{this}";
            onActivation=         playsound "adhan";
            sizeA=                250;
            sizeB=                250;
            repeatable=            1;
            activationBy=        "ANYPLAYER";
            effectSoundTrigger=    "adhan";
        };
        id=306;
        type="EmptyDetectorAreaR250";
    
    };
 

 

Share this post


Link to post
Share on other sites
  • 0

Best thing I can suggest is to place it in a SP map, save it, then open up the mission and look at the trigger.

Make sure it is working FIRST.

Remember, you must 'define' it in the description file.

 

See/Read:

https://www.google.com/search?ei=BNEQWuGpEMLKmwHk_7fQDg&q=arma+play+a+sound+mission+trigger&oq=arma+play+a+sound+mission+trigger

https://forums.bistudio.com/forums/topic/182755-play-sound-by-a-trigger/

:)

Share this post


Link to post
Share on other sites
  • 0

Not sure if this will be helpful in this case. However, a while back, I was trying to figure out how to trigger a sound when approaching my Black Market traders. What I finally came up with worked very well. My goal was to have the sound play so that the triggering player could hear it and not the whole server, while having it seem like the sound was coming from the trader instead of coming off like the sound was all around the player.

I utilized "playSound3D", which according to Bohemia, "plays positional sound with given filename on every computer on network." Even so, it worked to play the sound "locally" as opposed to everyone hearing it across the whole server. I also used some code from KillZoneKid that made it possible, since playSound3D doesn't work off sound files that are specified in "CfgSounds" of the description.ext.

Bomhemia playSound3D

The first thing I did was place the sound file in the "sound" folder within the mission root... mission folder\sound\CheckItOut.ogg

Next, I added the following to the top of the init.sqf to provide the triggered playSound3D the ability to understand the "mission root" and actually find the sound

// Code needed to make "playsound3D" triggered sounds work (Thanks to KillZoneKid)
MISSION_ROOT = call {
    private "_arr";
    _arr = toArray __FILE__;
    _arr resize (count _arr - 8);
    toString _arr
};

Finally, I added the trigger to the mission.sqm. I used a rectangular trigger area, as I was able to cover the required trigger area more easily. Iset the trigger activation as repeatable and set it to be activated by the "GUER" faction, which should be player only. The X,Y,Z position specified in the "onActivation" is the position of the trader himself, also known as the "soundPosition". The three numbers at the end of the "onActivation" are the Volume, Pitch and Distance. I set the distance at 30, as I did not want the sound going further than that. The Bohemia info states that the 'soundSource" (which I set as "player) is ignored if the "soundPosition" is specified. I can't remember why I specified "player" as the "soundSource", since it should be ignored. But, the code worked exactly as I wanted, so I left it.

		class Item99
		{
			dataType = "Trigger";
			position[] = {5642.1904, 266.55051, 9817.6455};
			angle = 1.8865348;
			class Attributes
			{
				name = "TriggerBlackMarket1";
				sizeA = 12;
				sizeB = 10;
				sizeC = 8;
				isRectangle = 1;
				activationBy = "GUER";
				repeatable = 1;
				onActivation = "playSound3D [MISSION_ROOT + ""sound\CheckItOut.ogg"", player, false, [5640.59, 9818.17, 266.557], 25, 1, 30];";
			};
			id = 199;
			type = "EmptyDetector";
		};

Hope this helps

Edited by Kurewe
  • Like 1

Share this post


Link to post
Share on other sites
  • 0
On 20/11/2017 at 3:43 AM, Kurewe said:

Hope this helps

The fact that you gave such an in-depth reply.. is very much appreciated :rock:.. and hopefully helps someone else along the track.
As for myself, it didn't work. I tried a few variations, I am pretty sure from my earlier readings that playsound3D will only do audio files upto 50kb.. so i ended up chopping my audio file down to that.. I even went as far as changing the audio filename to the one in your example and copied EVERYTHING you had exactly.. apart from the class and ID #s... still no go. :(

Do you still have this operating on on an Exile MP server?

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Numbat177 said:

The fact that you gave such an in-depth reply.. is very much appreciated :rock:.. and hopefully helps someone else along the track.
As for myself, it didn't work. I tried a few variations, I am pretty sure from my earlier readings that playsound3D will only do audio files upto 50kb.. so i ended up chopping my audio file down to that.. I even went as far as changing the audio filename to the one in your example and copied EVERYTHING you had exactly.. apart from the class and ID #s... still no go. :(

Do you still have this operating on on an Exile MP server?

My sound file "CheckItOut.ogg" is 10kb.
Just out of curiosity... Are you using a proper .ogg file, or are you using another format?
When you updated the mission.sqm, I'm assuming you incremented the "items = ##" +1?
Did you update the location and size of the trigger? And, update the soundPosition to match the object the sound should come from?
Let me double check my files to make sure I didn't miss something.
I have the server down right now due to time constraints relating to my father's health. But, I can bring it up temporarily to show you how this works on my server. The teamspeak address in my signature is current. I'm usually available to talk from 3pm to midnight CST.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
On 21/11/2017 at 6:32 PM, Kurewe said:

Just out of curiosity... Are you using a proper .ogg file, or are you using another format?
When you updated the mission.sqm, I'm assuming you incremented the "items = ##" +1?
Did you update the location and size of the trigger? And, update the soundPosition to match the object the sound should come from?
Let me double check my files to make sure I didn't miss something.
I have the server down right now due to time constraints relating to my father's health. But, I can bring it up temporarily to show you how this works on my server. The teamspeak address in my signature is current. I'm usually available to talk from 3pm to midnight CST.

Hi again, :)

Sorry, I wasn't entirely clear on what I had done, my bad, please allow me further explain...

Yes, I'm using .ogg file (49.5Kb, mono, 16bit, 11025Hz... which I have read, i think on BI, it needs to be). located in main mission folder , subfolder 'sound' ...and changed the .ogg filename to match yours.

Yes updated your pos co-ords to my pos needs (and flipped the xyz to match the last pos call in script, as your one did), I even tried using a trader position, just in case I had my co-ords wrong.

I used the same ID# as in my first post, (which was generated from Eden) .

mission.sqm as below...

Spoiler

 class Mission
{

    class Item53
    {
        dataType = "Trigger";
        position[] = {16713.488,3.2,10337.968};
        angle = 1.8865348;
        class Attributes
        {
            name = "TriggerBlackMarket1";
            sizeA = 12;
            sizeB = 10;
            sizeC = 8;
            isRectangle = 1;
            activationBy = "GUER"; //tried WEST as well
            repeatable = 1; //also omitted this
            onActivation = "playSound3D [MISSION_ROOT + ""sound\CheckItOut.ogg"", player, false, [16713.488,10337.968,3.2], 25, 1, 30];";
        };
        id = 306;
        type = "EmptyDetector";
    };

};

init.sqf as below

Spoiler

MISSION_ROOT = call {
    private "_arr";
    _arr = toArray __FILE__;
    _arr resize (count _arr - 8);
    toString _arr
};

I am so confused as to what the heck I am doing wrong.. lol.. hopefully it's glaringly obvious to you!

Thank you again for your offer of help ;) 

Share this post


Link to post
Share on other sites
  • 0
55 minutes ago, Numbat177 said:

Hi again, :)

Sorry, I wasn't entirely clear on what I had done, my bad, please allow me further explain...

Yes, I'm using .ogg file (49.5Kb, mono, 16bit, 11025Hz... which I have read, i think on BI, it needs to be). located in main mission folder , subfolder 'sound' ...and changed the .ogg filename to match yours.

Yes updated your pos co-ords to my pos needs (and flipped the xyz to match the last pos call in script, as your one did), I even tried using a trader position, just in case I had my co-ords wrong.

I used the same ID# as in my first post, (which was generated from Eden) .

I am so confused as to what the heck I am doing wrong.. lol.. hopefully it's glaringly obvious to you!

Thank you again for your offer of help ;) 

If you don't mind, could you put the whole mission.sqm in a spoiler. So far, what I see looks proper.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.