_Object = _this select 0
_numMines = _this select 1
_minDist = _this select 2
_maxDist = _this select 3

; Save the current coordinates
_ObjPos = GetPos _Object
_ox = _ObjPos select 0
_oy = _ObjPos select 1

_maxDistX2 = _maxDist * 2

#Update
; Get some random positions
_nx = _ox + Random(_maxDistX2) - _minDist
_ny = _oy + Random(_maxDistX2) - _minDist
; Move him
_Object move [_nx, _ny, 0]
; Wait until the object is in position
@UnitReady _Object
; Lay a mine
_Object fire ["Put", "Mine"]
_numMines = _numMines - 1
? (_numMines > 0) : goto "Update"
exit