tophe 69 Posted June 29, 2009 (edited) Hello. I'm just curious... If you have a script with loops that you run on a large amount of units. Does it matter if all units use the same "handle"? For example, could I put this in the init of, say 60 cars: car = [this] execVM "repair.sqf" Could I put the exact same init on all of them? Or should I go: car1 = [this] execVM "repair.sqf" car2 = [this] execVM "repair.sqf" car3 = [this] execVM "repair.sqf" etc. I have no need to check the handle. I just want to make sure the server doesn't get messed up or delayed because it is updating the same variable with 50 instances of the same script, simultaneously... Edited June 29, 2009 by Tophe Share this post Link to post Share on other sites
Big Dawg KS 6 Posted June 29, 2009 As long as you don't need to reference them it shouldn't matter. I do this all the time (tbh I can't imagine when I'd ever need to reference such a thing). I doubt it will mess with the server's performance. At least I've never noticed anything of the sort. Share this post Link to post Share on other sites
xeno 234 Posted June 29, 2009 First of all, as long as you don't check with a command like scriptDone if a script has ended you can use whatever handle (even the same handle name) you want. Beginning with A2 you can even use "private" variables as script handles in vehicle inits. So something like this _handle = [] execVM "somescript.sqf" in a vehicle init is totally ok now. If you start a sqf script from another script you don't even need the handle, so either [a,b,c] execVM "myscript1.sqf"; or execVM "myscript2.sqf"; is fine. Xeno Share this post Link to post Share on other sites
tophe 69 Posted June 29, 2009 Thanks! That's just what I needed to know... (even if it leaves me a bit downhearted... Now I need to find something else causing problems in my script :P ) Share this post Link to post Share on other sites
CarlGustaffa 4 Posted June 30, 2009 60 cars? You might want to consider a single script that handles all the cars instead of having 60 scripts running. Share this post Link to post Share on other sites
tophe 69 Posted June 30, 2009 I think I might have solved the problem now... Did a random sleep in the loop so that the scripts don't restart all at the same time. Works much better. Share this post Link to post Share on other sites