OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Mr.Peanut on 08 Jun 2007, 23:47:10
-
Please find attached a zipped mission. I need help debugging because I simply can not findf what is wrong and it is either something very simple and stupid or subtle and complicated. In any event I am going mad staring at it. >:(
Preview the mission and use the over object action. I get a syntax error on a trivially simple code line 5 of the script overobject.sqf. ARG!!! >:( >:( >:( >:( >:( >:( >:( >:(
-
private
["_pos","_dist","_type","_buf","_breakflag","_obj","_j","_c","_xmin","_xmax","_ymin","_ymax","_zmin","_zmax","_mpos","_mx","_my","_mz","_wz"
,"_return"];
_pos = _this select 0;
_type = _this select 1;
_dist = _this select 2;
_buf = [0,0,0];
if (count _this > 3) then {_buf = _this select 3;};
_breakflag = TRUE;
_obj = nearestObjects [_pos, _type, _dist];
_wz = -99999;
for [{_j = 0},{_j < count _obj && _breakflag},{_j = _j + 1}] do
{
_c = boundingBox (_obj select _j);
_xmin = ((_c select 0) select 0) - (_buf select 0);
_xmax = ((_c select 1) select 0) + (_buf select 0);
_ymin = ((_c select 0) select 1) - (_buf select 1);
_ymax = ((_c select 1) select 1) + (_buf select 1);
_zmin = ((_c select 0) select 2) - (_buf select 2);
_zmax = ((_c select 1) select 2) + (_buf select 2);
_mpos = (_obj select _j) worldToModel _pos;
_mx = _mpos select 0;
_my = _mpos select 1;
_mz = _mpos select 2;
if (_mx > _xmin && _mx < _xmax && _my > _ymin && _my < _ymax) then
{
_breakflag = FALSE;
_wz = ((_obj select _j) modelToWorld [0,0,_zmax]) select 2;
};
};
[not _breakflag,_wz]
-
offs.... every function I ever wrote for OFP I knew that info about last unsemicoloned line being the return value was not true, but there I was doing it. Thanks. I was losing my mind.