Jump to content

Recommended Posts

Posted

Goodmorning everyone!
Sorry for the title ...
A curiosity. I know the ideal would be to use a script. But is it possible to use the same radio menu to reappear units that have been destroyed or hidden? I will explain.
Through the radio menu, I spawn the units, but for some reason I have to disable them because in the meantime my targets have changed priority and I don't want the enemy troops in question to cause interference. However, I have noticed that the moment I try to use the radio menu again to regenerate the units I had previously disabled, they no longer appear as if the menu spawn command no longer works.
I've tried all sorts of ways as far as I know, but there was no way to get it to work that way.

Posted

A workaround I know of would be to have two identical groups at the same position, one being visible from the start (which you will later deactivate) and a second one with late activation enabled (which will be used to activate again) 

Posted (edited)

Thank you for your suggestion!

Well it wouldn't make sense then, because I might not have to turn them off, it was just a hypothesis, furthermore I have to consider that I have more spawn points. But even if, I destroy them and want to respawn them again, it's not possible. 
Maybe it's a limitation of the radio menu !?

Edited by Facocero
Posted (edited)

Unfortunately, once an aircraft is destroyed or deactivated, it is not possible to trigger it to respawn. In my case, I really wanted to make respawning a reality, so I created a script, referring to the Wiki and other scripts.

I'm not able to get to it right now, but I can show you the script later if there is demand.

Edited by Admiral_ZIPANGU

Phantom Forever

F-4EJ / F-4EJ Kai 1971-2021

Sorry, I don't speak English, so I use DeepL Translate. Well, I can speak Japanese.

Posted
6 ore fa, Admiral_ZIPANGU ha scritto:

Unfortunately, once an aircraft is destroyed or deactivated, it is not possible to trigger it to respawn. In my case, I really wanted to make respawning a reality, so I created a script, referring to the Wiki and other scripts.

I'm not able to get to it right now, but I can show you the script later if there is demand.

 

I'd be interested in taking a look at your script. I'm learning a lot of things, but I'm still a long way off on scripts, also because I don't find tutorials suited to my skills. I can't find anything in my language and that makes things very difficult.
Thanks anyway!

Posted (edited)

Sorry to keep you waiting so long. I have prepared a script and a mission for your reference.

Since you said you wanted to repeat Deactive and Active in the F10 menu, I'll also give you a script to add a submenu to the F10 menu. I'm sure it will make the F10 menu more useful.

 

First, set up the F10 menu that contains the submenus. Aircraft include one group each of A-10C and F-16C at Sukumi and Kobuleti, and ground vehicles include M2A2 Bradley and NASAMS at Sukumi. Both groups are set to "Late Activation".

Now we will configure the F10 menu as follows.

Quote

Aircraft Spawn
---A-10C
------Sukumi
---------Active (FLAG=101)
---------Deactive (FLAG=102)
------Kobuleti
---------Active (FLAG=103)
---------Deactive (FLAG=104)
---F-16C
------Sukumi
---------Active (FLAG=201)
---------Deactive (FLAG=202)
------Kobuleti
---------Active (FLAG=203)
---------Deactive (FLAG=204)

Ground Spawn
---M2A2 Bradley
------Sukumi
---------Active (FLAG=1101)
---------Deactive (FLAG=1102)
---NASAMS
------Sukumi
---------Active (FLAG=1201)
---------Deactive (FLAG=1202)

In this case, the script should be set as follows. This is the content of "F10_Menu_Setup.lua" in the attached ZIP file. (The green text has no effect on the script.)

Quote
--Forgetting to do this will cause an error.
local function setFlag(val)
    trigger.action.setUserFlag(val.flag, true)
end
 
