:help:!
Im working on a rather heavily scripted MP mission that includes AI respawning, BUT Ive run into some difficulties (and I have looked through all the posts in this forum so its not a standard question).
For background to the problem, aside from everything else in the mission - at preset intervals a random EMPTY vehicle is spawned on an island remote to the players. This is spawned using CREATE VEHICLE.
After a 10 second delay (for some reason you cant get in empty vehicles immediatley) THREE west machinegun soldiers are spawned next to it using the CREATEUNIT command.
From then there is a 20 second delay - afterwhich an ATONOV (big 72 passenger freight plane) spawns at (0,0,0) and flys towards a RANDOM location on the map. When it reaches this destination the previously created tank is SETPOS'ed to the planes position, and then is parachuted to the ground (i.e it seems like the plane just paradropped the tank). The plane then flies out to sea and is DELETEVEHICLE'd.
#####-THE PROBLEM-#####
The three AI that were spawned are supposed to get into the tank, one as commander, one as gunner, one as driver. I am using the ASSIGNASDRIVER (for the driver anyways) AND the MOVEINDRIVER command referencing to the tank, yet the AI simply REFUSE to board the tank!
BTW for those of you wondering how I am issuing commands to the spawned AI when their object name isnt returned - the CREATEUNIT command allows you to put commands in the INIT field of the spawned unit...
Here is that particular module of code for reference:
; spawn_point
; An-124Troop
#tart
hint "Enemy Vehicle Created"
_tank = "BMP" createVehicle getmarkerpos "spawn_point"
~10
"SoldierWB" createUnit [getMarkerPos "spawn_point",(group sargent_nwaps),"this assignasgunner _tank; this moveingunner _tank"]
"SoldierWB" createUnit [getMarkerPos "spawn_point",(group sargent_nwaps),"this assignascommander _tank; this moveincommander _tank"]
"SoldierWB" createUnit [getMarkerPos "spawn_point",(group sargent_nwaps),"this assignasdriver _tank; this moveindriver _tank"]
[sargent_nwaps] join grpNull
~40
[_tank, getpos a, 200, 0.1, 0, 0, 0] exec "Para.sqs"
~2
goto "tart"
exit
Sargent_nwaps is a WEST AI hidden from the players in the game... Just because I dont know how to dynamically add a group mid mission.
The SECOND problem is the lag that the mission generates. To aleviate this I made a script that scans the map for destroyed units (such as tanks, bodies, etc) and upon finding one, transports it to a remote location before DELETEVEHICLE'ing it. This script works correctly, when a person dies there is a 10 second delay before they are deleted and respawned.. Same with tanks and choppers. The problem however is not that the script doesnt function, but rather it leaves an annoying error message (division by zero error) in the corner of the screen for the entire duration of the mission, refering to this line "?(!alive (_body select _f)): [_body select _f]"
Here is the code:
_f=0
#loop
_body = list kam
_f=0
?(!alive (_body select _f)): [_body select _f] exec "killtimer.sqs"
#funk
_f=_f + 1
?(!alive (_body select _f)): [_body select _f] exec "killtimer.sqs"
?(_f <= count _body):goto "funk"
goto "loop"
kam in the above code is a trigger activated by ANYBODY, with a=11111, b=11111 (covers the whole map)
The code for killtimer is:
~5
(_this select 0) setpos [99999,99999,99999]
deletevehicle (_this select 0)
exit
Any help would be greatly appreciated
-Adam