Jump to content

Recommended Posts

Posted

Does anyone know how to use a_load_mission in a script?

 

Thanks

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.

Posted

uhm... retry question:

 

does anyone know how to load another mission by script? XD

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.

Posted

the very same thing, but by script, to integrate it in DAWS, so that I will be able to reload the updated mission on the server each "n" hour. I already have a workaround for the overwrite file issue.

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.

Posted

Sorry. There is a command in the .net API.

net.load_mission(miz_filename)

Loads a specified mission, temporarily overriding the server mission list.

SERVER ONLY

Posted

To make this work if you plan on something happening in the mission you need to write something to a file and then read that file externally from a C++/Java/other to react on the written file and then some code to load a new mission based on what you wrote to the file, maybe a new mission name for instance? There is no way to get the net. commands to work from inside a mission.

Posted

Thanks!

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.

Posted (edited)

Do you know how this is working?

 

-- GUI callbacks

function onShowMessage(a_text, a_duration)

-- this one may be useful for chat archiving

end

 

I'm trying to set a reaction with net.loadmission when the message is displayed in the _GameGUI.lua file.

Edited by chromium

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.

Posted

DCS World need to run as a server. You need a .lua file loaded that starts a net session you can connect to. Through that connection you can use the net. functions (you must connect to it with some net port (java)). I believe there is a example on DCS main webpage somewhere. There may also be other scripters that know how.

Posted

uhm, given that DCS is the server, the custom _GameGUI.lua file should do the work.

DAWS will print the "gnagna" text in the SSE...

in the _GameGUI.lua file a onShowMessage callback will trigger the net.loadmission action.

 

to test that I need to understand how the onShowMessage variables work exactly. there isn't any reference in the forum and the API do not give much details... I'm going by trial and error for the moment.

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.

Posted

wrong post

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.

Posted
Check this file also: "..\MissionEditor\dedicatedServerGUI.lua"

 

wilco

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.

Posted

I found that file in another version, not 2.1.1... but ok. Can't see much info regarding the function, and also in the GameGUI.lua main file.

 

Also with this code in my _GameGUI.lua file:

 

function DAWSgf.onShowMessage("DAWS is loading a new mission", 10)
if DCS.isServer() == true then
	print("reloading")
	net.load_mission(lfs.tempdir() .. "DAWS_AutoSave.miz")
end
end

 

 

I had this error in the log:

00024.278 DEBUG LuaGUI: Failed to load user script DAWSGameGUI.lua: [string "C:\Users\loren\Saved Games\DCS.openalpha\Scripts/DAWSGameGUI.lu..."]:71: <name> or '...' expected near '"DAWS is loading a new mission"'

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.

Posted

saw it, I'm looking :)

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.

Posted

result achieved. Did this:

 

1: chunk in my script that prints out a particoular message:

 

	DAWS.autoReload = function()
	env.info("DAWS is restarting server... ")
	DAWS.copyFile(missionfilesdirectory .. AutoSaveFileName, lfs.tempdir() .. AutoSaveFileName)
	--a_load_mission(\"DAWS_AutoSave.miz\")
	--a_load_mission(lfs.tempdir() .. AutoSaveFileName)
	trigger.action.outText("DAWS is loading a new mission", 10)
end

if ServerPeriodicRestartDP == true then
	timer.scheduleFunction(DAWS.autoReload, {}, timer.getTime() + 120)
	
end
--]]--

 

 

2: chunk in my _GameGUI.lua file (future hooks) that recall the event and load the mission:

 

function DAWSgf.onTriggerMessage(message)
if message == "DAWS is loading a new mission" then
	if DCS.isServer() == true then
		print("DAWS is reloading autosave mission...")
		net.load_mission(lfs.tempdir() .. "DAWS_AutoSave.miz")
	end
end
end

 

now I only need to polish the overwrite issue code (this:

00371.153 ERROR VFS: VFS_open_write: CreateFile(C:\Users\loren\AppData\Local\Temp\DCS.openalpha\DAWS_AutoSave.miz): The process cannot access the file because it is being used by another process."

)

and I'm done.

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.

Posted

Ha, how ironic, I was talking with Hijack about similar things recently.

 

I had a server manager external script that achieved a similar thing completely differently https://github.com/thebgpikester/DCSI

 

It took the DAWS saved file (incremental and thus different name) and inserted it's name into the top of ServerSettings.lua, so that when DCS restarted it would autoload the saved mission first, rather than the last one that was run, as it does by default. This had to use Cribob's persistent server mod.

 

Basically DAWS autosaved every 5 mins, if the server restarted it used the last save, without any hands on, all automatic.

 

Very niche use-case, in fact I didn't use it a lot because at various times either DCS, DAWS, my squadron, or mission design was so fragile that it was hard to make content that used it!

 

However if you inbuilt that to DAWS so it replaced the last save in the

