yacobm8 10 Posted July 17, 2014 So its my first time making a function. I have this in my init.sqf myFunction = compile preprocessFileLineNumbers "makeTrigger.sqf"; makeTrigger.sqf //create trigger around ai to detect whenhelicopter has landed. _ai = _this; _trigger = createTrigger["EmptyDetector",getPos _ai]; _trigger setTriggerArea [40, 40, 0, false]; _trigger setTriggerActivation ["WEST", "PRESENT", true]; _trigger setTriggerStatements ["(getPos helicopter select 2) < 4 && speed helicopter < 5 && (player distance _ai) < 40","_ai assignAsCargo helicopter; [_ai] orderGetIn true;",""]; _trigger; now in my helicopters init i have a getIn event handler that then runs my script named waypoint.sqf. waypoint.sqf looks like this. result = peter call myFunction; //note: peter is the name of the ai in the editor The problem is that the trigger does not return to the waypoint.sqf script. I thought it would do because the last statement in the function is _trigger; which means that it should return the trigger right? If you can't help me fix this then could you please explain how you would go about returning a trigger using a function? also i checked my rpt log and there were no errors with the code. Share this post Link to post Share on other sites
fight9 14 Posted July 17, 2014 (edited) Use the format command to put _ai into the trigger statement string. You can't write local variables like that - It's in a different scope. Edited July 18, 2014 by Fight9 Share this post Link to post Share on other sites
yacobm8 10 Posted July 18, 2014 thanks flight9 that worked just like it should do now and i'll be sure to remember it in the future :) Share this post Link to post Share on other sites
fight9 14 Posted July 19, 2014 I'm glad you worked it out. Truth be told, I'm glad you figured it out without me having write the exact code. It means you are learning. Good shit Share this post Link to post Share on other sites