Jump to content

How to respawn a unit/group if they have been despawn?


Recommended Posts

I dont know what you mean by "despawn". However you can clone groups, even after they died, which serves the same purpose as respawn. Here is a little simple script i wrote that you could use. It clones any group as it is specified in the mission editor, with all its attributes (loadout, flight plan, ...). Works for planes, helis, vehicles and ships.

 

Here is how you use it.

Create new mission trigger of type "Mission start" and add trigger action "Do script file", in which you select the attached Lua file.

Then you can clone any group with trigger action "Do script" with following text in the window:

local data = ddf_clone_find("Original group name", true)
ddf_clone(data)

The first line finds the group as it is specified in mission editor, the second line spawns it. You could modify the group's attributes (say, bort number) by modifying the "data" variable inbetween the two lines, but that would be a bit more advanced scripting.

Replace "Original group name" with the name of the group you want to clone.

The second argument tells the script whether to assign the clone a new unique name and ID. If you put "true" there, DCS will consider the clone group as unrelated to the original group. If you put "false" there, DCS will consider the clone group to actually be the original group, in regards to mission triggers. With "false", mission triggers referencing the original group will still react to the clone group. With "true", they will not. Avoid using the code with "false" if the original group is still alive (or still in late activation), it might have unintended consequences. Also, if the original group is late activated, the clone will spawn regardless, no need to worry about that.

 

I attach an example miz and video demonstrating this script, where groups are being cloned every 2 seconds. In your mission, you could for example put a trigger that waits for a group to die, which would then call this code, to respawn the group.

ddf_clone.lua

clone.miz

CPU: AMD Ryzen 5 1600X

GPU: AMD RX 580

Link to comment
Share on other sites

  • 5 months later...
On 11/23/2020 at 2:24 PM, HungryCoyote said:

mist.respawnGroup('Sa-10', true)

If the unit dies yes...but if you deactivate or, explode or destroy the unit, the mist.respawnGroup will not work....unless I am doing something wrong.

My systems:

 

Windows 10 64 bits

I7-8700k

32.0 GB RAM

500Gb SSD

Asus ROG 2080ti

HP Reverb

 

Windows 10 64 bits

I7-6820HQ CPU @ 2.70Ghz

32.0 GB RAM

500Gb SSD

Nvidia Quadro M4000M

TrackIR 5

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...