Woodstock21 10 Posted March 6, 2015 So im trying to move a existing insurgency mission over to Bystrica using both ALiVE and CSE with it, for the most part it seems to work, except for the main part of the random spawn of the cache, Now im not a scripter at all, as you see from some of my previous posts but i kinda know a little bit just enough to get myself in trouble, and im thinking that it has something to do with the lack of city names on the map. When i go to preview the mission in the editor there is always error message about Bis_fnc_position not finding anything from what i can tell. Below i will put the script in that spawns the cache and a piece of the RPT Please note that this same scripts works fine on Takistan, Cherno, and United Sharni, my buddy really likes Bystrica so thought i'd move it over for him and ran into this issue. Cache spawn script if (isServer || isDedicated) then { private ["_markers","_x","_randomMarker","_dist","_pos","_m","_decrease","_wait","_cacheBuildings","_targetBuilding","_cachePosition"]; INS_marker_array = []; publicVariable "INS_marker_array"; INS_west_score = 0; publicVariable "INS_west_score"; INS_fncache = { if (typeName _this == "ARRAY") then { cache = _this select 0; cache spawn {sleep 60; deleteVehicle _this}; _killer = _this select 1; // check who killed the box switch (side _killer) do { case WEST: { INS_west_score = INS_west_score + 1; publicVariable "INS_west_score"; _this call cacheKilled; }; case EAST: { INS_west_score = INS_west_score + 1; publicVariable "INS_west_score"; _this call cacheKilled; }; case RESISTANCE: { INS_west_score = INS_west_score + 1; publicVariable "INS_west_score"; _this call cacheKilled; }; default { _this call cacheFake; }; }; }; if (count INS_marker_array > 0) then { {deleteMarker _x} forEach INS_marker_array}; publicVariable "INS_marker_array"; _cities = call SL_fnc_urbanAreas; //_cacheTown = _cities call BIS_fnc_selectRandom; _cacheBuildings = _cacheTown call SO_fnc_findHouse; // Pull the array and select a random building from it. _targetBuilding = _cacheBuildings select (random((count _cacheBuildings)-1)); // Take the random building from the above result and pass it through gRBP function to get a single cache position _cachePosition = [_targetBuilding] call getRandomBuildingPosition; // Create the cache at the random marker position cache = createVehicle ["Box_East_WpsSpecial_F", _cachePosition, [], 0, "None"]; clearMagazineCargoGlobal cache; clearWeaponCargoGlobal cache; // Add event handlers to the cache cache addEventHandler ["handleDamage", { if ((_this select 4) == "SatchelCharge_Remote_Mag") then { cache setDamage 1 } else { if ((_this select 4) == "DemoCharge_Remote_Mag") then { cache setDamage 1 } else { cache setDamage 0 }; }; }]; cache addMPEventHandler ["MPKilled", {_this spawn INS_fncache}]; // Move the Cache to the above select position cache setPos _cachePosition; publicVariable "cache"; if (INS_west_score == (paramsArray select 1)) then { end_title = {titleText["All ammo caches have been destroyed!", "PLAIN"];}; [nil, "end_title", nil, true] spawn BIS_fnc_MP; sleep 20; endMission "END1"; }; if (!isMultiplayer) then { //debug to see where box spawned is if not multiplayer _m = createMarker [format ["box%1",random 1000],getposATL cache]; _m setMarkerShape "ICON"; _m setMarkerType "mil_dot"; _m setMarkerColor "ColorRed"; }; }; true spawn INS_fncache; }; RPT 17:33:19 Error in expression < _this select 0; _count = 0; while {str(_building buildingPos _count) != "[0,0,0> 17:33:19 Error position: <_building buildingPos _count) != "[0,0,0> 17:33:19 Error Undefined variable in expression: _building 17:33:19 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 62 17:33:19 Error in expression <(_count == 0) then { _position = getPos _building; } else { _position = random _> 17:33:19 Error position: <_building; } else { _position = random _> 17:33:19 Error Undefined variable in expression: _building 17:33:19 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 80 17:33:19 Error in expression < _building = _this select 0; _count = [_building] call getCountBuildingPosition> 17:33:19 Error position: <_building] call getCountBuildingPosition> 17:33:19 Error Undefined variable in expression: _building 17:33:19 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 77 17:33:19 Error in expression <l SL_fnc_urbanAreas; _cacheBuildings = _cacheTown call SO_fnc_findHouse; _tar> 17:33:19 Error position: <_cacheTown call SO_fnc_findHouse; _tar> 17:33:19 Error Undefined variable in expression: _cachetown 17:33:19 File C:\Users\Documents\Arma 3\missionsInsurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\cache.sqf, line 70 Share this post Link to post Share on other sites
jshock 512 Posted March 6, 2015 You have the line that defines "_cacheTown" commented out, which leaves the following variables undefined, possibly causing the "_building" variable to be undefined in the script/function that is an error in your RPT. Share this post Link to post Share on other sites
Woodstock21 10 Posted March 6, 2015 Ok ya my bad on that, i forgot that i had tried to comment out the cities thinking that might be the issue, I removed the comment out and new RPT below 18:26:28 Error in expression < _this select 0; _count = 0; while {str(_building buildingPos _count) != "[0,0,0> 18:26:28 Error position: <_building buildingPos _count) != "[0,0,0> 18:26:28 Error Undefined variable in expression: _building 18:26:28 File C:\UsersDocuments\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 62 18:26:28 Error in expression <(_count == 0) then { _position = getPos _building; } else { _position = random _> 18:26:28 Error position: <_building; } else { _position = random _> 18:26:28 Error Undefined variable in expression: _building 18:26:29 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 80 18:26:29 Error in expression < _building = _this select 0; _count = [_building] call getCountBuildingPosition> 18:26:29 Error position: <_building] call getCountBuildingPosition> 18:26:29 Error Undefined variable in expression: _building 18:26:29 File C:\Users\\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 77 18:26:29 Error in expression <BIS_fnc_selectRandom; _cacheBuildings = _cacheTown call SO_fnc_findHouse; _tar> 18:26:29 Error position: <_cacheTown call SO_fnc_findHouse; _tar> 18:26:29 Error Undefined variable in expression: _cachetown 18:26:29 File C:\Users\\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\cache.sqf, line 70 18:26:29 Error in expression <building buildingPos _position; }; if((_position select 0) == 0) then { _positi> 18:26:29 Error position: <_position select 0) == 0) then { _positi> 18:26:29 Error Undefined variable in expression: _position 18:26:29 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\functions\cacheGetPositions.sqf, line 86 18:26:29 Error in expression <createVehicle ["Box_East_WpsSpecial_F", _cachePosition, [], 0, "None"]; clearMag> 18:26:29 Error position: <_cachePosition, [], 0, "None"]; clearMag> 18:26:29 Error Undefined variable in expression: _cacheposition 18:26:29 File C:\Users\Documents\Arma 3\missions\Insurg_CSE_ALiVE1.Woodland_ACR\core\modules\cacheScript\cache.sqf, line 78 Share this post Link to post Share on other sites
jshock 512 Posted March 6, 2015 Ok it looks like your "_building" parameter in the "cacheGetPositions.sqf" is not being passed in the way you want to, same with "_cacheTown" and the rest, it's probably a chain effect, since "_building" is undefined the rest of these variables are undefined, so could you provide the cacheGetPositions.sqf and where/how your calling it. Share this post Link to post Share on other sites
Woodstock21 10 Posted March 7, 2015 cacheGetPositions getRandomRelativePositionLand = { private ["_target", "_distance", "_direction", "_position", "_bestPositions"]; _target = _this select 0; _distance = _this select 1; _direction = random 360; _position = [_target, _distance, _direction] call BIS_fnc_relPos; if(surfaceIsWater [_position select 0,_position select 1]) then { // handy! http://forums.bistudio.com/showthread.php?93897-selectBestPlaces-(do-it-yourself-documentation) _bestPositions = selectbestplaces [[_position select 0,_position select 1],200,"(1 + houses)",10,1]; _position = _bestPositions select 0; _position = _position select 0; _position set [count _position, 0]; }; _position }; /* Generate Random Relative Position on Water */ getRandomRelativePositionWater = { private ["_target", "_distance", "_direction", "_position"]; _target = _this select 0; _distance = _this select 1; _direction = random 360; _position = [_target, _distance, _direction] call BIS_fnc_relPos; while {!(surfaceIsWater [_position select 0,_position select 1])} do { _direction = random 360; _position = [_target, _distance, _direction] call BIS_fnc_relPos; }; _position }; /* Get count of building positions */ getCountBuildingPositions = { private ["_building", "_count"]; _building = _this select 0; _count = 0; while {str(_building buildingPos _count) != "[0,0,0]"} do { _count = _count + 1; }; _count }; /* Get random building position */ getRandomBuildingPosition = { private ["_building", "_count", "_position"]; _building = _this select 0; _count = [_building] call getCountBuildingPositions; if(_count == 0) then { _position = getPos _building; } else { _position = random _count; _position = _building buildingPos _position; }; if((_position select 0) == 0) then { _position = getPos _building; }; _position }; /* Get a position on the side of a nearby road */ getSideOfRoadPosition = { private ["_target", "_radius", "_roads", "_road", "_position"]; _target = _this select 0; _radius = if(count _this > 1) then {_this select 1} else {100;}; _roads = _target nearRoads _radius; if(count _roads > 1) then { _road = getPos (_roads select (random((count _roads)-1))); _position = [(_road select 0) + 6, _road select 1, _road select 2]; } else { _position = _target; }; _position }; As far as i can tell being called by this init #include <modules\modules.hpp> #ifndef execNow #define execNow call compile preprocessfilelinenumbers #endif // Add briefing execNow "core\scripts\briefing.sqf"; #ifdef gridMarkers if (isServer || isDedicated) then { null = ["null"] execVM "core\modules\gridMarkers\createMarkers.sqf"; }; #endif #ifdef cacheScript execNow "core\modules\cacheScript\cache.sqf"; #endif #ifdef intelSpawn if (isServer || isDedicated) then { [] execVM "core\modules\cacheScript\Functions\spawnIntel.sqf"; }; #endif Share this post Link to post Share on other sites
jshock 512 Posted March 7, 2015 Yea so it seems that the building being passed in isn't defined or is null, so I would check all the variables before that point to ensure that a building is actually being passed to the function, if not, then it's probably one of the other functions having an issue returning the data it's supposed to. Share this post Link to post Share on other sites
Woodstock21 10 Posted March 7, 2015 Ahhh um sure, honestly you kinda lost me, and i have no idea where to or well how to even start that, Just doesnt make sense to me that it doesn't work cause its just a reorganized cherno map and it works fine on the full cherno. Share this post Link to post Share on other sites
jshock 512 Posted March 7, 2015 Ok, so one of the following call lines is not returning what it's supposed to: _cities = call SL_fnc_urbanAreas; _cacheTown = _cities call BIS_fnc_selectRandom; _cacheBuildings = _cacheTown call SO_fnc_findHouse; _targetBuilding = _cacheBuildings select (random((count _cacheBuildings)-1)); So you need to debug it, see what's returning what, if it's returning anything at all, best way to do that is to hint the values coming out, so you can see it as it happens, so below each of these lines (one-by-one) do something like this to see what each variable contains after the function call: hint str(_cities); And if the hint doesn't have what you would expect in it, or it is empty, then the function that precedes the hint is the one more than likely causing the issue. Share this post Link to post Share on other sites