adamcarolan2290 0 Posted February 28, 2011 It works in any type of mission and server. ok great thanks for the reply mate Share this post Link to post Share on other sites
Karlo 10 Posted March 20, 2011 I'm not sure what you mean here, but my script does not repair vehicles. It deletes the destroyed one and creates a new of the same class and with the same name. Hello Tophe, I don't know how to program but, I have been trying to modify the following script which is used on my dedi Arma2 server so that the vehicle desertion time is about 10 minutes while the destroyed vehicle respawn time stays the same. I thought that maybe you would be knowledgeable about this type of script and that you might help me. I only assume that this is the right script to modify, which is used on my server: private ["_vehicle", "_delay", "_startpos", "_startdir", "_type", "_moved", "_disabled", "_empty"]; if (!isServer) exitWith{}; _vehicle = _this select 0; _delay = _this select 1; _startpos = getpos _vehicle; _startdir = getdir _vehicle; _type = typeof _vehicle; while {true} do { sleep (_delay + random 15); if (({alive _x} count (crew _vehicle)) == 0) then { _moved = (if (_vehicle distance _startpos > 5) then {true} else {false}); _disabled = (if (damage _vehicle > 0) then {true} else {false}); if (_disabled || _moved || !(alive _vehicle)) then { deletevehicle _vehicle; sleep 0.5; _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; }; }; }; Share this post Link to post Share on other sites
tophe 69 Posted March 20, 2011 Hello Tophe, I don't know how to program but, I have been trying to modify the following script which is used on my dedi Arma2 server so that the vehicle desertion time is about 10 minutes while the destroyed vehicle respawn time stays the same. I thought that maybe you would be knowledgeable about this type of script and that you might help me. I only assume that this is the right script to modify, which is used on my server: private ["_vehicle", "_delay", "_startpos", "_startdir", "_type", "_moved", "_disabled", "_empty"]; if (!isServer) exitWith{}; _vehicle = _this select 0; _delay = _this select 1; _startpos = getpos _vehicle; _startdir = getdir _vehicle; _type = typeof _vehicle; while {true} do { sleep (_delay + random 15); if (({alive _x} count (crew _vehicle)) == 0) then { _moved = (if (_vehicle distance _startpos > 5) then {true} else {false}); _disabled = (if (damage _vehicle > 0) then {true} else {false}); if (_disabled || _moved || !(alive _vehicle)) then { deletevehicle _vehicle; sleep 0.5; _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; }; }; }; Well, you'd need to do a lot of scripting to modify that script to do that. Not trying to sell you anything, but try my script instead. It allows you to set desertion and respawn timer individually.. amongst a lot of other things. Share this post Link to post Share on other sites
Karlo 10 Posted March 21, 2011 Well, you'd need to do a lot of scripting to modify that script to do that. Not trying to sell you anything, but try my script instead. It allows you to set desertion and respawn timer individually.. amongst a lot of other things. Thanks, I tried to adapt your script into my server script but, didn't get it to work right after a couple of hours of work so I tried fixing mine and succeeded. I plan to try you script again, when I use the Arma2 editor on other maps. Listed below is the updated script which keeps my destroyed and damaged vehicles re-spawning at a 2 minute rate while changing the abandoned(deserted) vehicle re-spawn time to about 14 minutes. The reason I wanted a longer desertion period is because sometimes I fly or drive a vehicle to near a site and get out and then, when I come back to use the vehicle, it has already returned back to the start point. // Modified by Karlo private ["_vehicle", "_delay", "_startpos", "_startdir", "_type", "_moved", "_disabled", "_empty"]; if (!isServer) exitWith{}; _vehicle = _this select 0; _delay = _this select 1; _startpos = getpos _vehicle; _startdir = getdir _vehicle; _type = typeof _vehicle; while {true} do { sleep (_delay + random 15); if (({alive _x} count (crew _vehicle)) == 0) then { _moved = (if (_vehicle distance _startpos > 5) then {true} else {false}); _disabled = (if (damage _vehicle > 0) then {true} else {false}); //Gives 12 minute delay before a deserted vehicle is returned to its //starting point if (_moved) then { sleep 700; deletevehicle _vehicle; sleep 0.5; _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; //End of 12 min delay code }; if (_disabled || !(alive _vehicle)) then { deletevehicle _vehicle; sleep 0.5; _vehicle = _type createvehicle _startpos; _vehicle setpos _startpos; _vehicle setdir _startdir; }; }; }; Share this post Link to post Share on other sites
IMNesQuik 10 Posted July 5, 2011 Great Scripting but i have one problem... i have the script working for default vehicles like a-10 ah-64D and so on but when i try a addons vehicle like the f22 or f14 f16 whatever the vehicle will not respawn after destroyed... is it possible to make such addons work Share this post Link to post Share on other sites
tophe 69 Posted July 5, 2011 Great Scripting but i have one problem...i have the script working for default vehicles like a-10 ah-64D and so on but when i try a addons vehicle like the f22 or f14 f16 whatever the vehicle will not respawn after destroyed... is it possible to make such addons work That's really weird... I've never had that problem. The script just checks for the vehicle class. Should be no difference with addons. I I have the time I'll look into it. Could you please provide download link to any of the addons that doesn't work for you. // Tophe Share this post Link to post Share on other sites
IMNesQuik 10 Posted July 5, 2011 http://www.armaholic.com/page.php?id=13378 http://www.armaholic.com/page.php?id=14287 http://www.armaholic.com/page.php?id=9624 http://www.armaholic.com/page.php?id=5900 http://www.armaholic.com/page.php?id=10181 Here are links to my addons that vehicle respawner doesnt work for... also i dont know if u have encountered this error before but i have an error that shows that i have no usmc_soldier_pilot. Share this post Link to post Share on other sites
IMNesQuik 10 Posted July 5, 2011 http://www.armaholic.com/page.php?id=10181 http://www.armaholic.com/page.php?id=5900 http://www.armaholic.com/page.php?id=14287 http://www.armaholic.com/page.php?id=13378 http://www.armaholic.com/page.php?id=9624 Those are my current problems and all the addons i have tested the script on. i dont know if u have encounter this problem but i have a problem of which my arma shows that i do not have a usmc_soldier_pilot if i have any info with that it would be amazing. I appreciate your fast reply ---------- Post added at 08:29 PM ---------- Previous post was at 08:28 PM ---------- also u dont need to dl the f22 raptor i am testing it out atm and that addon seems to be working but the others dont Share this post Link to post Share on other sites
Dte102 10 Posted August 7, 2011 (edited) Hey guys, I would like to say the script is awsome but one thing. When i use it for my domination map it says "Cannot Find vehicle.sqf" even tho i put it in the main folder. Can i get any help? Edit: Never mind, The file disapeard from my folder so i had to replace it. But i wonder why it dissapeard in the first place. Edited August 7, 2011 by Dte102 Share this post Link to post Share on other sites
kylania 568 Posted August 7, 2011 Never mind, The file disapeard from my folder so i had to replace it. But i wonder why it dissapeard in the first place. If you change the name of your mission from within the editor it creates a new folder for the mission with the new name but does not bring over any extra files you had. You'll have to copy those over from the old mission named folder. Share this post Link to post Share on other sites
Persian MO 82 Posted December 6, 2011 hey..TANX...the script is awsome...mamnon Share this post Link to post Share on other sites
BelgarionNL 10 Posted December 20, 2011 (edited) great script thx Edited December 20, 2011 by BelgarionNL Share this post Link to post Share on other sites
Officermuffin 1 Posted January 10, 2012 Love the script Tophe. I've been using it for a bit and wanted to give thanks. Skål! Share this post Link to post Share on other sites
EZJack 1 Posted February 14, 2012 So I'm attempting to use your script to re-spawn my bomb cars in a multiplayer game. I have them set to names IED1, IED2 & IED3. I'll show example for #3. They are empty cars that red team can drive, it works perfect the first time for all 3 and explodes, but on re-spawn it will not activate the script to explode. All I can think of is that it's not recognizing the re-spawned vehicle... but your script saves the INT line and vehicle name correct? I don't see why it won't work.. I've been struggling with this problem for nearly a month now, a bit new to this whole scripting business so i'm hoping for some input. Cheers and I hope someone can help. :) -EZJack Name: IED3 Vehicle Initialization: veh = [this, 120, 0, 0, TRUE, FALSE, "IED3trig attachTo [iED3,[0,0,0]]"] execVM "vehicle.sqf"; IED3trig attachTo [iED3,[0,0,0]] (I have re-spawn set to 120 for testing purposes) Trigger Scripts: Activation: Blufor, Repeatedly, Present Name: IED3trig Condition: this && IsServer On Act: _boom = "ARTY_Sh_122_WP" createVehicle (getpos IED3); _bomb = "Bo_GBU12_LGB" createVehicle (getpos IED3); Share this post Link to post Share on other sites
tophe 69 Posted February 14, 2012 Hmm... I haven't used the attachTo function anything, but it might be the problem. Just a thought... could the IED3Trig still be attached to the old object when the new is created? Even though the new object will get the same name, it will be another object, since the old is destroyed and deleted. Maybe you need to detach the trigger before attaching it again. Here's an idea. Check the position (getpos) of the trigger after the vehicle has respawned. I don't know what happens to it when the object it was attached to disappears. It might get deleted or get thrown to position 0,0,0. Share this post Link to post Share on other sites
Persian MO 82 Posted February 27, 2012 Simple Human Respawn Script!!!! maybe its work? Share this post Link to post Share on other sites
kylania 568 Posted February 27, 2012 Simple Human Respawn doesn't require a script. :) Just place a marker called respawn_west and put this in your description.ext: respawn = 3; respawnDelay = 10; Share this post Link to post Share on other sites
Persian MO 82 Posted February 28, 2012 (edited) :) ya i know it.sometime i play arma2: oa demo becas some friends haven't full game.and in demo respawn at base dosen't work so i try to find something like this... Edited November 11, 2012 by Persian MO Share this post Link to post Share on other sites
NI_Mcknight 10 Posted May 30, 2012 I get an error saying can't find "vehicle.sqf" Share this post Link to post Share on other sites
tophe 69 Posted May 30, 2012 I get an error saying can't find "vehicle.sqf" Check your file path. You have either not put the script in the right place or you're pointing to the wrong path. Share this post Link to post Share on other sites
Chairborne 2594 Posted July 10, 2012 (edited) Hi, i've been trying to get this working, my problem is a bit tricky so i'll try to be as much accurate as i can. I am running this mod: http://www.armaholic.com/page.php?id=14931&highlight=AMPHIBIOUS Along with ACE, lingor and lingor unit. So i set up all the vehicle respawns, i place 4 helos on the landing deck on top, they spawn in the game flawlessly (usually). I take a pilot, get into one UH-1Y and crash it straight in the ocean to see if the respawn script works. The first time it goes flawless, vehicle respawns in the same position, with the same direction, as i want it to. Reapeat the process and while it still respawns in the same position, the direction is set back to 0° as default (while i want it to be 90° to be alligned correctly with the other aircrafts parked). Here's what i put in the vehicle init: this setpos [getpos this select 0, getpos this select 1, 13]; veh = [this, 15, 120, 0, FALSE, FALSE, "this setpos [getpos this select 0, getpos this select 1, 13]; this setDir 90"] execVM "vehicle.sqf" As i said, the first time it works fine, the second time it does not, is it maybe due to the fact that it creates a new vehicle and doesn't keep the old init once it is destroyed again? I also thought about the collision model of the ship or something related to the engine. If this could help, i noticed that for an extremely brief time (as in 0.0001s) the vehicle spawns with 90° but then it glitches and gets oriented to 0° and spawns at like 1m above the landing deck. I've been editing for only 3 weeks so i might have missed something. EDIT: tried again with setposASL but the problem is still there, vehicle respawns just fine but not in the desired direction. Edited July 10, 2012 by AlphaSixtyOne Share this post Link to post Share on other sites
tophe 69 Posted July 12, 2012 Hi, i've been trying to get this working, my problem is a bit tricky so i'll try to be as much accurate as i can.I am running this mod: http://www.armaholic.com/page.php?id=14931&highlight=AMPHIBIOUS Along with ACE, lingor and lingor unit. So i set up all the vehicle respawns, i place 4 helos on the landing deck on top, they spawn in the game flawlessly (usually). I take a pilot, get into one UH-1Y and crash it straight in the ocean to see if the respawn script works. The first time it goes flawless, vehicle respawns in the same position, with the same direction, as i want it to. Reapeat the process and while it still respawns in the same position, the direction is set back to 0° as default (while i want it to be 90° to be alligned correctly with the other aircrafts parked). Here's what i put in the vehicle init: this setpos [getpos this select 0, getpos this select 1, 13]; veh = [this, 15, 120, 0, FALSE, FALSE, "this setpos [getpos this select 0, getpos this select 1, 13]; this setDir 90"] execVM "vehicle.sqf" As i said, the first time it works fine, the second time it does not, is it maybe due to the fact that it creates a new vehicle and doesn't keep the old init once it is destroyed again? I also thought about the collision model of the ship or something related to the engine. If this could help, i noticed that for an extremely brief time (as in 0.0001s) the vehicle spawns with 90° but then it glitches and gets oriented to 0° and spawns at like 1m above the landing deck. I've been editing for only 3 weeks so i might have missed something. EDIT: tried again with setposASL but the problem is still there, vehicle respawns just fine but not in the desired direction. Not sure why it does that. Perhaps you should try and put 90° at the default direction for the heli (in the editor). And try putting setDir 90 in the initial init as well. Share this post Link to post Share on other sites
drivetheory 10 Posted October 19, 2012 love the script Tophe, but havin some trouble with the vehicle respawn location... this is the SQF snippet i created that is giving me trouble hangar_1 = createVehicle ["Land_Mil_hangar_EP1", ([getMarkerPos "xtra_hangar_1" select 0,getMarkerPos "xtra_hangar_1" select 1,0.4]),[],0,"NONE"]; hangar_1 setDir 150; a10_one = createVehicle ["A10_US_EP1", ([getMarkerPos "a10_1" select 0,getMarkerPos "a10_1" select 1,0.4]),[],0,"NONE"]; a10_one setDir 330; a10_one setVehicleInit "veh = [this, 10, 10, 0, FALSE, FALSE] execVM ""vehicle.sqf"";"; "xtra_hangar_1" is a marker on the map where the hangar spawns in. "a10_1" is a marker on the map where the A-10 spawns in. the problem I'm experiencing is that the A-10 respawns where it crashes instead of respawning in the hanger at marker "a10_1"... i've tried to modify your script but can't quite get it right. i'd truly appreciate all help you can provide as concisely as possible- coding is definitely something im not very good at and confuses me greatly at times. thanks in advance Share this post Link to post Share on other sites
daza 36 Posted November 10, 2012 If you have a named vehicle eg. Veh1 and it is destroyed and then respawns, will the new vehicle inherit the given name from the previous one? if not, is there a way to do that? Share this post Link to post Share on other sites
kylania 568 Posted November 10, 2012 Version 1.7 keeps the name, if it had one. Share this post Link to post Share on other sites