--Aircraft Spawn menu in F10
local F10air= missionCommands.addSubMenu('Aircraft Spawn') -- Set the category to "F10air."
 
        local air1= missionCommands.addSubMenu('A-10C', F10air) -- Set the category to "air1" and place it under "F10air".
 
            local a10cMenu1= missionCommands.addSubMenu('Sukumi', air1)  -- Set the category to "a10cMenu1" and place it under "air1".
                local a10cON1= missionCommands.addCommand('Active', a10cMenu1, setFlag, {flag= 101})    -- Place it under "a10cmenu1" and use it to turn on Flag 101.
                local a10cOFF1= missionCommands.addCommand('Deactive', a10cMenu1, setFlag, {flag= 102}) -- Place it under "a10cmenu1" and use it to turn on Flag 102.
 
            local a10cMenu2= missionCommands.addSubMenu('Kobuleti', air1) -- Set the category to "a10cMenu2" and place it under "air1".
                local a10cOn2= missionCommands.addCommand('Active', a10cMenu2, setFlag, {flag= 103})    --  Place it under "a10cmenu2" and use it to turn on Flag 103.
                local a10cOFF2= missionCommands.addCommand('Deactive', a10cMenu2, setFlag, {flag= 104}) --  Place it under "a10cmenu2" and use it to turn on Flag 104.
 
        local air2= missionCommands.addSubMenu('F-16C', F10air) -- Set the category to "air2" and place it under "F10air".
 
            local f16cMenu1= missionCommands.addSubMenu('Sukumi', air2)  -- Set the category to "f16cMenu1" and place it under "air2".
                local f16cON1= missionCommands.addCommand('Active', f16cMenu1, setFlag, {flag= 201})
                local f16cOFF1= missionCommands.addCommand('Deactive', f16cMenu1, setFlag, {flag= 202})
 
            local f16cMenu2= missionCommands.addSubMenu('Kobuleti', air2)
                local f16cON2= missionCommands.addCommand('Active', f16cMenu2, setFlag, {flag= 201})
                local f16cOFF2= missionCommands.addCommand('Deactive', f16cMenu2, setFlag, {flag= 202})
 
--Ground Vehicle Spawn menu in F10
local F10ground= missionCommands.addSubMenu('Ground Spawn')
 
        local ground1= missionCommands.addSubMenu('M2A2 Bradley', F10ground)
 
            local m2a2Menu1= missionCommands.addSubMenu('Sukumi', ground1)
                local m2a2ON1= missionCommands.addCommand('Active', m2a2Menu1, setFlag, {flag= 1101})
                local m2a2OFF1= missionCommands.addCommand('Deactive', m2a2Menu1, setFlag, {flag= 1102})
 
        local ground1= missionCommands.addSubMenu('NASAMS', F10ground)
 
            local nasamsMenu1= missionCommands.addSubMenu('Sukumi', ground1)
                local nasamsON1= missionCommands.addCommand('Active', nasamsMenu1, setFlag, {flag= 1201})
                local nasamsOFF1= missionCommands.addCommand('Deactive', nasamsMenu1, setFlag, {flag= 1202})

In this case, the F10 menu will be displayed on both sides, so if you want to display it only on the Blue side, please change this to the following.

Quote

 

missionCommands.addSubMenu('Aircraft Spawn')
missionCommands.addCommand('Active', a10cMenu1, setFlag, {flag= 101})

missionCommands.addSubMenuForCoalition(coalition.side.BLUE, 'Aircraft Spawn')
missionCommands.addCommandForCoalition(coalition.side.BLUE, 'Active', a10cMenu1, setFlag, {flag= 101})

 

For the Red side: coalition.side.RED

 

Next, create a script to activate or deactivate them. This is the content of "F10_Spawn_Setup.lua" in the attached ZIP file.

Quote
--Aircraft Spawn setup
 
