josh-109 Posted November 21, 2020 Posted November 21, 2020 hello im after away to respawn a unit/group if they have been despawn. with out making tones of copys of the same unit and respawning the copy units?
dorianR666 Posted November 23, 2020 Posted November 23, 2020 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.luaclone.miz CPU: AMD Ryzen 5 1600X GPU: AMD RX 580
dorianR666 Posted November 23, 2020 Posted November 23, 2020 This video and miz might demonstrate it better. There is only one heli in the mission editor. When something kills it, it respawns again. clone2.miz CPU: AMD Ryzen 5 1600X GPU: AMD RX 580
strikers_blade Posted May 5, 2021 Posted May 5, 2021 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
Recommended Posts