Jump to content

Unit respawn


VapoR

Recommended Posts

Sorry if this has been discussed before, I had no luck with searches.

 

Is there a way to make a unit respawn after destruction? What I'm trying to do is have SAM coverage over certain areas. If those SAMs are destroyed I'd like to have them respawn a set amount of time after destruction (30 minutes or so).

 

Is this possible?

 

Thanks for your help!

Link to comment
Share on other sites

Make the first group. Make a second, or more, group with Copy & Paste (Cntrl-C, Cnrl-V). The second, third, .., groups have Late Activation checked.

 

Set up an event for the first group - Group Is Dead, or Alive Less Than, whatever you want... Set a flag.

 

Then set up an event with Time Since Flag to activate the second group.

 

^^^ These kind of events can be cascaded to activate a third, fourth, how ever many new spawn groups you want.

 

---

 

You cannot re-spawn a dead group.

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Link to comment
Share on other sites

http://forums.eagle.ru/showthread.php?t=106234 and of course mist v2.

 

Simply add a switched condition trigger

Condition: LUA predicate (if not Group.getByName('whateverIsGroupName') then

return true end)

Action: Do Script (sct.respawnGroup('whateverIsGroupName', true))

 

I'm in the process of embedding all of the sct scripts into mist v3, so sooner rather than later it will be all in just one script file.

 

 

 

Note that makes the entire group respawn once the entire group is dead. We can't respawn a single unit in a group without respawning the entire group. But if you want a "group alive less than" sort of condition with the script it is easy enough to code.


Edited by Grimes

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Are all the 'properties' of the re-spawned group still valid - waypoints, Triggered Actions, etc? Or does the group get re-spawned like a group template - a blank slate?

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Link to comment
Share on other sites

the respawnGroup function takes all of the group information and creates a new group. Because it is re-using the groupId, unitId, etc the older groups will completely de-spawn from the mission. The 2nd variable in the function, if present, re-assigns the groups default waypoints and tasks.

 

Keep in mind, triggers like "group dead" don't work with dynamically spawned groups, you have to use the lua predicate condition and write out code to figure out if it needs to respawn the group or not.

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Ok so basically there are 2 options for respawning: creating additional hidden groups and have them appear with triggers or mess with the scripting code to completely respawn an existing unit.

 

While the scripting language is currently beyond my understanding, I will give it a try to learn it. Sure would be easiest if there was just a checkbox for "Respawn if destroyed" then a time box would open up! ED are you listening? ED??? :P

 

So this brings the question: Which version would be the least resource-hungry? I'm building a large MP mission which is intended to be populated for about 14 hours (unless one coalition wins). So over such a large time period I am worried about triggers eating up CPU cycles and such.

Link to comment
Share on other sites

http://forums.eagle.ru/showthread.php?t=106234 and of course mist v2.

 

Simply add a switched condition trigger

Condition: LUA predicate (if not Group.getByName('whateverIsGroupName') then

return true end)

Action: Do Script (sct.respawnGroup('whateverIsGroupName', true))

 

I'm in the process of embedding all of the sct scripts into mist v3, so sooner rather than later it will be all in just one script file.

 

 

 

Note that makes the entire group respawn once the entire group is dead. We can't respawn a single unit in a group without respawning the entire group. But if you want a "group alive less than" sort of condition with the script it is easy enough to code.

 

To get them to reappear after 30 minutes, make the action this:

mist.scheduleFunction(sct.respawnGroup, {'whateverIsGroupName', true}, timer.getTime() + 1800)

 

1800 being the amount of seconds after which the action shall occur

 

I don't see any reason to worry about CPU time for scripts. I have built missions with extensive use of scripts and not had issues with it.


Edited by St3v3f

aka: Baron

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

The idea behind mist/sct is to make it easier to get into scripting by creating general purpose functions that have relatively few input variables which end up doing most of the work for you. The ability to add dynamically spawned groups was added fairly recently, and I have no idea when if ever it will be added directly to triggers.

 

Just to echo what St3v3f said, you will only see lag caused by mission scripting if you have written a VERY intensive code that has to run for a lot of objects, and extremely often. Even if you do end up writing code that will lag the game, there are ways to optimize it, for instance utilizing co-routines.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

So this brings the question: Which version would be the least resource-hungry? I'm building a large MP mission which is intended to be populated for about 14 hours (unless one coalition wins). So over such a large time period I am worried about triggers eating up CPU cycles and such.

 

I use scripts mostly to identify when a certain type of unit is in a zone. Everything else I do uses the traditional events with conditions and actions. I have extensive missions that can easily last 40-50 hours until the victory conditions are achieved. I do not bother to set the event type, like 'On Destroy', 'On Shot', etc. (<-- I do a lot of duplicating events and these types have cause me grief.) I don't seem to have issues with lag or stutter due to the events.

 

I find that troubleshooting the events is not too bad. If I can't make something work right with events then the guys here do offer some really neato solutions with the scripting approach.

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Link to comment
Share on other sites

@Wrecking Crew: I would love to see your missions that can last 40-50 hours! Is there a server that hosts them? Are you using AI flights to supplement the clients?

 

The mission I'm currently building is using the entire map. There will be a long and well defined FLOT as well as long and medium range SAM coverage over friendly territory (lacking in most MP servers, makes for no safe haven for mud movers). I intend to have random AI flights of all types throughout the duration of the mission, both for immersion as well as contribution to the battle. I'm trying to learn and use the resource system to create a need for more conservative play--you will be limited in availability of costlier or rarer weaponry. Warehouse will be AI targets, you have to protect yours while ensuring the other side's get destroyed.

 

Obviously with so much going on I'm worried about performance. Everyone's comments on scripts has me intrigued. I have to say I've never used them and the coding language is intimidating. Sadly I have a hard enough time just with triggers. Slow going but I AM progressing! I gotta say though that the more I dig into this the more I think that much of this should be automated! I mean, that's what COMPUTERS are for, right?! :P

Link to comment
Share on other sites

Hey VapoR,

 

Another thought for events - use the Continuous Action events sparingly! A CA that is constantly firing can easily cause stuttering, such as one that constantly fires Signal Flares. Don't use Continuous Action events when a Switched Condition will work.

 

---

 

I run the Hollo Pointe server. These days I am focusing on F-15C missions that are very basic - I'm taking a bunch of old LOMAC missions and turning them into DCS World. These don't have much in the way of event logic, and they are running fairly stable right now. I'll get back to my Warthog & Huey missions with the next update. Some of the missions that can run for days are Nuke Plant, Back To School, iShot The Shilka...

 

WC

Visit the Hollo Pointe DCS World server -- an open server with a variety of COOP & H2H missions including Combined Arms. All released missions are available for free download, modification and public hosting, from my Wrecking Crew Projects site.

Link to comment
Share on other sites

  • 5 years later...
  • Recently Browsing   0 members

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