Luft08 27 Posted September 26, 2021 I created a simple mission using the Weferlingen map in the Global Mobilization mod where the players are suppose to go to a bridge that has been picked randomly and destroy it. The bridge information is contained in an array: eastGermanBridges = [ // [[Position, object ID], [Position, object ID],...] [[10577.8,17680.2,0], 164227], [[10889.8,17545.4,0],165458], [[12102.7,17199.6,0],165582], [[13399.5,15948,0],164235], [[14312.1,15123,0],164249], [[13630.1,12722.1,0],164261], [[14927.9,15361.6,0],166646], [[14943.2,15220.9,0],166647], [[15658.5,14663.3,0],235425], [[15663.2,14166.2,0],238196], [[16256.9,12515.4,0],270828], [[17365.1,11464.7,0],275208], [[18684.4,11083.3,0],276575], [[14927.8,15360.4,0],166646], [[16192.9,15358,0],235165], [[18230.3,15977.5,0],266019], [[19959.8,4850.35,0], 1464670], [[18082.2,5211.08,0], 1470836], [[16399.4,6661.06,0], 1461107], [[16143.3,6951.2,0], 1460362], [[16004.2,7406.74,0], 174988], // Railroad bridge [[15553.2,8796.89,0], 293086], [[14255.2,11924.2,0], 280667], [[13137.8,8403.86,0], 1484167], [[12917.6,8265.83,0], 1487696], [[12582.7,7924.79,0], 1495446], [[12364.4,7602.17,0], 174563], // Railroad bridge [[13666.6,4606.77,0], 1507185], [[13870.7,4370.2,0], 1509436], [[15269.4,2432.02,0], 1517183], [[16340.1,178.734,0], 1518517] ]; I choose the bridge with the following code: if(!isServer) exitWith {}; private _bridgeArray = selectRandom eastGermanBridges; private _bridgePosition = _bridgeArray select 0; bridge = nearestObject _bridgePosition; I have the following code calls a function to check if the bridge has been destroyed: ["itemAdd", ["bridgeDestroyedID", { [] call bridgeDestroyedCheck; }, 1]] call BIS_fnc_loop; If the bridge has been destroyed it sets the task to succeeded and creates a new task to return to base to complete the mission: if(!isServer) exitWith {}; if(!alive bridge) then { ["itemRemove", "bridgeDestroyedID"] call BIS_fnc_loop; ["destroyBridgeTask","SUCCEEDED"] call BIS_fnc_taskSetState; [true, ["returnTask"], ["Bridge destroyed! Good work, now report to the officer.", "Report to Officer", "returnMarker"],officer_1, "ASSIGNED", 1, true, "navigate", true] call BIS_fnc_taskCreate; ["itemAdd", ["checkForWinID", { [] call checkForWin; }, 1]] call BIS_fnc_loop; }; When testing it I bring up a debug console and type: bridge setDamage 1; The bridge is destroyed and the task completes. However, if I sneak out to the bridge and plant explosive charges and blow the bridge up that way the task is not completed even though the bridge is destroyed. Share this post Link to post Share on other sites
RCA3 581 Posted September 26, 2021 1 hour ago, Luft08 said: if(!alive bridge) then { Try checking if (damage bridge > 0.X) then { Where X is damage you should check from bridge after using explosives (with damage bridge). Share this post Link to post Share on other sites
Luft08 27 Posted September 26, 2021 Thanks, I though about that but I just made another test. I went to the bridge to get a snapshot of it blowing up. I set the damage to 1 and the task completed but the actual bridge was untouched! I'm thinking I need to do something with the bridge IDs. I collected this data a long time ago but forgot what I was going to do with the ID. Share this post Link to post Share on other sites
Luft08 27 Posted September 26, 2021 20 minutes ago, Luft08 said: Thanks, I though about that but I just made another test. I went to the bridge to get a snapshot of it blowing up. I set the damage to 1 and the task completed but the actual bridge was untouched! I'm thinking I need to do something with the bridge IDs. I collected this data a long time ago but forgot what I was going to do with the ID. oops... I just read that object IDs are unreliable and could change at each map update. Well, this should simplify my bridge array but now I'm really stuck. Can't I set a variable to the value returned by nearestObject? Does nearestObject return a copy or a reference? Share this post Link to post Share on other sites
pierremgi 4738 Posted September 26, 2021 nearestObject You should try this syntax: _bridge = nearestObject [position, "house"] or nearestObject [position, "building"] try in debug console typeOf (nearestObject [position, "building"]) Don't forget to define position 1 Share this post Link to post Share on other sites
Luft08 27 Posted September 26, 2021 2 hours ago, pierremgi said: nearestObject You should try this syntax: _bridge = nearestObject [position, "house"] or nearestObject [position, "building"] try in debug console typeOf (nearestObject [position, "building"]) Don't forget to define position Thanks pierremgi, I just woke up out of a sound sleep when what I believe to be the answer popped into my head. Much like what you suggest! I think what is happening is the nearest object at my positions are things UNDER the bridge. Maybe what I should do it get a list of road segments within a radius of my position and iterate through them looking for a road type of bridge. Hopefully the road segment IS the bridge and can be destroyed. I want to thank you and everyone in the Arma community that makes working on these projects so enjoyable. It would take so much longer without your support. Thanks! 1 Share this post Link to post Share on other sites
Luft08 27 Posted September 26, 2021 1 hour ago, Luft08 said: Thanks pierremgi, I just woke up out of a sound sleep when what I believe to be the answer popped into my head. Much like what you suggest! I think what is happening is the nearest object at my positions are things UNDER the bridge. Maybe what I should do it get a list of road segments within a radius of my position and iterate through them looking for a road type of bridge. Hopefully the road segment IS the bridge and can be destroyed. I want to thank you and everyone in the Arma community that makes working on these projects so enjoyable. It would take so much longer without your support. Thanks! It Worked. I changed my bridge array to remove all of the object IDs and railroad bridges that are indestructable. No sense it keeping them. eastGermanBridges = [ [10577.8,17680.2],[10889.8,17545.4],[12102.7,17199.6],[13399.5,15948],[14312.1,15123], [13630.1,12722.1],[14927.9,15361.6],[14943.2,15220.9],[15658.5,14663.3],[15663.2,14166.2], [16256.9,12515.4],[17365.1,11464.7],[18684.4,11083.3],[14927.8,15360.4],[16192.9,15358], [18230.3,15977.5],[19959.8,4850.35],[18082.2,5211.08],[16399.4,6661.06],[16143.3,6951.2], [15553.2,8796.89],[14255.2,11924.2],[13137.8,8403.86],[12917.6,8265.83],[12582.7,7924.79], [13666.6,4606.77],[13870.7,4370.2],[15269.4,2432.02],[16340.1,178.734] ]; Then I use the following code to set the bridge variable: if(!isServer) exitWith {}; private _bridgePos = selectRandom eastGermanBridges; // Get a list of road segments within 10 meters of the position in the bridge array. private _roadSegArray = _bridgePos nearRoads 10; // Iterate though the list looking for a road type of bridge. { // forEach _roadSegArray private _roadInfo = getRoadInfo _x; if(_roadInfo select 8) then { bridge = _x; }; } forEach _roadSegArray; Share this post Link to post Share on other sites
Ibragim A 148 Posted September 27, 2021 Look at this: For detecting bridges, for example: getModelInfo (roadAt ASLToAGL getPosASL player); // ["bridgesea_01_f.p3d","a3\structures_f_exp\infrastructure\bridges\bridgesea_01_f.p3d",true] 1 Share this post Link to post Share on other sites