Delete An Entire Group Of Units
Posted: Wed Oct 30, 2019 4:52 am
Im looking for some help, I have a scenario am creating from an old Harpoon Gold Scenario.
In Harpoon airfields were single attackable units and in command they are not, I have worked out a way to destroy the whole base using LUA that is, have a single unit airfield called in this case wethersfield then create 20 hangars W1-12 group the lot together.
I then use a points based trigger to remove the airfield, and create the following script:
ScenEdit_DeleteUnit({side="NATO", unitname="Wethersfield1"})
ScenEdit_DeleteUnit({side="NATO", unitname="W1"})
ScenEdit_DeleteUnit({side="NATO", unitname="W2"})
ScenEdit_DeleteUnit({side="NATO", unitname="W3"})
ScenEdit_DeleteUnit({side="NATO", unitname="W4"})
ScenEdit_DeleteUnit({side="NATO", unitname="W5"})
ScenEdit_DeleteUnit({side="NATO", unitname="W6"})
ScenEdit_DeleteUnit({side="NATO", unitname="W7"})
ScenEdit_DeleteUnit({side="NATO", unitname="W8"})
ScenEdit_DeleteUnit({side="NATO", unitname="W9"})
ScenEdit_DeleteUnit({side="NATO", unitname="W10"})
ScenEdit_DeleteUnit({side="NATO", unitname="W11"})
ScenEdit_DeleteUnit({side="NATO", unitname="W12"})
Wethersfield1 is the single airfield unit in this case
This works really well, however its time consuming so I tried a second script to see if I could achieve the same effect on 1 line of code :
ScenEdit_DeleteUnit({side="NATO"name='Wethersfield'})
This code works but it deletes the group and leaves in place the units that made up the group which isnt exactly what I wanted to achieve. So is there a reasonably easy script I could use that will delete a Group AND its sub units in one go?
It would be much easier if Single Unit airfields were attackable lol
Kind Regards
Butch
In Harpoon airfields were single attackable units and in command they are not, I have worked out a way to destroy the whole base using LUA that is, have a single unit airfield called in this case wethersfield then create 20 hangars W1-12 group the lot together.
I then use a points based trigger to remove the airfield, and create the following script:
ScenEdit_DeleteUnit({side="NATO", unitname="Wethersfield1"})
ScenEdit_DeleteUnit({side="NATO", unitname="W1"})
ScenEdit_DeleteUnit({side="NATO", unitname="W2"})
ScenEdit_DeleteUnit({side="NATO", unitname="W3"})
ScenEdit_DeleteUnit({side="NATO", unitname="W4"})
ScenEdit_DeleteUnit({side="NATO", unitname="W5"})
ScenEdit_DeleteUnit({side="NATO", unitname="W6"})
ScenEdit_DeleteUnit({side="NATO", unitname="W7"})
ScenEdit_DeleteUnit({side="NATO", unitname="W8"})
ScenEdit_DeleteUnit({side="NATO", unitname="W9"})
ScenEdit_DeleteUnit({side="NATO", unitname="W10"})
ScenEdit_DeleteUnit({side="NATO", unitname="W11"})
ScenEdit_DeleteUnit({side="NATO", unitname="W12"})
Wethersfield1 is the single airfield unit in this case
This works really well, however its time consuming so I tried a second script to see if I could achieve the same effect on 1 line of code :
ScenEdit_DeleteUnit({side="NATO"name='Wethersfield'})
This code works but it deletes the group and leaves in place the units that made up the group which isnt exactly what I wanted to achieve. So is there a reasonably easy script I could use that will delete a Group AND its sub units in one go?
It would be much easier if Single Unit airfields were attackable lol
Kind Regards
Butch