Jump to content

RESPAWN SCRIPTS


efa

Recommended Posts

Hello,

 

I wish to revive a unit after it is destroyed, placed on the ground at its base and in a certain time.

 

Example: unit is destroyed or grounded respawn after 10 minutes of waiting. and that indefinitely!

I use scripting via MIST:

 

I create a trigger which causes the unit in question to be destroyed. This generates the following scripts:

 

if not Group.getByName('groupName') then
  mist.respawnGroup('groupName', true)
end

 

the problem is that the script does not manage the unit when the mission is carried out and repaired to its base because once the unit posed on the ground the scripts do not work.

So I try to destroy it manually but it's impossible in big missions.

 

So I would like to know how we can do to return "EITHER DESTROYED OR POSE on an airport for her respawn"

 

Someone would have a solution? thank you in advance

Link to comment
Share on other sites

THX FOR THIS.

 

I know a little MOOSE but I can not understand how we use it. I do not have the list of commands and I watched the tutorial for the installation but I hang on the ECLIPSE LDT software. So I put aside the moose.

 

How did you come to use MOOSE?

Link to comment
Share on other sites

Basically, you don't need all that Eclipse stuff if you're just modding scripts:

 

Download and install notepadd++

 

Download a demo mission here, any demo mission:

https://github.com/FlightControl-Master/MOOSE_MISSIONS/

change the miz format to .zip and unpack the file, you should find a file in there, <mission name>.lua

THIS IS THE MOOSE MISSION FILE that you can edit in notepad ++

 

 

Download moose.lua

https://github.com/FlightControl-Master/MOOSE/releases

THIS IS THE MAIN MOOSE lua file you need to load at mission start, don't edit it!!!

 

Save moose.lua in a safe place <user/yadayada/saved games/MOOSE> or something.

 

change the zip back to a miz file mission.zip to mission.miz

 

Open the mission file in the mission editor, there will be at least two trigger actions at the start, one loads moose.lua and the other will load the mission file lua, ensure that these trigger actions are pointing correctly at moose.lua (the one you downloaded) and the moose mission file.lua the one you extracted from the zip file.

 

Save the mission and then start it, it should run with MOOSE doing all the cool stuff it's scripted to do in the moose mission file.

 

If you want to change the mission you can do so by editing the <mission name.lua file> and re-saving the mission. Best to edit the lua file in notepadd++ and enable "lua" as the language. If you open it up in a normal text editor, sometimes strange things happen with line breaks and it becomes unusable.

 

I'm not going to teach you how to lua program in this post.... that's what you need to do yourself, lots of copy and paste... it's fairly straight forward to customise basic stuff using a demo mission template though...

Windows 10 64 bit | Intel i5-9600k OC 5 Ghz | RTX 2080 |VENGEANCE® LPX 32GB DDR 4 OC 3200

 

Hotas Warthog | Logitech G Flight Rudder Pedals | Track IR 4

Link to comment
Share on other sites

Thank you for your responses and your help

I already know that we must download (as mist) moose.lua but suddenly it is the commands themselves that pose a problem because the website of MOOSE is much too difficult to understand and not very intuitive.

 

I am looking for orders, I find but the website explains (or I did not find) how the writings. I make a copy paste but no more. I would need, I do not know if it exists a referential like that of MIST IN PDF.

 

It exists ?

 

I just want to create a loop indefinit when a units dies it is replaced by the same at the end of a given temp

Link to comment
Share on other sites

I just want to create a loop indefinit when a units dies it is replaced by the same at the end of a given temp

 

That does the scrupt do what i posted for the kc135.

The 2nd rule easy explained

1 unit alive every spawn with a max respawn of 20, after that script stops

It checks every 60 sec if unit number is 0 if true the a unit spawns. If the unit is alive there is no respawn.

 

3rd rule is when the unit is landed and taxied to a parking spot and completly shut down. It despawns and the script starts again for rule 2.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...

Liger zero, I'm a bit late to this party however so far your short script has helped me a lot. I'm trying to make a training mission where tankers and things like target drones and whatnot can be respawned after killed. I want to use your code from above but I need to expand it for maybe 10 units.

 

Just trying to figure out how to format that so that the code likes it with the do and end statements.

 

Another question is does this work with ground units and/or static objects?

 

Thanks!

ASUS ROG Strix X570-E MB | Ryzen 9 5950x | ASUS Tuf RTX 4080 | 64 GB G.Skill TridentZ 3600 MHz DDR4 | Samsung 970 Evo 1TB m.2 Nvme | TM Warthog HOTAS | MFG Crosswind | Track IR 5 | Gigabyte M27Q-P 1440p 165hz |

Link to comment
Share on other sites

Another question is does this work with ground units and/or static objects?

 

It won't work with statics, only with late activated AI planes and helicopters (as it's written).

 

If you want it to work with ground units as well, you need to remove the last line, so it looks like this:

 

Spawn_Object = SPAWN:New("[color="Red"]Name of the late activated group in ME[/color]")
:InitLimit( 1, 20 )
:SpawnScheduled( 60, 0 )

 

 

If you want to create this kind of SPAWN object for 10 groups, you can either copy / paste the code 9 more times (changing the group name each time) or you can use sets and for loops.

 

