Jump to content

Recommended Posts

Posted

Hi guys, i'm trying to make a mission for my squadron i fly with where they can use f10 to respawn an enemy, i know this can only be done once with out use of a script i keep hearing moose or mist - now i dont know the differences or which one to use? Im completely new to it and would like some help if at all possible,

What one should i use? Where do i find them? and any one willing to advise HOW to use them?

Many thanks in advance

Posted (edited)

Hi!

You can find the Forum page for them here:

 

 

The Github link is on the first page of each forum page.

 

I have no experience with Moose, so can not say how easy it is.

Have used MIST and it is quite easy to spawn units with. The documentation is also quite good, example if you want to keep cloning a group in a zone you can use this (Se bottom for other types of spawns):
MIST cloneInZone - DCS World Wiki - Hoggitworld.com

 

Hope this helps 🙂

Edited by Kanelbolle
  • Thanks 1
Posted (edited)

No, MIST does not have a command to add a spawn to the Radio menu.

All available MIST commands are listed here: Mission Scripting Tools Documentation - DCS World Wiki - Hoggitworld.com

But there is simply no need to have a dedicated MIST function to this since its quite easy in vanilla scripting or even just right in the editor.
 

For example if you just crate a function called "spawnenemy", you can just add it to your plane using your group ID with this command:

missionCommands.addCommandForGroup(groupId, 'Name in the menu', nil , spawnenemy)

 

I can create quick example mission for you when i get home if you want more info, but have to wait a few hours until i get home 🙂

 

Edited by Kanelbolle
Posted

that would very much be appriciated, i was looking toward using mist or moose due to being able to have the one unit respawning, but the tigger action for it would (i think) be the normal comm f10 stuff from the normal side of the triggers?

Posted (edited)

Here is a easy example how to do it.

I just do this:

1. Load MIST first

2. Load the script i made straight in to the mission editor with a "Do Script"

The menu will be added 5 sec in to the mission to the group.
Just note that in this example the Group (you) have to spawn before 5 sec to it to work.

 

The code is a simple example, it can be better and expanded but is just for showing the idea how it can be done:




function respawnunits()

	mist.cloneInZone('Ground-1', 'TroggerZone1', true, 200, {offsetRoute = true, initTasks = true})

end



_GpName = "Aerial-1"

if _GpName ~= nil then
		
	-- if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) and (Group.isExist(gp) == true) then
	if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) then
		_GpID = Group.getByName(_GpName):getID()

		local rootMenu = missionCommands.addSubMenuForGroup(_GpID, "My Menu")
		missionCommands.addCommandForGroup(_GpID, 'Respawn Group!', rootMenu , respawnunits, nil)

	end -- of if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) and (Group.isExist(gp) == true) then

end -- of if _GpName ~= nil then

 

Test-RespawnUnits-RadioMenu1.miz

Edited by Kanelbolle
Posted (edited)

A better way if you are planing on adding it to a multiplayer game and a specific group would be to add it when the group i alive.

Remember to change the group name in the script to your missions group name:

 

_GpName = "Aerial-1"

See the example .miz file.

Test-RespawnUnits-RadioMenu2.miz

Edited by Kanelbolle
Posted

ok i've managed to play around a little bit with it and i have a couple more quiestions.

i've now managed to get it to have 2 f10 options 

f10
spawn car
spawn mig

but in each option they have "respawn unit"

how would i make multiple choice?

so if you went "f10/spawn mig/ you could then choose f1 drone / f2 rookie / f3 ace for example?

also when you tell it to Start script at the very begining i tried to find where mine was saved that matched the one you said to load and couldn't find it, where would that be buddy?

your help has been ace i'm starting to slightly get it

 

 

 

 

Posted
7 hours ago, PhoenixBondi said:

thank you i will try and look at this further and understand it, i feel like its melted my brain atm

 

hehe 🙂 Yea, jumping right in to LUA scripting without doing a proper introduction to the language in a course or online tutorial will do that to you 😄

Posted (edited)
6 hours ago, PhoenixBondi said:

ok i've managed to play around a little bit with it and i have a couple more quiestions.

i've now managed to get it to have 2 f10 options 

f10
spawn car
spawn mig

but in each option they have "respawn unit"

how would i make multiple choice?

so if you went "f10/spawn mig/ you could then choose f1 drone / f2 rookie / f3 ace for example?

also when you tell it to Start script at the very begining i tried to find where mine was saved that matched the one you said to load and couldn't find it, where would that be buddy?

your help has been ace i'm starting to slightly get it

 

 

 

 