local function Aircraft1()  -- Set up a definition called "Aircraft1".
    timer.scheduleFunction(Aircraft1, {}, timer.getTime() + 2)  --same "TIME SINCE FLAG 2 seconds"
 
 --A-10C
    if trigger.misc.getUserFlag( '101' ) == 1 then  -- FLAG IS TRUE = 101
        mist.respawnGroup('A-10C #1', true)         -- Group Active
        trigger.action.setUserFlag('101',false)     -- FLAG OFF 101
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'A-10C Sukumi Active' , 10 , false) -- Message for Blue coalotion
    end
 
    if trigger.misc.getUserFlag( '102' ) == 1 then  -- FLAG IS TRUE = 102
        if Group.getByName('A-10C #1') then         -- Same "GROUP ALIVE"
            Group.getByName('A-10C #1'):destroy()   -- Group Deactive
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'A-10C Sukumi Deactive' , 10 , false)  -- Message for Blue coalotion
        end -- Do not forget.
        trigger.action.setUserFlag('102',false)     -- FLAG OFF 102
    end
 
    if trigger.misc.getUserFlag( '103' ) == 1 then
        mist.respawnGroup('A-10C #2', true)
        trigger.action.setUserFlag('103',false)
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'A-10C Kobuleti Active' , 10 , false)
    end
 
    if trigger.misc.getUserFlag( '104' ) == 1 then
        if Group.getByName('A-10C #2') then
            Group.getByName('A-10C #2') :de:stroy()
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'A-10C Kobuleti Deactive' , 10 , false)
        end
        trigger.action.setUserFlag('104',false)
    end
 
 --F-16C
    if trigger.misc.getUserFlag( '201' ) == 1 then
        mist.respawnGroup('F-16C #1', true)
        trigger.action.setUserFlag('201',false)
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'F-16C Sukumi Active' , 10 , false)
    end
 
    if trigger.misc.getUserFlag( '202' ) == 1 then
        if Group.getByName('F-16C #1') then
            Group.getByName('F-16C #1') :destroy()
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'F-16C Sukumi Deactive' , 10 , false)
        end
        trigger.action.setUserFlag('202',false)
    end
 
    if trigger.misc.getUserFlag( '203' ) == 1 then
        mist.respawnGroup('F-16C #2', true)
        trigger.action.setUserFlag('203',false)
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'F-16C Kobuleti Active' , 10 , false)
    end
 
    if trigger.misc.getUserFlag( '204' ) == 1 then
        if Group.getByName('F-16C #2') then
            Group.getByName('F-16C #2') :destroy()
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'F-16C Kobuleti Deactive' , 10 , false)
        end
        trigger.action.setUserFlag('204',false)
    end
 
end
Aircraft1() -- Run the script based on the definition "Aircraft1".
 
--Ground Spawn Setup
 
local function Ground1()
    timer.scheduleFunction(Ground1, {}, timer.getTime() + 2)  
 
    if trigger.misc.getUserFlag( '1101' ) == 1 then
        mist.respawnGroup('Ground M2A2 #1', true)
        trigger.action.setUserFlag('1101',false)
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'M2A2 Bradley Sukumi Active' , 10 , false)
    end
 
    if trigger.misc.getUserFlag( '1102' ) == 1 then
        if Group.getByName('Ground M2A2 #1') then
            Group.getByName('Ground M2A2 #1') :destroy()
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'M2A2 Bradley Sukumi Deactive' , 10 , false)
        end
        trigger.action.setUserFlag('1102',false)
    end
 
    if trigger.misc.getUserFlag( '1201' ) == 1 then
        mist.respawnGroup('NASAMS #1', true)
        trigger.action.setUserFlag('1201',false)
        trigger.action.outTextForCoalition(coalition.side.BLUE , 'NASAMS Sukumi Active' , 10 , false)
    end
 
    if trigger.misc.getUserFlag( '1202' ) == 1 then
        if Group.getByName('NASAMS #1') then
            Group.getByName('NASAMS #1') :destroy()
            trigger.action.outTextForCoalition(coalition.side.BLUE , 'NASAMS Sukumi Deactive' , 10 , false)
        end
        trigger.action.setUserFlag('1202',false)
    end
 
end
Ground1()

This is all the script that needs to be set.

 

Finally, load these scripts in the mission editor. Load all the files with "MISSION START" and "DO SCRIPT FILE" as shown in the following image. Don't forget to include the MIST file.

Screen_220123_230203 (2).jpg

Now you are all set. Each group will be activated or deactivated about 2 seconds after the command.

This may have been quite a long text and difficult to understand. If you have any questions, I will be happy to answer them.

F10_Spawn_Setup_example.zip RespawnScript_Example.miz

Edited by Admiral_ZIPANGU

Phantom Forever

F-4EJ / F-4EJ Kai 1971-2021

Sorry, I don't speak English, so I use DeepL Translate. Well, I can speak Japanese.

Posted
4 ore fa, Admiral_ZIPANGU ha scritto:

Sorry to keep you waiting so long. I have prepared a script and a mission for your reference.

No problem, on the contrary ..
Thank you very much, you have been very kind.
Tomorrow as soon as I have some time I will start studying it.

  • Recently Browsing   0 members

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