If you don't know lua, I recommend that you simply copy / paste the code and change group names as you go, it's simpler.

Link to comment
Share on other sites

I got this working great for aircraft. it's amazing. however, I can't get it to work on ground units. I removed the engine shutdown check and have it exactly as Hardcard shows above however after the 20 seconds I set before the script is run, the group never spawns. The group I'm testing with is four units with no waypoints. They should just spawn and sit there until killed. Following the destruction of all four, they're supposed to respawn.

 

Also following their destruction if someone had a tip for me that would remove craters/black marks from explosions on their respawn, that would be wonderful.

ASUS ROG Strix X570-E MB | Ryzen 9 5950x | ASUS Tuf RTX 4080 | 64 GB G.Skill TridentZ 3600 MHz DDR4 | Samsung 970 Evo 1TB m.2 Nvme | TM Warthog HOTAS | MFG Crosswind | Track IR 5 | Gigabyte M27Q-P 1440p 165hz |

Link to comment
Share on other sites

I can't get it to work on ground units.

 

They must be set to late activation and you must make sure that the provided group name matches exactly (do not remove the quotation marks in the script, btw).

 

Also, you must load Moose.lua before running the script, ofc, otherwise it won't work.

 

The group I'm testing with is four units with no waypoints.

 

If the group contains 4 units, then you must adjust InitLimit's first parameter accordingly:

 

Spawn_Object = SPAWN:New("[color="Red"]Name of the late activated group in ME[/color]")
:InitLimit( [color="red"]4[/color] , 20 )
:SpawnScheduled( 60, 0 )

 

If it's still not working, check your dcs.log, you're probably getting a scripting error


Edited by Hardcard
Link to comment
Share on other sites

  • 7 months later...

Hello, I'm using MOOSE and spawning or respawning Groups created in ME is ok but now I'm trying something may be a bit more complicated, at least for me that I just started to use MOOSE.

In DCS ME I've a Group of units that composes an Air Defense. Within the Group there are different Units to make the Air Defense to work properly. What I would like it happens is that when the Radars for example will be destroyed the entire group will respawn or at least the destroyed Units. I can't find the solution for it with a simple script like usually are those to Spawn Groups.

Anybody has any Idea?

Thanks

Link to comment
Share on other sites

This thread is awesome!! This is the kind of stuff we like! Straight to the point for simple scripts that you can add to your mission!!

 

They must be set to late activation and you must make sure that the provided group name matches exactly (do not remove the quotation marks in the script, btw).

 

Also, you must load Moose.lua before running the script, ofc, otherwise it won't work.

 

 

 

If the group contains 4 units, then you must adjust InitLimit's first parameter accordingly:

 

Spawn_Object = SPAWN:New("[color="Red"]Name of the late activated group in ME[/color]")

:InitLimit( [color="red"]4[/color] , 20 )
:SpawnScheduled( 60, 0 )

 

If it's still not working, check your dcs.log, you're probably getting a scripting error

 

Now how would you go about if you wanted the units to respawn, say, 60 seconds after it triggers (add. 60 second delay)

 

Thanks!!

Link to comment
Share on other sites

Hello, I'm using MOOSE and spawning or respawning Groups created in ME is ok but now I'm trying something may be a bit more complicated, at least for me that I just started to use MOOSE.

In DCS ME I've a Group of units that composes an Air Defense. Within the Group there are different Units to make the Air Defense to work properly. What I would like it happens is that when the Radars for example will be destroyed the entire group will respawn or at least the destroyed Units. I can't find the solution for it with a simple script like usually are those to Spawn Groups.

Anybody has any Idea?

Thanks

 

Hello, I found by myself the way to do what I was looking for with this script:

 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 

AD1 = GROUP:FindByName( "AirDefense1" )

 

RespZoneAD1 = ZONE:New( "RespZoneAD1" )

 

AD1:InitZone( RespZoneAD1 )

 

Radar3 = UNIT:FindByName( "Radar 3" )

 

AD1:HandleEvent( EVENTS.Dead )

function AD1:OnEventDead(EventData)

if Radar3:IsAlive() == false

then

AD1:Respawn():MessageToAll( "AD1 Respawned", 5, "ATTENTION" )

end

end

 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 

This script takes the Group spawned without Late Activation in DCS so that's why it starts looking for the GROUP.

But lat's say now I want to change this, I want to put a Late Activation, how should I change this script? I tried removing GROUP:FindByName() and used AD1 = SPAWN:New( "AirDefense1" ) and after that I spawned using AD1:Spawn(). The Group spawns but it doesn't Respawn once Radar1 is destroyed. May be I can't use :Respawn() because so far if I understoopd :Respawn() you use for groups are already spawned by DCS.

I'm asking this also because if I use AD1 = SPAWN:New( "AirDefense1" ) I can also use other :Init.…() commands.

I think I'm making a bit of confusion but I stared only few days ago to explore MOOSE and LUA. Sometime I'm confused on how to put toghether the script I write and DCS mission or how to put more scripts together or when to use local in front a variable or not. In many example a lot of time has not been used in other yes... If someone can give some clarification about all this would be appreciated.

Thanks

Link to comment
Share on other sites

  • Recently Browsing   0 members

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