Happy to help! 🙂

If you are serious about learning to script in DCS i would recommend doing a LUA tutorial first like this, or just search on google for one:
https://www.lua.org/pil/1.html

 

Then go to DCS scripting here:
https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation

 

To get sub menu's you use the "missionCommands.addSubMenuForGroup" command, you can find it here: https://wiki.hoggitworld.com/view/DCS_func_addSubMenuForGroup

Here is a example of multiple menus and a function that can take arguments passed from the command you press in the menu.


function respawnunits(_spawnType)

	if _spawnType == "Unarmed" then

		mist.cloneInZone('Ground-1', 'TriggerZone1', true, 200, {offsetRoute = true, initTasks = true})
	
	elseif _spawnType == "APC" then
	
		mist.cloneInZone('Ground-2', 'TriggerZone1', true, 200, {offsetRoute = true, initTasks = true})
	
	end -- of if _spawnType == "Unarmed" then
	
end -- of function respawnunits(_spawnType)



_GpName = "Aerial-1"

if _GpName ~= nil then
		
	if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) then
		_GpID = Group.getByName(_GpName):getID()

		local rootMenu = missionCommands.addSubMenuForGroup(_GpID, "My Menu")
		
		_menu1 = missionCommands.addSubMenuForGroup(_GpID, "Ground Units", rootMenu)
		_menu2 = missionCommands.addSubMenuForGroup(_GpID, "Unarmed", _menu1)
		_menu3 = missionCommands.addSubMenuForGroup(_GpID, "APC", _menu1)
		
		missionCommands.addCommandForGroup(_GpID, 'Respawn Unarmed Group!', _menu2 , respawnunits, "Unarmed")
		missionCommands.addCommandForGroup(_GpID, 'Respawn APC Group!', _menu3 , respawnunits, "APC")

	end -- of if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) then

end -- of if _GpName ~= nil then

 

 

 

Where to put the code i presume you are asking ? I just add it as a "DO Script", but you can also use a "DO SCRIPT FILE". Here is to find it in the missions:

DCS-Triggers.jpg

 

 

Test-RespawnUnits-RadioMenu3.miz

Edited by Kanelbolle
Posted

no the first who section on what you showed me the first trigger was Run script. where was that script? and is it what i need to download and add it to my dcs? if so how do others get it if its told to look for it in my mission, but the mission is only the miz file??

Posted (edited)
19 hours ago, PhoenixBondi said:

no the first who section on what you showed me the first trigger was Run script. where was that script? and is it what i need to download and add it to my dcs? if so how do others get it if its told to look for it in my mission, but the mission is only the miz file??

Ah, you mean the MIST script that is added to the mission?

You can just download it from the link I shared from page 1. Then add it under Triggers with a event "MISSION START" and a "DO SCRIPT FILE". The install instructions are included. (Just open my mission in the Mission editor and look how it is added)
Or download it directly from here: https://github.com/mrSkortch/MissionScriptingTools/releases

 

If you want to get the script file out of my mission, you can just change the .Miz file I added and change the extention to .zip (it's just a zip file, so it has the name "Test-RespawnUnits-RadioMenu3.zip") and get it from the mission there. Then add it as described above.

Edited by Kanelbolle
Posted
Quote

 


function respawnunits(_spawnType)

    if _spawnType == "Unarmed Migs" then

        mist.cloneInZone('Unarmed Migs', 'Migs', true, 200, {offsetRoute = true, initTasks = true})
    
    elseif _spawnType == "Rookie Migs" then
    
        mist.cloneInZone('Rookie Migs', 'Migs', true, 200, {offsetRoute = true, initTasks = true})
        
    elseif _spawnType == "Trained Migs" then
    
        mist.cloneInZone('Trained Migs', 'Migs', true, 200, {offsetRoute = true, initTasks = true})    
        
    elseif _spawnType == "Veteran Migs" then
    
        mist.cloneInZone('Veteran Migs', 'Migs', true, 200, {offsetRoute = true, initTasks = true})

    elseif _spawnType == "Ace Migs" then
    
        mist.cloneInZone('Ace Migs', 'Migs', true, 200, {offsetRoute = true, initTasks = true})
        
    
    elseif _spawnType == "APC" then
    
        mist.cloneInZone('Ground-2', 'Migs', true, 200, {offsetRoute = true, initTasks = true})
        
    elseif _spawnType == "firetruck" then
    
        mist.cloneInZone('Ground-3', 'Migs', true, 200, {offsetRoute = true, initTasks = true})
    
    end -- of if _spawnType == "Unarmed" then
    
end -- of function respawnunits(_spawnType)

_GpName = "Aerial-1", "{Carrier} F-14B", "{Carrier} F/A-18C"

if _GpName ~= nil then
        
    if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) then
        _GpID = Group.getByName(_GpName):getID()

        local rootMenu = missionCommands.addSubMenuForGroup(_GpID, "Air Respawns")
        
                        
        missionCommands.addCommandForGroup(_GpID, 'Unarmed Migs', rootMenu , respawnunits, "Unarmed Migs")
        missionCommands.addCommandForGroup(_GpID, 'Rookie Migs', rootMenu , respawnunits, "Unarmed Migs")    
        missionCommands.addCommandForGroup(_GpID, 'Trained Migs', rootMenu , respawnunits, "Unarmed Migs")
        missionCommands.addCommandForGroup(_GpID, 'Veteran Migs', rootMenu , respawnunits, "Unarmed Migs")
        missionCommands.addCommandForGroup(_GpID, 'Ace Migs', rootMenu , respawnunits, "Unarmed Migs")
        
    end -- of if (Group.getByName(_GpName) and Group.getByName(_GpName):getSize() > 0) then

