circassian 1 Posted November 5, 2013 Hi Guys, I don't know if this is the right section to ask this.. I want to activate a trigger when a Fighter aircraft reaches some speed.. like to make "Penetrate the sound barrier".. I saw this in F/A-18 addon.. Anyone has an idea how to? Share this post Link to post Share on other sites
Lenyoga 326 Posted November 5, 2013 ?(speed _unitname > number) is the piece of code you're looking for. If you have an init script for the unit, which looks like that, it should work #start @(speed _unitname > number) _unitname say "soundeffectName" ~5 @(speed _unitname < SmallerNumber) goto "start" Share this post Link to post Share on other sites
circassian 1 Posted November 5, 2013 Hi Lenyoga I think I didn't get it, I did this but didn't work Description.ext: class Sonic { name = ""; sound[] = {"Sonic.ogg", db-10, 1.0}; titles[] = { }; }; Init.sqs: #start @(speed _F22 > 925) _F22 playsound "Sonic" ~5 @(speed _F22 < 924) goto "start" or: #start @(speed _F22 > 925) _F22 say "Sonic" ~5 @(speed _F22 < 924) goto "start" non works... Share this post Link to post Share on other sites
Lenyoga 326 Posted November 5, 2013 Did you define the unit first? I'd try it like this: (can't really try it out ingame right now) Init.sqs: (if plane1 is the unit's name in the editor) _F22 = plane1 #start @(speed _F22 > 925) _F22 playsound "Sonic" Hint "it should work, if there's no sound, then the sound has a problem" ~5 @(speed _F22 < 920) goto "start" Share this post Link to post Share on other sites
circassian 1 Posted November 5, 2013 (edited) Thanks Lenyoga, It works but only this way: [color="#A9A9A9"]_F22[/color] = plane1 [color="#0000CD"]#start[/color] @(speed [color="#A9A9A9"]_F22[/color] > 925) this [color="#FF0000"]exec [/color]"sonic.sqs" ~5 @(speed [color="#A9A9A9"]_F22[/color] < 924) [color="#0000FF"]goto "start"[/color] I made a sonic.sqs and putted in it "playsound" command and its works now perfectly :cool: Edited November 5, 2013 by Circassian Share this post Link to post Share on other sites
Lenyoga 326 Posted November 5, 2013 Glad it worked! And I just saw the mistake I made, I should have had "Say" instead of "PlaySound" Share this post Link to post Share on other sites
circassian 1 Posted November 7, 2013 Hi Lenyoga, Between ourselves, It is kind a boring that every time you want to play to add all this files to the mission to have this script, so I went to the addon it self and putted this scripts in it so I don't waste more time. I did well so far but the only problem I'm facing is how to choose the name. I don't want to name the unit from the editor every time I play.. _F16 = ? #start @(speed _F16 > 923) _F16 say "Sonicboom" ~5 @(speed _F16 < 922) goto "start" I've tried to choose the name from config.cpp but It didn't work.. Any Ideas? Share this post Link to post Share on other sites
Lenyoga 326 Posted November 7, 2013 There's basically two possibilities, you could execute the script from the unit's init eventHandler (they don't work in multiplayer, though, I think) or you could turn "_F16" into "yourTag_F16" and then define that global variable in the the init script or any init field "yourTag_F16 = plane1" - I'd suggest using eventhandlers, though: class Unit: { parameter = ; parameter = ; parameter = ; class EventHandlers { init = "[(_this select 0)] exec {\AddonFolderName\scriptname.sqs}"; }; }; then, the name in the script would be _F16 = _this select 0 Share this post Link to post Share on other sites
circassian 1 Posted November 8, 2013 Thanks Lenyoga, It works.. now I'm gonna do this to all planes addons :bounce3: Share this post Link to post Share on other sites