Jump to content

Spawning the same gorup of units endlessly


kylekatarn720

Recommended Posts

Hi fellas,

 

Lets say i ve put down an a10c flight for me which is named flight-1, and ive put down 2 tank groups which are named tank-1 and tank-2.

 

What i want to do is that whenever i destroy one of these groups, i want that same group which is destroyed to spawn again. for example if the group tank-1 gets destroyed, tank-1 should spawn again, not tank-2.

Link to comment
Share on other sites

well not much to be honest cos i dont have any ideas. only thing i tried was. setting up a trigger which was [continuous action, group dead tanks-1, group activate tanks-1]. i also tried unit dead condition, this trigger works if i try to spawn a different group from the dead one like (tanks-1 dead tanks-2 spawns). but it doesnt work the same group spawning thing.

 

i think it is cos of the "group activate" action i set there but i cant find any other action that can work.

Link to comment
Share on other sites

learn MIST and it's clone function, have a look here:

https://github.com/mrSkortch/MissionScriptingTools/releases/tag/4.3.74

 

In the zip file a simple and complete manual is included.

ChromiumDis.png

Author of DSMC, mod to enable scenario persistency and save updated miz file

Stable version & site: https://dsmcfordcs.wordpress.com/

Openbeta: https://github.com/Chromium18/DSMC

 

The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.

Link to comment
Share on other sites

Hi fellas,

 

Lets say i ve put down an a10c flight for me which is named flight-1, and ive put down 2 tank groups which are named tank-1 and tank-2.

 

What i want to do is that whenever i destroy one of these groups, i want that same group which is destroyed to spawn again. for example if the group tank-1 gets destroyed, tank-1 should spawn again, not tank-2.

Should be simple to do with simple mission editor triggers. Post your mission as you've created it so far and I'll take a shot at modifying it for you. You can then look at the mission in the editor again to see how I did it.

CPU: i7 980x @ 4.2GHz RAM: 24gb Corsair Vengeance

MB: Gigabyte Sniper X58 w/onboard Soundblaster X-Fi

HD: SanDisk 480gb SSD OS: Win7 Pro 64bit

VIDEO CARD: EVGA GTX 980ti FTW

MONITOR: LG 34" Ultrawide 2560x1080

MP SERVER: ibuypower i7-4810MQ w/Win7 Home 64bit

GEAR: Saitek X-52 Pro; Combat Rudder Pedals; Throttle Quadrants. Thrustmaster MFD's, TrackIR 5 w/Pro Clip, Turtle Beach X-12 Headset

Link to comment
Share on other sites

cos nobody answered for couple hours i thought what i asked wasnt possible but apparently it was cos of the timezone difference thx for the answers fellas^^

 

@EasyEB and @chromium i took a C class couple of years back, syntax used in mist looks familiar. Definitely gonna look in to that, it should be fun.

 

@Winston 60 alright gonna post one here so you can check it out.

 

EDIT: uploaded it. Tried it too just in case. when i destroy the first group, second one spawns.

winston.miz


Edited by kylekatarn720
Link to comment
Share on other sites

once a group is dead - you can't spawn it again. If you are going to use scripting - you would need to copy the group's structure before it gets killed, and then re-spawn once it is killed from that copy.

 

and here is the kill even handler:

 

function HitHandler:onEvent(event)

if event.id == world.event.S_EVENT_DEAD then

local tgt = event.initiator

if tgt and tgt:getCategory() == Object.Category.UNIT then

local group = tgt:getGroup()

if group then

if group:getUnits()==nil then

trigger.action.outText('Group '..group:getName()..' is killed.', 5)

end

end

end

end

end


Edited by sea2sky

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

kylekatarn720... ruskybeaver is correct. Using mission builder functions you cannot spawn in again a group that has already been spawned in and killed, but this simple and easy mission editor procedure can spawn identical groups in the same location providing you create them with a different group name.

 

Have a look at your mission now. I have simply created a total of 7 tank groups and triggers to spawn the next one in when the previous group is dead. I simply copied one of your groups and and pasted it back in to your mission changing only the name. Everything is copied, even waypoints if it is a moving vehicle group.

I hope it makes sense to you. If any questions, please ask away and Happy Mission building! :yay:

winston-mod.miz

CPU: i7 980x @ 4.2GHz RAM: 24gb Corsair Vengeance

MB: Gigabyte Sniper X58 w/onboard Soundblaster X-Fi

HD: SanDisk 480gb SSD OS: Win7 Pro 64bit

VIDEO CARD: EVGA GTX 980ti FTW

MONITOR: LG 34" Ultrawide 2560x1080

MP SERVER: ibuypower i7-4810MQ w/Win7 Home 64bit

GEAR: Saitek X-52 Pro; Combat Rudder Pedals; Throttle Quadrants. Thrustmaster MFD's, TrackIR 5 w/Pro Clip, Turtle Beach X-12 Headset

Link to comment
Share on other sites