ServerSettings.lua OR named the file the same (which overwriting dfidn't seem possible in testing due to security permissions) then you coudl acheive the same, very useful function.

___________________________________________________________________________

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

Posted (edited)

I'm doing this right cause you asked quite some times ago, but before starting to mess with API I didn't found a proper solution... hope to get it to work as espected.

 

Also because the "retain given route" part would become important...

Edited by chromium

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.

Posted
result achieved. Did this:

 

1: chunk in my script that prints out a particoular message:

 

	DAWS.autoReload = function()
	env.info("DAWS is restarting server... ")
	DAWS.copyFile(missionfilesdirectory .. AutoSaveFileName, lfs.tempdir() .. AutoSaveFileName)
	--a_load_mission(\"DAWS_AutoSave.miz\")
	--a_load_mission(lfs.tempdir() .. AutoSaveFileName)
	trigger.action.outText("DAWS is loading a new mission", 10)
end

if ServerPeriodicRestartDP == true then
	timer.scheduleFunction(DAWS.autoReload, {}, timer.getTime() + 120)
	
end
--]]--

 

 

2: chunk in my _GameGUI.lua file (future hooks) that recall the event and load the mission:

 

function DAWSgf.onTriggerMessage(message)
if message == "DAWS is loading a new mission" then
	if DCS.isServer() == true then
		print("DAWS is reloading autosave mission...")
		net.load_mission(lfs.tempdir() .. "DAWS_AutoSave.miz")
	end
end
end

 

now I only need to polish the overwrite issue code (this:

00371.153 ERROR VFS: VFS_open_write: CreateFile(C:\Users\loren\AppData\Local\Temp\DCS.openalpha\DAWS_AutoSave.miz): The process cannot access the file because it is being used by another process."

)

and I'm done.

I'm glad it worked out for you. I think going through the my_GameGUI.lua is good and very stable (set a proper name on it). You have suddenly access to a lot more functions from the API if you like also to exchange or broaden information on user, server, IP, GUI etc....

Posted
Ha, how ironic, I was talking with Hijack about similar things recently.

 

I had a server manager external script that achieved a similar thing completely differently https://github.com/thebgpikester/DCSI

 

It took the DAWS saved file (incremental and thus different name) and inserted it's name into the top of ServerSettings.lua, so that when DCS restarted it would autoload the saved mission first, rather than the last one that was run, as it does by default. This had to use Cribob's persistent server mod.

 

Basically DAWS autosaved every 5 mins, if the server restarted it used the last save, without any hands on, all automatic.

 

Very niche use-case, in fact I didn't use it a lot because at various times either DCS, DAWS, my squadron, or mission design was so fragile that it was hard to make content that used it!

 

However if you inbuilt that to DAWS so it replaced the last save in the

ServerSettings.lua OR named the file the same (which overwriting dfidn't seem possible in testing due to security permissions) then you coudl acheive the same, very useful function.

 

solved by editing serversettings.lua by SSE. Now I integrate the new option in the menù and I'll start testing. Have to say that will be only for DCSW 2, won't recode that in 1.5.7. I want to focus on some small upgrades to save mission code and then restart AI enhancement developing.

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.

Posted

That's great news. I believe this is the right approach to designing persistence, in that you have now linked both saving the state of a mission to loading it automatically. (in the same tool)In many ways we have worked on different solutions to achieving the same end state. With saving the actual units position we now put emphasis on traditional units and not spawned units, and this also means we have to consider performance, because the main benefit of spawned units is you bring them when you need. With saving state, you put everything there to begin with so you have to consider performance of unit numbers and thus I believe things like "AI ON" and "AI OFF" should be considered as a dynamic function according to need. Something like the "AI bubble".

 

There are still some challenges with this approach. Inventory is one of them. We cannot get rid of spawn scripts entirely, to dynamically fill the skies between sessions, we should carry inventory from one mission to the next, the logsitics aspect. Whilst Sven's MOOSE can carry inventory in memory, we are discussing between mission restarts. The loadfile() writefile methods are rearing their heads here. I did some very basic use of this with my camapigns;

 

function writemissionfilestatus(data)

File = io.open(CFile, "w")

File:write(data)

File:close()

env.info("Campaign: Saving campaign status")

end

 

In which I stored variables then on start of mission I ran a do file and sucked the variables back in. So i was doing some basic phases but inside the same running mission (which made it huge, it was many missions in one)

 

You could consider this aspect for storing things like Airplane inventory, tank inventory and so on.

 

I'm pretty much only using 2.1 now too, mostly the performance in NTTR is what I need, it's very much a blank canvas for mission design now.

 

solved by editing serversettings.lua by SSE. Now I integrate the new option in the menù and I'll start testing. Have to say that will be only for DCSW 2, won't recode that in 1.5.7. I want to focus on some small upgrades to save mission code and then restart AI enhancement developing.

___________________________________________________________________________

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

  • Recently Browsing   0 members

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