Raider_18 7 Posted November 13, 2023 This is going to be a stupid easy question to answer, I know this is a very simple thing to do, but, I cannot figure this out. I have a trigger placed in editor, it is a 'restricted area'. When the player enters it runs my restricted area function. It will eventually be awesome, but first I need to pass parameters from the trigger to the script to define some things, because there will be multiple areas with different owners and be different sizes etc. So, my question is, how in the heck do I return triggerArea inside of the script from the trigger that exec'd it?? On Act: [independent, false] execvm "restricted.sqf"; restricted.sqf /* bunch of debug stuff here dont worry */ // variables _faction = _this select 0; _sendQRF = _this select 1; _zone = _this; _guards = units inAreaArray _zone select {side _x == _faction}; _bodies = allDead inAreaArray _zone; /* more awesome stuff later after I figure out triggerArea */ You see _zone needs to be the triggerArea, and the _guards are the AI inside the triggerArea (of the corresponding side). Once I figure out how to define these variables all my other code will work and I can place down a bunch of restriced areas and just pass the owner params. But I cant get a return of guards or deadBodies in the dang triggerArea. This is as close as I know how to tell the script that _zone should be the triggerArea of the editor placed trigger whatever size it may be. I have also tried the following: *_zone = _thisTrigger *_zone = _thisList *[independent, thisTrigger, false] execvm "restricted.sqf"; with _zone = _this select 1; None of the above works, keep getting syntax errors about arrays and elements provided. And yes, I have read the wiki and searched the interent for a similar script/solution. Please dont reply with the wiki pages and just tell me to 'read the wiki'. If I understood how to write C code or interpret the generous documentation that is published by Bohemia I wouldnt be posting in the forums for help. I have read and tried to the best of my scripting knowledge from the following: https://community.bistudio.com/wiki/triggerArea https://community.bistudio.com/wiki/inArea https://community.bistudio.com/wiki/inAreaArray https://community.bistudio.com/wiki/Magic_Variables Thank you to anyone who can help 👍 Share this post Link to post Share on other sites
soldierXXXX 110 Posted November 13, 2023 Hi, you've passed the trigger as you should in this example 3 hours ago, Raider_18 said: *[independent, thisTrigger, false] execvm "restricted.sqf"; with _zone = _this select 1; however there is a problem with _guards variable which throws error 3 hours ago, Raider_18 said: _guards = units inAreaArray _zone select {side _x == _faction}; should be: _guards = (units _faction) inAreaArray _trigger; Testing script with some adjustments you can consider here: Spoiler in trigger activation: [civilian,thisTrigger,false] execvm "restricted.sqf"; Script: scriptName "restricted.sqf";//always good to have your scripts named for debugging purposes params ["_faction","_trigger","_sendQRF"];//params are the same as if you wrote private _faction = _this select 0; but it's much easier to use and have advanced functions hint format ["Initialization parameters\nFaction:%1\nTrigger:%2\nSend QRF:%3",_faction,_trigger,_sendQRF]; private _guards = (units _faction) inAreaArray _trigger; private _bodies = allDead inAreaArray _trigger; sleep 5; hint format ["Counted\nGuards:%1\nBodies:%2",count _guards,count _bodies]; sleep 5; private _area = triggerArea _trigger; _area params ["_sizeA","_sizeB","_angle","_isRectangle","_sizeC"]; hint format ["And here you can work with trigger further\nTrigger array:%1\nIs rectangle:%2\nand so on...",_area,_isRectangle]; This should work fine 🙂 Hope this helps 🙂 1 Share this post Link to post Share on other sites
Raider_18 7 Posted November 14, 2023 @SoldierXXX - Many Thanks!! I knew it was something simple, and thank you for throwing in the debug stuff thats really useful. 👍🏻 Share this post Link to post Share on other sites