kupcho 19 Posted May 6, 2018 Howdy, I'm trying to use a script that I 'borrowed' from a mission a friend shared with me. I believe the original script is by SPUn/LostVar (at least that's who's credited in the files I have), and the files I use were found in the mission "Operation Dagger" by OneShot. I'm getting an error message every time a trigger is tripped that calls on the "fillhouse" script that, in turn calls the "nearestBuilding" script that then calls on the "Patrol-vG" script. I know next to nothing about scripts, but if I read the error correctly, I think the problem is in the patrol-vG script. Anyway, the error popup states... '...t] call LV_nearestBuilding; _building = |#| _buildings select 0; while { alive _un...' Error undefined variable in expression: _buildings File C:\Users\etc\etc Profiles\etc\missions\testA.Altis\LV\Patrol-VG.sqf, line 12 The Patrol-vG script (part of it anyway (I don't want to step on anyones toes y'know...)) is as follows: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ///////Simple House Patrol script vG 1.3 - SPUn / LostVar // //*infantry units patrols inside nearest building and outside of it //*Syntax: nul = [this] execVM "LV\patrol-vG.sqf"; private ["_unit","_newPos","_i","_i2","_bPoss","_building","_dir","_range","_curPos","_outOrNot"]; if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";}; _unit = _this select 0; _buildings = ["nearest one",_unit] call LV_nearestBuilding;_building = _buildings select 0; while { alive _unit }do{ if(isNull(_unit findNearestEnemy _unit))then{ _unit forceSpeed 1; _unit setBehaviour "SAFE"; }; _bPoss = []; _i = 0; while { ((_building buildingPos _i) select 0) != 0 } do { _bPoss set [count (_bPoss), (_building buildingPos _i)]; _i = _i + 1; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ I'm assuming that the "LV_nearestBuilding" code works, since it states that the error occurs in line 12. But like I said...I know very little about scripting. Any help would be greatly appreciated. Share this post Link to post Share on other sites
Dedmen 2588 Posted May 7, 2018 13 hours ago, kupcho said: I'm assuming that the "LV_nearestBuilding" code works, since it states that the error occurs in line 12. You are wrong. The error in line 12 happens because a variable is undefined. And that variable is undefined because LV_nearestBuilding doesn't work. Is the file where it should be? aka: 13 hours ago, kupcho said: "LV\LV_functions\LV_fnc_nearestBuilding.sqf" Share this post Link to post Share on other sites
kupcho 19 Posted May 7, 2018 Thanks Dedmen. This was a copy/paste job from the Operation Dagger mission, and the files are where they're supposed to be. I've used it many times in the past (pre-3d editor), but when they released that, most of my missions didn't work any longer and I gave up trying to keep up. Then...I had an urge to try and find out what was wrong. That's why I'm here today. I'm not too good at scripting, but I suppose that I'll be rooting through the 'nearestBuilding' text soon. Maybe I can figure it out. I appreciate the help m'frend. Share this post Link to post Share on other sites