kylekatarn720... ruskybeaver is correct. Using mission builder functions you cannot spawn in again a group that has already been spawned in and killed, but this simple and easy mission editor procedure can spawn identical groups in the same location providing you create them with a different group name.

 

Have a look at your mission now. I have simply created a total of 7 tank groups and triggers to spawn the next one in when the previous group is dead. I simply copied one of your groups and and pasted it back in to your mission changing only the name. Everything is copied, even waypoints if it is a moving vehicle group.

I hope it makes sense to you. If any questions, please ask away and Happy Mission building! :yay:

 

Well this is pretty much the same thing i do to spawn new groups. I dont usually use "group active" trigger at the beginning like you did, is that necessary?

 

My main goal was to create a mission where i can practice bvr and dog fighting against 2 AI. So 2 groups of fighters, if either one of these groups gets destroyed, both of them spawns again. I can do it with triggers using a lot of groups but what i wanted was a loop i suppose so i wouldnt be have to create 10 groups of fighters for 5 practice sessions. Maybe i can do it using mist. Gonna meddle with it this week.

 

Anyway thanks for your time and help^^

 

once a group is dead - you can't spawn it again. If you are going to use scripting - you would need to copy the group's structure before it gets killed, and then re-spawn once it is killed from that copy.

 

and here is the kill even handler:

 

function HitHandler:onEvent(event)

if event.id == world.event.S_EVENT_DEAD then

local tgt = event.initiator

if tgt and tgt:getCategory() == Object.Category.UNIT then

local group = tgt:getGroup()

if group then

if group:getUnits()==nil then

trigger.action.outText('Group '..group:getName()..' is killed.', 5)

end

end

end

end

end

 

This should do what i want then, gonna try it. Much appreciated^^


Edited by kylekatarn720
Link to comment
Share on other sites

No, the "time more" condition is not necessary. You can have the first group already active in the mission by setting it's start time same as the mission start time.

 

When using multiple groups that are the same you only have to create the first group, then select it and press Ctrl C to copy, then click on the map where you want to paste the clone and press Ctrl V. You can create a dozen clones in just a few seconds. Saves a lot of time.

CPU: i7 980x @ 4.2GHz RAM: 24gb Corsair Vengeance

MB: Gigabyte Sniper X58 w/onboard Soundblaster X-Fi

HD: SanDisk 480gb SSD OS: Win7 Pro 64bit

VIDEO CARD: EVGA GTX 980ti FTW

MONITOR: LG 34" Ultrawide 2560x1080

MP SERVER: ibuypower i7-4810MQ w/Win7 Home 64bit

GEAR: Saitek X-52 Pro; Combat Rudder Pedals; Throttle Quadrants. Thrustmaster MFD's, TrackIR 5 w/Pro Clip, Turtle Beach X-12 Headset

Link to comment
Share on other sites

The way I do it - I pre-create all groups with the Late Activation on, but never activate them, just use them as templates. Then as soon as a mission starts my script spawns real groups from those 'templates', and so on. Also, I create lots of templates for each type giving them right names that contain keywords. The script decides what role should be given to a group when spawning based on those keywords, as well as it picks them randomly. Not sure what your scripting skills like, but if you nail it you can achieve pretty cool results.

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

The way I do it - I pre-create all groups with the Late Activation on, but never activate them, just use them as templates. Then as soon as a mission starts my script spawns real groups from those 'templates', and so on. Also, I create lots of templates for each type giving them right names that contain keywords. The script decides what role should be given to a group when spawning based on those keywords, as well as it picks them randomly. Not sure what your scripting skills like, but if you nail it you can achieve pretty cool results.

Thats a really good idea.

I have no experience on scripts but i know a thing or two on coding. They seem similar so im confident that i can manage.

 

To be honest triggers worked just fine for the missions that i created for me and my friends until i tried this "loop spawning". If i can get away with leaving the lab a bit more earlier this week, gonna start learning more about scripting and mist.

 

Sent from my SM-G925F using Tapatalk

Link to comment
Share on other sites

  • 3 weeks later...

I recommend MOOSE - spawning is super simple.

 

MySpawnGroup = SPAWN:New("MyGroupName")
                           :InitLimit(1, 100)
                           :SpawnScheduled(30, 0)

 

"MyGroupName" is the name of your group in ME.

InitLimit(1, 100) limits the spawning (only 1 unit can be alive at a time, max respawns is 100)

SpawnScheduled(30,0) tells the scheduler to respawn the group every 30 seconds

 

 

