Jump to content

AI respawn auto on death


Delta59R

Recommended Posts

In mission editor I am trying to set up where upon the death of a unit it will auto respawn. This is what I have setup but it doesn't work.

 

 

- Group-A is a single F-18

so

- Triggers= once

- Conditions=Group alive less than =(Group-A (1)

- Actions=Activate (Group-A)

 

 

The way I read this,

One time, every time there is less than 1 of (Group-A) ie (0 or Dead) a new Group A is Activated 1 time.

 

 

What am I doing wrong here? Thanks

Meshify C w Noctua Fans, MSI Carbon Z790, 13900KS, 64gb 7200 Gskill, MSI 4090, MSI 240, Sam 1tb m2, Sam 512 m2, Seasonic 1000w, MSFF2 Stick + X56 Throttle, HP Reverb G2, Sony 83in A90J OLED

Link to comment
Share on other sites

Hey!

 

Group alive less than is in %, so you should change it to less than 100%. Or better still: Group Dead. Also if you want it to work more than once, you should change the condition to SWITCHED type.

 

Even with all that said IIRC you cannot respawn the same group numerous times - but I might be wrong here, haven’t tried it for quite some time. The way out would be a series of triggers for seemingly same groups (A, B, C etc) spawning in the same place where previous one is killed.

ce535d_9d347b62819c4372b3c485a4f95d2004~mv2.png
Link to comment
Share on other sites

Hey!

 

Group alive less than is in %, so you should change it to less than 100%. Or better still: Group Dead. Also if you want it to work more than once, you should change the condition to SWITCHED type.

 

Even with all that said IIRC you cannot respawn the same group numerous times - but I might be wrong here, haven’t tried it for quite some time. The way out would be a series of triggers for seemingly same groups (A, B, C etc) spawning in the same place where previous one is killed.

 

 

 

 

Thank you! Ok I will try a few things. I'm guessing if it cant work like that it is likely because a mission is not too much unlike real life. In real life we cant bring the dead back to life but we can order someone else to take their place! :)

Meshify C w Noctua Fans, MSI Carbon Z790, 13900KS, 64gb 7200 Gskill, MSI 4090, MSI 240, Sam 1tb m2, Sam 512 m2, Seasonic 1000w, MSFF2 Stick + X56 Throttle, HP Reverb G2, Sony 83in A90J OLED

Link to comment
Share on other sites

This can be accomplished using either MiST or MOOSE if you're not scared of venturing into .lua land.

 

In MiST the function to respawn a group is:

mist.respawnGroup('groupname', true)

In MOOSE you can do some sneaky stuff and automatically set it to respawn the group whenever the first is destroyed, lands, or shuts their engine down. This example respawns the group whenever it detects it doesn't exist in the game world any longer (such as after being destroyed)

Spawn_Plane_Limited_Repeat = SPAWN:New( "GROUPNAME" ):Limit( 1, 1 ):InitRepeat():Spawn()

 

You can read more about MiST HERE and HERE and see some videos on spawning units with MOOSE HERE and

 

If you puckered up looking at those two lines of code, you can brute force it with as many groups as you're willing to write triggers for in the method BD described. :thumbup:


Edited by feefifofum
  • Like 1
Link to comment
Share on other sites

This can be accomplished using either MiST or MOOSE if you're not scared of venturing into .lua land.

 

In MiST the function to respawn a group is:

mist.respawnGroup('groupname', true)

In MOOSE you can do some sneaky stuff and automatically set it to respawn the group whenever the first is destroyed, lands, or shuts their engine down. This example respawns the group whenever it detects it doesn't exist in the game world any longer (such as after being destroyed)

Spawn_Plane_Limited_Repeat = SPAWN:New( "GROUPNAME" ):Limit( 1, 1 ):InitRepeat():Spawn()

You can read more about MiST HERE and HERE and see some videos on spawning units with MOOSE HERE and

 

If you puckered up looking at those two lines of code, you can brute force it with as many groups as you're willing to write triggers for in the method BD described. :thumbup:

Thank you!

Meshify C w Noctua Fans, MSI Carbon Z790, 13900KS, 64gb 7200 Gskill, MSI 4090, MSI 240, Sam 1tb m2, Sam 512 m2, Seasonic 1000w, MSFF2 Stick + X56 Throttle, HP Reverb G2, Sony 83in A90J OLED

Link to comment
Share on other sites

I was able to follow this and it worked great.

There is a simple solution for you with MIST, here let's say you want to make a MiG-23 to fight you and respawn when you killed him and so on.

 

In the editor place the enemy mig group add the flight path and all (for some reason the script works if there is 1 unit per group so don't put 2 units in one group or the group will spawn but do nothing .. just fly. If you want to add 2 migs add 2 groups) i will name the mig group for this example mig1

 

Go to scripts and make the first script MIST activation TYPE - mission start | CONDITIONS - none or time less than x | ACTIONS - do script file (last version of MIST.lua)

 

Now make the respawn script for the mig group

 

TYPE - continuous action | CONDITIONS - none | ACTIONS - do script (add this)

 

if not Group.getByName('mig1') then

mist.respawnGroup('mig1', true)

end

 

DONE

 

Another thing , do not use later activation on the units you want to respawn (or else they will just do nothing just like if you add more than 1 unit per group)

Save and try it .. to all ppl around here if this is a horrible way please don't swear me or anything i'm a scripting NOOB so ...

 

 

Now I have to figure out how to keep them from landing at base bc if they do they become invincible for some reason.

Meshify C w Noctua Fans, MSI Carbon Z790, 13900KS, 64gb 7200 Gskill, MSI 4090, MSI 240, Sam 1tb m2, Sam 512 m2, Seasonic 1000w, MSFF2 Stick + X56 Throttle, HP Reverb G2, Sony 83in A90J OLED

Link to comment
Share on other sites

  • 11 months later...

:wallbash: Why?! why why why? :disgust:

 

Management Summary:

DCS thinks the group re-spawned through MIST is still dead.

 

TRIGGERS

TYPE: 2 REPETITIVE ACTION

NAME: Mig 51 Rebirth

EVENT: NO EVENT

 

CONDITIONS

TYPE: GROUP DEAD

GROUP: 51 The Mig

 

ACTIONS

ACTION: DO SCRIPT

TEXT: if not Group.getByName('51 The Mig') then

mist.respawnGroup('51 The Mig', true)

end

 

ACTION: SET FLAG VALUE

FLAG: 131

VALUE: 0

 

ACTION: SET FLAG VALUE

FLAG: 132

VALUE: 1

 

ACTION: SOUND TO ALL

FILE: 1:OGG

START DELAY: 0

 

The MIST script works in as far as that it recognizes when '51 The Mig' is alive, whether initially, or through the script respawning it. However the ME CONDITIONS: TYPE: GROUP DEAD, GROUP: 51 The Mig doesn't recognize the respawned group as being alive and the condition evaluates as 'true' every time.

 

The only thing I can think of that might work, would be to remove the GROUP DEAD condition and add the setting of a flag to 'true' or '1' inside the MIST script, so that I can trigger the other things that need to be done when the group is respawned.

 

How can I do this?

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Link to comment
Share on other sites

When you get into infinite respawns you need to divorce yourself from the GUI functions. Once you've recreated a group, it is no longer the original aircraft referenced and as such any triggers written in the GUI revolving around the activities of that group will no longer function.

 

If you need to specifically check that a particular dynamically spaned group exists, you'll need to fully write the solution in .lua

 

If you have a relatively simple environment you can still potentially work around the GUI by checking for things like ALL OF COALITION OUT OF ZONE.

Link to comment
Share on other sites

Thanks for the answer FFF.

 

MIST can set flags too though, I've seen, or are those MIST(flags) and not really DCS flags?

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Link to comment
Share on other sites

They are one and the same; you'll still be able to access user flags set through MiST with the GUI, since you can reference those before they exist. Unfortunately because you have to select your groups/units from drop down menus in the GUI, you can't grab your dynamically spawned units except via scripting.

Link to comment
Share on other sites

When you say GUI, I'm guessing you mean scripting created through the ME, correct? So the ME as a tool allows you to create and manipulate the group, but in the end, it actually just generates scripting which the DCS Engine reads and executes.

 

Okay, I understand that for whatever technical reasons DCS doesn't recognize a group "respawned" through MIST scripting, but MIST plays well in the other direction I'm guessing, so that TRIGGERED ACTIONS I've added to the "original" group through the ME are still accessible to MIST, even if the group is respawned, correct?

 

Can I the do AI-Push-Task through MUST? Also if the "original" group is still alive?

 

This would allow me to use MIST to monitor the group (DCS gives the respawned group a cold shoulder) and DCS to manage radio items, show messages, and play sounds, or can I do those directly in MIST too? (maybe I can do everything in MIST?)

When you hit the wrong button on take-off

hwl7xqL.gif

System Specs.

Spoiler
System board: MSI X670E ACE Memory: 64GB DDR5-6000 G.Skill Ripjaw System disk: Crucial P5 M.2 2TB
CPU: AMD Ryzen 7 7800X3D PSU: Corsair HX1200 PSU Monitor: ASUS MG279Q, 27"
CPU cooling: Noctua NH-D15S Graphics card: MSI RTX 3090Ti SuprimX VR: Oculus Rift CV1
 
Link to comment
Share on other sites

@Habu one will automatically repeat each time the plane dies (initRepeat) the other will only spawn the plane once each time you run Spawn()

 

@Orso yes, I think, but you'd need to do some digging. You wouldn't be looking for something in MiST but the native SSE. The SSE documentation on Hoggit is probably a good place to start.

 

The GUI (Graphic User Interface) in the editor generates .lua code read by the SSE...i.e. FLAG ON (1) in the GUI could also be achieved by running the script "trigger.action.setUserFlag (1,1)'

 

MiST and MOOSE are an expanded set of functions to make writing code faster that you'd otherwise have to brute force a bunch of basic SSE .lua to achieve.


Edited by feefifofum
Link to comment
Share on other sites

MOOSE or MIST

 

Yep, this is perfect for MOOSE or MIST lua scripting - it is worth learning for sure.

ChuckIV

"Never in the field of human conflict was so much owed by so many to so few." Winston Churchill

 

SYSTEM:

Processor - Intel® Core i9-9900KF CPU @ 3.60GHz 3600MHz water-cooled

Installed memory (RAM) - 32.0 GB

64-bit Operating System, x64-based processor

Windows 10 & DCS on SSD

Video Card - water-cooled NVIDIA GeForce RTX 2080 Ti

Internet: Cable 200Mbps 12Mbps

Link to comment
Share on other sites

  • Recently Browsing   0 members

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