Jump to content
Sign in to follow this  
Nillers

Random Deletion Script (Looping)

Recommended Posts

I've been stuck with a mission I can't finish without your guys help. I know some basic scripting but I don't want to spend days overcomplicating something if there is an easier solution. So here is the simple explanation of a script I'm going for:

Let's say there are 10 blocks. Each are called block_1, block_2, etc. Now, after every 60 seconds the script will randomly select one (1) of the blocks and delete it. Then, this script will repeat after another 60 seconds by identifying the remaining nine (9) blocks and then selecting from one of those to delete. This process will continue until only 1 block remains. There is no probability needed, it just needs to remove one block repeatedly in the given time inputted until only one remains. 

 

I did find this script posted by Dreadedentity in my searches, but it's based on a probability of each object all at once. Then even if I add a loop to that script there are times where no objects are deleted.

 

Any help would be appreciated. Thanks!

Share this post


Link to post
Share on other sites

Try maybe 

fn_deleteBlock =
{
    uiSleep 60;
    if (count _this > 1) then
    {
        deleteVehicle (_this deleteAt floor random count _this);
        _this spawn fn_deleteBlock;
    };
};

[block1,block2,...] spawn fn_deleteBlock;

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×