Nafrey 1 Posted August 3, 2020 Hi all, I've been stuck on this AI artillery problem for half a day now. I have 2 enemy mortars I wish to activate via trigger and script (separately, by that I mean they aren't grouped together and I have 2 triggers calling the script once for each mortar). Testing the trigger and script in game, I was originally getting an error for undefined variables (both _mortar and _target), but now I'm getting an error for "undefined variable in expression _target". In each trigger, I have: script = [mortarNumber, getMarkerPos markerNumber] execVM "eFireMission.sqf"; which, after some tuning, I turned into: markerTarget1 = getMarkerPos marker1; null = [mortar1, markerTarget1] execVM "eFireMission.sqf"; (does this difference do anything? I originally assumed that using "getMarkerPos" in the passed variable would work since "getMarkerPos" returns an array, doesn't it? And for my script, I incorporated a script I saw on the forums through a google search for artillery scripts from 7 years ago (user 2nd Ranger's post in that thread) for an MP mission I'm making for my friends and I: _mortar = _this select 0; //--- name of the mortar, arg passed from trigger _target = _this select 1; //--- central point around which mortar hits, arg passed from trigger if (isServer) then{ for "_i" from 0 to 8 do { _radius = 50; //--- random radius from the center _pos = [ (_target select 0) - _radius + (2 * random _radius), (_target select 1) - _radius + (2 * random _radius), 0 ]; _mortar doArtilleryFire[ _pos, getArtilleryAmmo[_mortar] select 0, 1 ]; sleep 2; //--- delay between rounds }; }; What am I doing wrong? Any help is appreciated, this is my first time scripting for Arma 3, I'm a little lost Share this post Link to post Share on other sites
pierremgi 4852 Posted August 3, 2020 marker1 is not a marker name. "marker1" could be, if you write marker1 in variable (name) field of the marker. I know it's a little bit weird but... getMarkerPos (as other marker commands) is waiting for a "marker name", so a string. Check that. markerTarget1 = getMarkerPos "marker1"; null = [mortar1, markerTarget1] execVM "eFireMission.sqf"; or even: null = [mortar1, getMarkerPos "marker1"] execVM "eFireMission.sqf"; 1 Share this post Link to post Share on other sites
Nafrey 1 Posted August 3, 2020 That was exactly it. Thank you, my guy. I'd spent the better part of yesterday going through the Biki and I never noticed the significance of the quotation marks, oh man. Thanks! 45 minutes ago, pierremgi said: marker1 is not a marker name. "marker1" could be, if you write marker1 in variable (name) field of the marker. I know it's a little bit weird but... getMarkerPos (as other marker commands) is waiting for a "marker name", so a string. Check that. markerTarget1 = getMarkerPos "marker1"; null = [mortar1, markerTarget1] execVM "eFireMission.sqf"; or even: null = [mortar1, getMarkerPos "marker1"] execVM "eFireMission.sqf"; Share this post Link to post Share on other sites