I made this script to make some random armored vehicle patrols with randomly placed waypoints and random vehicle types.
This code works perfectly most of the time but sometimes i get an error message.
Please look at attached photo.
Sorry if this looks messy but i'm not so skilled in scripting.
_eArmPatrol = _this select 0
_mbt = ["DKMM_GT12UM","DKMM_CT12UM"]
_ifv = ["VIT_BMD3","VIT_BMD3M","VIT_BMP3","VIT_BMP3_Arena"]
_ifvSe =["BTRT_A_oliv"]
_earmpatrolwpts = ["gearm1","gearm2","gearm3","gearm4","gearm5","gearm6","gearm7","gearm8","gearm9","gearm10","gearm11", "gearm12","gearm13","gearm14","gearm15","gearm16","gearm17", "gearm18","gearm19","gearm20","gearm21","gearm22","gearm23","gearm24"]
_patrolwpts = _earmpatrolwpts select random (count _earmpatrolwpts)
_eArmArray = ["BTRT_A_oliv","VIT_BMD3","VIT_BMD3M","VIT_BMP3","VIT_BMP3_Arena","DKMM_GT12UM","DKMM_CT12UM"]
_eRanArm = _eArmArray select random (count _eArmArray)
arm = _eRanArm createvehicle getMarkerPos _patrolwpts
arm2 = _eRanArm createvehicle getMarkerPos _patrolwpts
type = format ["%1",typeof arm]
? (type in _mbt) : goto "mbt"
? (type in _ifv) : goto "ifv"
? (type in _ifvSe) : goto "ifvSe"
#mbt
hint "MBT"
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm2
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm2
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm2
_eArmCount = 0
#mbtLabels
_labels = ["mbt2","loop"]
_RanLabels = _labels select random (count _labels)
goto _RanLabels
#mbt2
?(_eArmCount == 2): goto "loop"
arm = []
arm = _eRanArm createvehicle getMarkerPos _patrolwpts
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm
_eArmCount = _eArmCount + 1
goto "mbtLabels"
#ifv
hint "IFV"
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm2
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm2
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm2
_eArmCount = 0
#ifvLabels
_labels = ["ifv2","loop"]
_RanLabels = _labels select random (count _labels)
goto _RanLabels
#ifv2
?(_eArmCount == 2): goto "loop"
arm = []
arm = _eRanArm createvehicle getMarkerPos _patrolwpts
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "SERGEANT"]
ec moveincommander arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveingunner arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveindriver arm
_eArmCount = _eArmCount + 1
goto "ifvLabels"
#ifvSe
hint "IFVSE"
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveindriver arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveingunner arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveindriver arm2
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveingunner arm2
_eArmCount = 0
#ifvSeLabels
_labels = ["ifvSe2","loop"]
_RanLabels = _labels select random (count _labels)
goto _RanLabels
#ifvSe2
?(_eArmCount == 2): goto "loop"
arm = []
arm = _eRanArm createvehicle getMarkerPos _patrolwpts
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "CORPORAL"]
ec moveinDriver arm
ec = []
"SoldierECrew" createunit [getPos arm, _eArmPatrol, "ec = this", 1, "PRIVATE"]
ec moveinGunner arm
_eArmCount = _eArmCount + 1
goto "ifvSeLabels"
#loop
_earmpatrolwpts=["gearm1","gearm2","gearm3","gearm4","gearm5","gearm6","gearm7","gearm8","gearm9", "gearm10","gearm11","gearm12","gearm13","gearm14","gearm15","gearm16","gearm17","gearm18", "gearm19","gearm20","gearm21","gearm22","gearm23","gearm24"]
_patrolwpts = _earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 1] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 2] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 3] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 4] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 5] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 6] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 7] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 8] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
[_eArmPatrol, 9] setWPPos getMarkerPos _patrolwpts
_earmpatrolwpts=_earmpatrolwpts - [_patrolwpts]
_patrolwpts=_earmpatrolwpts select random (count _earmpatrolwpts)
exit