Intact 10 Posted March 2, 2014 Hi I've created a simple mission where an AI activates a trigger and then a track plays(through the effects option of the trigger). But my problem is that this track plays for everyone on the server. I would like it to play for only myself, or a selected group of people. How do I do this? I've alrdy searched the internet and this forum but I haven't found anything about this. Thanks Share this post Link to post Share on other sites
KC Grimes 79 Posted March 2, 2014 The trigger effects are local, the problem you're having is that the trigger is on all machines. Try this first. Restrict it so that it only effects players not in your special group, and changes their music on activation (which I BELIEVE is a local change, may not be correct though): if (!(group/player that you WANT to have sound)) then { trigger setMusicEffect "$NONE$"; }; That would go in the init.sqf, or anywhere that is executed before the trigger is executed. You could also try the inverse, having the trigger in the editor set to no sound, and change this code so that it refers to the group you want to have sound (remove the not "!") and change the music to the music you want. If that doesn't work, try the same thing but instead of using the setMusicEffect command, do a deleteTrigger for the trigger, in hopes that it only deletes the trigger on the client that it is executed. This is all speculation, no promises. Sorry! Share this post Link to post Share on other sites
Intact 10 Posted March 2, 2014 Thanks for the reply. I haven't gotten far though, that line of code gives me an error message when I preview the mission. I must be using it wrongly. This is what I use in my init.sqf: if (!(bob)) then { trigger setMusicEffect "$NONE$"; }; I've also tried: if (!bob) then { trigger setMusicEffect "$NONE$"; }; Share this post Link to post Share on other sites
KC Grimes 79 Posted March 2, 2014 (edited) Sorry, I was typing what I was thinking, not exactly applying it. Try what is below. First though, make sure "trigger" actually reflects the name of your trigger. :P //You have two options. You can make an array and include all the names you want in it, //or you can make a group so that everyone in that group is effected //Option 1: - Add anyone you want to be "special" into the array, no quotes. _specialarray = [test]; if !(player in _specialarray) then { triggernamehere setMusicEffect "$NONE$"; }; //Option 2: - This assumes all specials are in the same group, in this case led by test. Otherwise, make the group. _specialarray = units group test; if !(player in _specialarray) then { triggernamehere setMusicEffect "$NONE$"; }; You WILL need to adjust it a little to make it work for you. Please don't be the guy that says the above doesn't work because you took generic code and didn't change variables, or add to the arrays, in order to fit your mission. :) For option 1, you'll need to replace test and also add whatever other names go in the array. For option 2, you'll need to replace test with the actual group leader's names, or just reference the group if you've already defined it. And of course, you'll need to change the trigger name to what it is in the editor. Edit: Also, just to point it out, this works because player is a "local" variable, if you will, meaning that it will return a locally unique value. For instance, "player" run on the client who is playing a character named "bob" will return "bob", but will return "tim" if executed on a client that is playing the character "tim". As well, if you were looking to be even more versatile with this, you could include "name player" instead of just "player" to search for specific profile names, such as SSG Grimes [3rd ID]. So for instance if you are searching for clan mates, you could check to see if [3rd ID] is in their "name player". Just extra food for thought. Edited March 2, 2014 by Grimes [3rd ID] Share this post Link to post Share on other sites
Intact 10 Posted March 2, 2014 Thank you so much Grimes, it worked! I'm really new when it comes to the editor & scripting so thanks a lot for explaining me in detail what to do :) Btw I didn't mean to say that your code was bad because I didn't work for me, I knew I was using wrong variables but I really didn't know what. Share this post Link to post Share on other sites
KC Grimes 79 Posted March 2, 2014 I understand completely, and wasn't getting offended. All is good! It is just important that you and other new editors not just take what suggestions you get, but learn about those suggestions, more specifically what makes them up and how and WHY they work. This will allow you to further your knowledge of logic and SQF. Glad it worked for you! Good luck on your mission. Share this post Link to post Share on other sites
Th3ChozenOn3 10 Posted September 15, 2014 (edited) I have a trigger that activates whenever a Independent(Players) is present in the trigger area and plays music for those independent players that entered the area. The problem is the music gets played for everyone on the independent side which is not what I wanted to happen, instead I want the music to play only for the players that have entered the trigger area. I searched multiple threads and forums without any help. Here is what I placed in my missions init file which didn't work. _specialarray = [Player]; if !(Player in _specialarray) then { PlayMusic_US SetMusicEffect "Murica"; }; PlayMusic_US is the triggers name and "Murica" is declared in the description.ext under cfgMusic I have also tried Say3D to play a sound at a marker position and also playsound3D on a marker position, both didn't work Edited September 15, 2014 by Th3ChozenOn3 Share this post Link to post Share on other sites
jshock 513 Posted September 15, 2014 I have a trigger that activates whenever a Independent(Players) is present in the trigger area and plays music for those independent players that entered the area. The problem is the music gets played for everyone on the independent side which is not what I wanted to happen, instead I want the music to play only for the players that have entered the trigger area.I searched multiple threads and forums without any help. Here is what I placed in my missions init file which didn't work. _specialarray = [Player]; if !(Player in _specialarray) then { PlayMusic_US SetMusicEffect "Murica"; }; PlayMusic_US is the triggers name and "Murica" is declared in the description.ext under cfgMusic I have also tried Say3D to play a sound at a marker position and also playsound3D on a marker position, both didn't work All you need is the below in your trigger condition: player in thisList; //This should give you the localized effect for each player that enters the trigger's activation area. Share this post Link to post Share on other sites
Th3ChozenOn3 10 Posted September 15, 2014 Thanks a bunch it worked! Share this post Link to post Share on other sites