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