Here I am once again seeking the advice of the masters
I am trying to create a random vehicle (and personnel) traffic generation system. So far I have been able to spawn random vehicles and drivers, get drivers into the vehicles, get the vehicles to move to some random selected checkpoints and then to move to a "delete point" (a trigger that runs script). And that is where I run into problems. I can't seem to crack the code on deleting the vehicles AND the drivers. The vehicles will make it all the way to the delete points (rdp) but only the first vehicle into the trigger is deleted, but not the driver. And then, any subsequent vehicles into the delete point trigger are not deleted at all. Here are the scripts and settings I'm using. Any help and hints would be greatly appreciated.
Lines from the init.sqs;-------------------------
traf1 = False
publicVariable "traf1"
;max vehicles to create
rtrafmax = 10
;available vehicle array
rtrafv = ["Mini","Trabant","Skoda","SkodaRed","Bus","Jawa","TruckV3SCivil","SkodaBlue","SkodaGreen","JeepPolice"]
;available driver array
rtrafd = ["Civilian5","Civilian2","Civilian3","Civilian4","Civilian6"]
;random start point array
rtrafsp = [rsp1,rsp2,rsp3,rsp4]
;random checkpoint array
rtrafcp = [rcp1,rcp2,rcp3,rcp4,rcp5]
;random delete point array
rtrafdp = [rdp1,rdp2,rdp3,rdp4,rdp5]
;maximum number of checkpoint before delete point is determined
rtrafcpmax = 2
;-------------------------
Script that creates vehicle and driverscreate_rtraf.sqs ^^^^^^^^^^^^^^^^
; *****************************************************
; ** Operation Flashpoint Script File
; *****************************************************
?! (local server): exit
_rtraf = 0
_rtrafm = rtrafmax
;-------------------------
traf1 = True
publicVariable "traf1"
;-------------------------
#start
? _rtraf >= _rtrafm : goto "exit"
;get_rspos
_pos = rtrafsp select(random 3)
_rspos = getpos _pos
_dir = getdir _pos
;create_vehicle
_rv = rtrafv select (random 9)
rv = _rv CreateVehicle _rspos
rv setdir _dir
;create_driver
_rdvr = rtrafd select (random 4)
_d1 = _rdvr createunit [_rspos, dvrs, "this moveindriver rv; dv = driver rv; [this] exec {rtraf\move_to_rcp.sqs}", 1.0, "Sergeant"]
;[this] join grpnull
dv = null
rv = null
;count loop
~2
_rtraf = _rtraf + 1
goto "start"
#exit
exit
^^^^^^^^^^^^^^^^
Script that moves vehicles to random checkpoints (rcp) and then on to delete point (rdp)move_to_rcp.sqs^^^^^^^^^^^^^^^^
; ********************************************************
; ** Operation Flashpoint Script File
; ++ Based on the "dynwp_object.sqs" by Kane and SnYpir ++
; ** called from "create_traf.sqs"
; ********************************************************
?! (local server): exit
;move_to_waypoint - get_rcpos
_trv = _this select 0
_cp = 0
_cpmax = rtrafcpmax
#rcp_loop
_cpos = rtrafcp select(random 4)
_rcpos = getpos _cpos
_trv domove _rcpos
@ unitready _trv
~0.1
_cp = _cp + 1
? _cp >= _cpmax : goto "to_rdp"
goto "rcp_loop"
#to_rdp
_crdp = rtrafdp select (random 4)
_rdpos = getpos _crdp
_trv domove _rdpos
~0.1
exit
^^^^^^^^^^^^^^^^
Script that is supposed to delete vehicle and driver in delete point triggertrig_delete.sqs^^^^^^^^^^^^^^^^
; *****************************************************
; ** Operation Flashpoint Script File
; ** usage [trigname] exec "trig_delete.sqs"
; *****************************************************
?! (local server): exit
_trigger = _this Select 0
_delist = list _trigger
_i = 0
#loop
_unit = (_delist select _i)
{deletevehicle _x} foreach _units
_i = _i +1
?!(_i==count _delist):goto "loop"
exit
^^^^^^^^^^^^^^^^
Trigger settings^^^^^^^^^^^^^^^^
Civilian repeatedly
present
Type: none
Name: deltrig4
condition: this
on activation: [deltrig4] exec "rtraf\trig_delete.sqs"