end -- of if _GpName ~= nil then

 


So i got this working perfectly so far, BUT i don't want it to be just one plane so i tried to add the 14 and the 18 as you can see but it didnt work. is there away to make it any of the BLUE team?

Thanks for this by the way im actually starting to get it

Posted (edited)

If you want it on more planes just put the function "function respawnunits(_spawnType)" in it own "DO SCRIPT" before the planes reciving the menu code maybe with a "TIME MORE" at "1" sec, instead of "Group alive" (Might have to add it at mission start, but you can try with time more first.)

Then add a new trigger for "each" plane that has a different group name at the start with the "Group alive" as a trigger as my examples has.
For each plane the "DO SCRIPT" has the rest of the script starting with:

_GpName = "Aerial-1"
etc...... rest of the code...

 

The next trigger DO SCRIPT starts

_GpName = "{Carrier} F-14B"
etc...... rest of the code...

 

You can also add an array with all the names and make a function that checks that array for the names, but will not make much sense in this case, since it wont reduce the amount of code.

 

Or you can dive in to EVENTS and add the code at birth to the planes with DCS event birth - DCS World Wiki - Hoggitworld.com
How to add events ( https://wiki.hoggitworld.com/view/DCS_func_addEventHandler )

But this is getting advanced... You can see an example of someone using it here: https://forum.dcs.world/topic/212625-lua-spawn-crew-chief-in-front-of-client/#comment-3987771

 

Or you can search this forum for more examples of using "Events". Should be plenty of examples. (If you search for "addEventHandler", you will get many examples for different events)

Might want to take look at this forum post to for a intro to lua:
https://forum.dcs.world/topic/100222-tutorial-introduction-to-lua-scripting/

 

Hope this helps 🙂

 

 

Edited by Kanelbolle
Posted

so if i get this right you are saying Multi script

script 1 will be the 
 "function respawnunits(_spawnType)" etc etc etc script

script 2 will be
_GpName = "Aerial-1"


Script 3 will be
_GpName = "next group"

 

etc etc etc??

is that bit above right?

isnt there a way to just make it 1 script for the gpname but as a group blue or coalition etc?

 

 

and thanks buddy, you've been such a grand help

 

 

Posted (edited)
19 minutes ago, PhoenixBondi said:

so if i get this right you are saying Multi script

script 1 will be the 
 "function respawnunits(_spawnType)" etc etc etc script

script 2 will be
_GpName = "Aerial-1"


Script 3 will be
_GpName = "next group"

 

etc etc etc??

is that bit above right?

isnt there a way to just make it 1 script for the gpname but as a group blue or coalition etc?

 

 

and thanks buddy, you've been such a grand help

 

 

That is correct. The reason it has to be like that is because the group has to exist in the game before the menu is added. This is why i used the trigger "Group alive", the script runs when the group is spawning.

If you want it to add to a coalition you can use the "EVENTS" way i mentioned.

 

Or you can make a scheduled function that check if the group has spawned. And add it if it is the first time it spawned. You'd have to track what group has gotten the menu already.

 

Or you can go with the simple way and use something that already has been made before like this:

GitHub - Markoudstaal/DCS-Simple-Spawn-Menu: A script for DCS that uses group names to create a spawn menu.

 

 

Edited by Kanelbolle
  • Recently Browsing   0 members

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