doctorbutts 15 Posted August 30, 2018 I have a trigger that starts a script: OnAct null = [suicardriver_2] execVM "ambush\carfollow.sqf"; ambush script _driverman = _this select 0; _driverman setBehaviour "CARELESS"; _driverman setSpeedMode "FULL"; _fol = [] spawn { while {alive _driverman} do { _driverman doMove (position veh_food); sleep 5; }; }; Whenever the trigger is touched, I get an undefined variable error- but only in the following area: _fol = [] spawn { while {alive _driverman} do { _driverman doMove (position veh_food); sleep 5; }; }; (script error says line 7 is the issue). Share this post Link to post Share on other sites
stanhope 409 Posted August 30, 2018 _fol = _this spawn { _driverman = _this select 0; _driverman setBehaviour "CARELESS"; _driverman setSpeedMode "FULL"; while {alive _driverman} do { _driverman doMove (position veh_food); sleep 5; }; }; _driverman wasn't defined in the spawned code, this fixes it (untested tho) 2 Share this post Link to post Share on other sites
Tankbuster 1733 Posted August 30, 2018 Yep. If it breaks, the first suspect is scope. 1 Share this post Link to post Share on other sites
gc8 970 Posted August 30, 2018 There's no need of spawn because of the execVM 3 Share this post Link to post Share on other sites
HazJ 1288 Posted August 31, 2018 Further more. Use params instead of ancient select method. https://community.bistudio.com/wiki/params Quote Parses input argument into array of private variables Share this post Link to post Share on other sites