If you have a large group you want to keep respawning (say it's 8 units) then adjust the InitLimit accordingly:

 

:InitLimit(8, 100)

 

 

There's much more stuff you can do - you can choose from predefined group templates and have the spawner randomly choose from those templates, random zones, random attack zones, etc.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

  • 3 weeks later...

I'm learning moose and one of the first thing I wanted to try was to respawn AI planes after they've been shot down, either automatically (ondead event) or by radio command...

 

however it seems not working for me. when the group is dead it doesn't spawn anymore...

 

here's the script I made...nothing too fancy, but for what I read there is no any other solution.

 

do
	Spawn_Mig = SPAWN:New("Mig"):InitCleanUp(10)
 
	Spawn_Mig:Spawn()
end

 

the group obviously is named Mig. It spawns correctly at mission start (or if triggered by radio command). However when I kill it, it doesn't respawn anymore.

I tried triggering the script via radio command or trigger "group is dead" within the ME.

I also tried insied Moose with the InitOnEngineShutdown, but nothing worked...

 

any help is really appreciated.

Link to comment
Share on other sites

you dont need to use :Spawn() - remove that line and try it afterwards.

 

Have you checked out the example missions? MOOSE has plenty of example and demo missions that show the spawning in action with various unit types.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

you dont need to use :Spawn() - remove that line and try it afterwards.

 

Have you checked out the example missions? MOOSE has plenty of example and demo missions that show the spawning in action with various unit types.

 

thank you for your suggestion. I tried it but it doesn't work...if I don't put the :Spawn(), i.e.

 

Spawn_Mig = SPAWN:New("Mig"):InitCleanUp(10)

or

Spawn_Mig = SPAWN:New("Mig")

 

no mig is spawned in my mission...

 

I have checked the demo missions and it seemed to me that to spawn a plane you needed the spawn() command. Intended you don't want to schedule it.

 

I took for instance the SPA-120 as reference (shortened for convenience here).

do

 -- Declare SPAWN objects
 local Spawn_A_10C = SPAWN:New("A-10C")
 
 -- Choose repeat functionality
 
 -- Repeat on enging shutdown (when landed on the airport)
 Spawn_A_10C:InitRepeatOnEngineShutDown()
 
 -- Now SPAWN the GROUPs
 Spawn_A_10C:Spawn()
 
 -- Now run the mission and observe the behaviour.

end

 

I tried as well the repeat functionality on engine shut down, but even if it is an event triggered by dead planes as well, it doesn't trigger the respawn.

 

If you like, please check the files I attached.

 

thanks

 

EDIT:

my DCS version is 1.5.6.4818

MOOSE framework is 2.0 just downloaded from here

testmissiletrn.miz

dcs.log.txt


Edited by Mano
added version info
Link to comment
Share on other sites

I looked at your mission, and I think the problem is the two trigger timings:

 

-MOOSE Should be loaded on MISSION START

-Your doscript should be called with a time delay (1 seconds or more)

 

It looks like your spawn code is being called before moose has finished initializing.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Link to comment
Share on other sites

Thank you for looking into it. I'll try this evening what you suggest.

 

However if I'm not wrong that script will only spawn the Mig once. That is something I already manage to do even launching the scripts at mission load.

What I want to do is to respawn the Mig after it's dead... And I don't think it'll do that.

 

Inviato dal mio ALE-L21 utilizzando Tapatalk

Link to comment
Share on other sites

Spawn() only spawns the plane once. ReSpawn() spawns it on it's death. SpawnScheduled spawns it continuously on a schedule and is coupled with IniLimit to stop the spawning when it reaches a number.

 

You can also spawn according to any other criteria or logic. You can spawn and create new objects dynamically by iterating through a number and creating new individual spawn objects.

 

Remember if you spawn "Mig" and then Spawn it again it will overwrite the object and despawn the first.

 

There's more methods, it becomes endless, PM me exactly what you need and I'll write it and send the miz back.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

[EDITED JUNE 2019 - MOOSE 2.0 is way old and the links are broken. Update MOOSE and check the documentation]

I dunno why this was overlooked, just creating the object doesn't actually do anything but make the objectand put it in the database to be used. If you never spawn it, it won't exist. There's multiple ways of actually delivering the spawn vehicle. http://flightcontrol-master.github.io/MOOSE/Documentation/Spawn.html

 

 

 

 

 

thank you for your suggestion. I tried it but it doesn't work...if I don't put the :Spawn(), i.e.

 

Spawn_Mig = SPAWN:New("Mig"):InitCleanUp(10)

or

Spawn_Mig = SPAWN:New("Mig")

no mig is spawned in my mission...

 

I have checked the demo missions and it seemed to me that to spawn a plane you needed the spawn() command. Intended you don't want to schedule it.

 

I took for instance the SPA-120 as reference (shortened for convenience here).

do

 -- Declare SPAWN objects
 local Spawn_A_10C = SPAWN:New("A-10C")
 
 -- Choose repeat functionality
 
 -- Repeat on enging shutdown (when landed on the airport)
 Spawn_A_10C:InitRepeatOnEngineShutDown()
 
 -- Now SPAWN the GROUPs
 Spawn_A_10C:Spawn()
 
 -- Now run the mission and observe the behaviour.

end

I tried as well the repeat functionality on engine shut down, but even if it is an event triggered by dead planes as well, it doesn't trigger the respawn.

 

If you like, please check the files I attached.

 

thanks

 

EDIT:

my DCS version is 1.5.6.4818

MOOSE framework is 2.0 just downloaded from here


Edited by Pikey
A FUNCTION NAME HAS CHANGED!!!

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

  • Recently Browsing   0 members

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