Stuntman 0 Posted September 21, 2008 Hello guys. I'm using a vehicle respawn script in a MP mission I'm making. Its ported from OFP. Its not the built in ArmA script, because in my script every individual vehicle will respawn at its starting position. My problem is, when there are more than me on a dedicated server, the vehicles respawn more than once. If there are 5 people on, 5 bmp's respawn for example. What can I do to prevent this to happen? I'm not on my mission pc right now, so if you need the script receipt, please tell me and I'll get that posted. Thanks in advance! Share this post Link to post Share on other sites
Rav_Raven 8 Posted September 21, 2008 You respawn script must be run only in server, not in each client. Share this post Link to post Share on other sites
celery 8 Posted September 21, 2008 You respawn script must be run only in server, not in each client. Yup, there should be an ?!isserver:exit check at the start of the script. Share this post Link to post Share on other sites
Stuntman 0 Posted September 23, 2008 Thanks mates! I will try that right now. Share this post Link to post Share on other sites
Stuntman 0 Posted September 25, 2008 Sadly it did not work. The vehicles still respawn more than once. I hope you can help me here, I will write how its set up- This is how I have set the script to work: in the init file of every empty vehicle, I write <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this, xxx] exec "vehciles.sqs" xxx is the amount of time in seconds before they respawn. "vehicles.sqs" is the respawn script file located in the mission folder. Some of the vehicles respawn at 10, some at 300, some at 180 etc. This is how the script looks like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?!isserver:exit ~2 _vcl = _this select 0 _vcltype = typeof _vcl _vcldir = getdir _vcl _vclpos = getpos _vcl _delay = _this select 1 #alive ?! alive _vcl:goto "notalive" ~1 goto "alive" #notalive ~_delay deletevehicle _vcl ~1 _vcl = _vcltype createvehicle _vclpos _vcl setdir _vcldir goto "alive" Is this information helpful enough? Is the script maybe wrong or something wrongly placed? Hope you guys can help me here! Share this post Link to post Share on other sites
[frl]myke 14 Posted September 25, 2008 Can't say exactly whats wrong there but i've wrote an own respawn script. It is in sqf and should be a little more CPU friendly. vehicle_respawn.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (! isServer) exitwith {}; sleep 2; _vehicle = _this select 0; _delay = _this select 1; _numbers = _this select 2; _counter = 0; _veh_type = typeof _vehicle; _veh_pos = getpos _vehicle; _veh_dir = getdir _vehicle; while {_counter != _numbers} do { Â Â Â Â while {alive _vehicle} do {sleep 1}; Â Â Â Â sleep ((_delay/5)*4); Â Â Â Â deletevehicle _vehicle; Â Â Â Â sleep (_delay / 5); Â Â Â Â _vehicle = _veh_type createvehicle _veh_pos; Â Â Â Â _vehicle setdir _veh_dir; Â Â Â Â _counter = _counter + 1; }; Call this script from the initline as you did before: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> nul = [this, 50, -1] execVM "vehicle_respawn.sqf" I've added a third parameter to make limited respawns. If you set -1 it is unlimited, else just insert the number of times the vehicle should respawn (i.e. 5 will let the vehicle 5 times). Hope this helps and you get your problem solved. Myke out Share this post Link to post Share on other sites
Stuntman 0 Posted September 25, 2008 Thanks a lot pal! I will give you a message if it does or does not work. Share this post Link to post Share on other sites
Stuntman 0 Posted September 25, 2008 The script works, but after intense respawn tests, its starting to bug out after 3 mins. I will try to say it as clear as possible: they respawn in order again and again. But after 3 minutes of respawning right after each other, they suddenly start to respawn at a random time. Its respawning multiple vehciles at the same time....but one at the correct time and the rest at a random time. This continues to happen; if we blow one tank up, one will respawn at correct time....and one will do it in random time afterwards. In the end we got like 4 tanks at one respawn point, and if we destroy on of those 4 tanks, they stack up etc. Is this an ArmA limitation? Share this post Link to post Share on other sites
[frl]myke 14 Posted September 25, 2008 Odd things happen to you, mate. Let's see if it is really only running on the server. Please edit the script like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (! isServer) exitwith {}; hint "You shouldn't see this"; sleep 2; It's one line added. After changing this, do some more tests. Unless someone is hosting (means, you don't play on dedicated) then no one should see the message. If someone hosts, only this player should see the message. And, if possible, please watch if - a player was/is in the killed vehicle - if several players where in the vehicle, does the too many respawned vehicles correspond with players that where in the vehicle. Probably not easy to track but i have an idea what it could be. So those info would help to verify if i'm right or wrong. Share this post Link to post Share on other sites
Stuntman 0 Posted September 26, 2008 Going to test it out. Btw, I forgot to tell you that I have both the custom script for empty vehicles (target practise) and the built in arma vehicle respawn script for some other tanks spread around. in the description.ext I have "respawnVehicleDelay = 180;" So I wonder if that built in script for some odd reason conflicts with the custom script? Share this post Link to post Share on other sites
Stuntman 0 Posted September 26, 2008 Didnt get any such hint message on a dedicated, but respawn still bugged. You have any idea? Is it conflicting with arma respawn script? Annoyingly even with very little respawn, that I only killed the tragets 2 times or so, they still after some time respawn multiple times at random times. Share this post Link to post Share on other sites
[frl]myke 14 Posted September 26, 2008 It would help to track down the problems if you would test the script without any other respawn stuff. If problems occure, it's always a good idea to watch if all components work for themselves and then adding one by one to the mission. As soon it start bugging, you may guess what does interfere with eachother. Share this post Link to post Share on other sites
wld427 1705 Posted September 28, 2008 just thought did you place a game logic trigger? that solved my multiple respawn issue Share this post Link to post Share on other sites
{USI}_Zombie 0 Posted September 28, 2008 just  thought did you place a game logic trigger?that solved my multiple respawn issue yep, I'm not sure if it is still needed, but I got in the habit long ago of putting a game logic named server somewhere on the map, seemed to always eliminate troubles and even if not needed now, it doesn't cause any troubles. Share this post Link to post Share on other sites
Stuntman 0 Posted September 28, 2008 that game logic is in there yes..... Share this post Link to post Share on other sites