joltan 0 Posted July 16, 2002 I want to use the following script to remove all unit from an area defined by a trigger (once the trigger gets toggled). So I start this script from the trigger's on-activation field using the command line '[] exec "rvtrigger.sqs"'. But the seems to be a problem with either the "_unitlist=list trigger1" or the "_unit=_unitlist select _no" command as I always get an 'division by zero' error. What am I doing wrong? I should have an array containing the units from within the trigger, and I should be able to choose elements from within the array using the select comand. It just doesn't work... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unitlist=list trigger1 _noarray=count _unitlist _no=0 hint "start delete" ~1 #loop ~0.5 _unit=_unitlist select _no deletevehicle _unit _no=_no+1 ?(_no == _noarray):goto "end" goto "loop" #end hint "finished" exit<span id='postcolor'> Share this post Link to post Share on other sites
joltan 0 Posted July 18, 2002 Ok, solved it: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">;loop through trigger array #loop _unitlist=+(list trigger1) _noarray=count _unitlist ?(_noarray==0):goto "end" ~0.01 _unit=_unitlist select 0 deletevehicle _unit goto "loop" ;end script #end exit<span id='postcolor'> Finds all units within trigger1 and deletes them. Array is read anew each loop to catch those units leaving deleted vehicles. Dead units will not be removed by this script. Share this post Link to post Share on other sites