december 0 Posted February 28, 2008 Any way to detect if a mine has been placed in a particular spot? I want an objective to be true when a player places a mine on a certain section of a road. Any ideas? Share this post Link to post Share on other sites
Dragonian 0 Posted February 28, 2008 Try one of these: SQF format: Quote[/b] ]// set position and radius of the area you want to monitor _position = getpos invisiblehelipad; _radius = 10; while{count(nearestObjects [_position, ["Mine","MineE"], _radius]) <= 0} do { sleep 0.5; }; // when the script gets here, a mine has been found SQS format: Quote[/b] ]; set position and radius of the area you want to monitor _position = getpos invisiblehelipad _radius = 10 #searchmine ?(count(nearestObjects [_position, ["Mine","MineE"], _radius]) > 0): goto "end" ~0.5 goto "searchmine" #end ; when the script gets here, a mine has been found Change the _position and _radius variables to your liking. These look for both the WEST and EAST mine. You can alter the array in the loop to just cover one of the mine types. Share this post Link to post Share on other sites
UNN 0 Posted February 28, 2008 You can also you the fired event handler. It's triggered when you Put a weapon like a satchel charge or land mine. Using nearestobject in a loop can be processor heavy, so if it's a busy mission it might be better to avoid it. Try adding this line to a soldiers init field in the editor: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This AddEventHandler ["fired",{Hint Format ["Script Params %1",_This]}] All you would need is a script that’s launched from the event, that checks for the Mine and gets the position of the unit laying it. Share this post Link to post Share on other sites
december 0 Posted March 1, 2008 Thanks for the replies guys, most appreciated. Share this post Link to post Share on other sites