Jump to content
Nutzgo

Keeping Vehicle Inventory on Respawn

Recommended Posts

Making a convoi-mission, where the players drive vehicles.
I've removed the inventory from the vehicle in Eden, and made some custom inventory in them. I've also removed 50% of fuel and ammo. And third, I've added 10 spare tires with ace3 in each vehicle. I've made checkpoints, so when the players reach a defined destination, a new respawn appears there. 

Thing is, I want the vehicles to retain the loadout and settings when they respawn. If say vehicle 1 is destroyed mid-mission; I want it to a) respawn at the defined respawn location, and b) have the same loadout which it had at mission start. 
I also dont want to trigger the new respawn locations before the players enter that specific area. 

When using the Vehicle Respawn Module, it respawns at my location, but the vehicle inventory is the standard inventory for that vehicle (as if I had placed it in Zeus, e.g.). The vehicle also has 100% fuel, 100% ammo, and no spare tires. 

I've tried using the Light Advanced Vehicle Respawn, but the vehicle only respawns at positon of death. I'm not that good with coding to add a function to define respawn locations.

Anyone know how?

Share this post


Link to post
Share on other sites

You don't need to respawn. There is another way.

Create your car with it's load out. Name it  car1.   Use copy and paste and create a second car. Name it car2.

Place  car2   in an out of the way place on the other side of the island.

Place a small stone on the map and name it  stone1

Create a trigger with the command   car2   setpos   getpos  stone1

So, instead of a respawn, you are simply moving an existing car to the location of choice with the load out you desire.

 

 

 

Share this post


Link to post
Share on other sites

Thought of that. Could also use hide/show with triggers that fire if the specific vehicle dies. But I have five cars, and three check points. So if I want to give the boys one car per check point, I have to place 15 cars.. 😛 I dunno, it could work, but could also be a bit demanding for the server? I could also just deep copy with zeus and teleport cars if need be. 

Share this post


Link to post
Share on other sites
47 minutes ago, pierremgi said:

Or use a script already on forum. Exists also as module.


Allright, I'll give this a shot. Help me break this down, as I am not very skilled in this matter. I want to use your second script. 
I'll copy/paste the script into initServer.sqf.


I understand that the bottom line in the script is parameters, right? Here is how I understand it:

  • I have five cars, named "car1", "car2", "car3", "car4" and "car5". 
  • They all have the same respawn location (a marker called "vehicle_respawn"), that moves to a new location when a trigger is fired
  • I want the respawn time to be 10 seconds
  • I dont want the vehicle to respawn if disabled and abandoned (so that the players can jump out and repair it)
  • I dont want other empty vehicles to respawn 
0 = [[car1, car2, car3, car4, car5],["vehicle_respawn"],10,false,false] spawn MGI_fnc_VehicleRespawn;

Is this the correct setup?

Share this post


Link to post
Share on other sites

pierremgi: It works almost perfectly. Tested in SP editor now.

  • I took out some bandages, epis, morphine and blood bags (Ace3 medical), and destroyed the vehicle a third time. All bandages, epis, morphine and blood were gone, but weapons and ammo still was there. 
  • Vehicle init is not kept. I have flags attached to the vehicles, these does not respawn (not a big problem really)
  • Ace cargo is not kept. Vehicles have 10 spare tires from mission start. When vehicle respawns, cargo is reset, so the vehicles have the standard 2 spare tires.

Share this post


Link to post
Share on other sites

These respawn scripts are supposed to save, weapons, magazines, items and backpacks + whole stuff inside backpacks  in case of players place their own things in vehicles' crate.

For ACE, i don't know how work the inventory, especially for things like extra tires. The flags are my bad. Perhaps there is some easy thing to do.

For Ace, I guess there are some dedicated variables. I don't use this mod because most of time, I'm scripting for vanilla and this mod is too advanced. I can't guarantee a compatibility. (In my mind, this mod should be integrated in Vanilla. This way, that could be a winner/winner improvement for everyone). I'm closing this parenthesis.

Thanks for your feedback. I'll probably rewrite a little bit my codes with more options.

NOTE: always test destruction with weaponry. Don't apply damage by script only (some EH will not fire and there will be some missing behavior. Test as you play.

  • Thanks 1

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

×