Oznerol256 Posted April 21, 2013 Posted April 21, 2013 (edited) I wrote a script that allows to create dynamic situation reports in an easy way. To use the script you need to do the following: First, my script using a trigger like that:MISSION START -> no condition -> DO SCRIPT FILE sitrep.lua Second, initialize the situation report in a trigger using this action:DO SCRIPT sitrep = sitrep:init([i]your coalition[/i],[i]your sitrep[/i]); the coalition is either coalition.side.BLUE or coalition.side.RED and the text must be in quotes e.g. "SITREP: GO GET THEM". After this script has been executed, the sitrep will be transmitted to the coalition every 150 seconds and will be displayed for 30 seconds. Third, if the situation changes, call a trigger like that:DO SCRIPT sitrep:transmit([i]a message[/i],[i]a sitrep[/i][i]);[/i]Once this trigger gets executed, the message will be displayed immediately 60 seconds. Additionally, the old sitrep will be replaced by the new sitrep. This means after 150 seconds the new sitrep will be displayed for 30 seconds. The script also offers advanced features like sounds, different operating modes and user defined timings. The complete documentation of the script is here: Oznerol256's sitrep script README The following functions can be called by the user: sitrep:init(c,n,i,d,mode,nd,sound,newsnd) sitrep:transmit(m,n,d,ms,ns) sitrep:stop() --------------------In general--------------------------------------------------- You can use as many sitrep scripts at the same time as you want. In order to create a sitrep script, you need to call the init function: name = sitrep:init(your arguments); After that, you can call all the other functions on that sitrep script: name:transmit(your arguments); name:stop(); If you create two sitreps with two different names, they work independent of each other: name1 = sitrep:init(arguments); name2 = sitrep:init(arguments); If the situation changes, you need to call the transmit function. Here are two examples: name:transmit("The situation changed right now.","The situation has changed a while ago"); name2:transmit("Our ship just got killed.","Our ship is dead",nil,"loss.wav","alert.ogg"); This will cause the sitrep script to instantly show the first text and show the second text regularly as the new sitrep. If you ever want to stop the sitrep script, you can do this with the stop function: name:stop(); To reactivate the script, just call the transmit function. --------------------operating modes----------------------------------------------- The following operation modes are supported: sitrep.mode.all the sitreps are shown to all players. the coalition parameter is ignored sitrep.mode.coalition the sitreps are shown to all players of the specified coalition. This is the default operation mode. sitrep.mode.country the sitreps are shown to all players of a country. you have to specify a country instead of a coalition. sitrep.mode.group the sitreps are shown to all players of a unit group. you have to specify a groupId instead of a coalition. Countries are specified this way: country.id.USA or country.id.GERMANY . For more information see http://en.wiki.eagle.ru/wiki/Simulator_Scripting_Engine/DCS:_World_1.2.1/Part_1#country To get the groupId of a group you need to use mist. Look at the database functions. For example, you get the GroupId of the group examplegroup with this call: mist.DBs.groupsByName.examplegroup.groupId --------------------init function and its arguments-------------------------------- The arguments of the init function are: c The coalition/groupId/country you want to transmit to n The text of the sitrep that is transmitted right after this init call i The interval (the time that passes between the display of two situation reports) OPTIONAL d The duration (the time each situation report is displayed) OPTIONAL mode The operating mode of the newly created script OPTIONAL nd The duration of sitation changes (the time a message transmitted using sitrep:transmit is shown if not specified otherwise) OPTIONAL sound The sound that is played on every situation report OPTIONAL newsnd The sound that is played on every sitation change (the sound of a message transmitted using sitrep:transmit if not specified otherwise) OPTIONAL If you dont specify an OPTIONAL parameter, the default values will be used. These are: no sounds, i=150;d=30;nd=60;mode=sitrep.mode.coalition; --------------------transmit function and its arguments----------------------------- The arguments of the transmit function are: m The message that is displayed instantly n The new sitation report that will be displayed regularly d The duration of m. OPTIONAL ms The sound that will be played instantly OPTIONAL ns The sound that will be played on the new situation reports OPTIONAL If you dont specify an OPTIONAL parameter, the values that have been specified in the init function will be used. --------------------stop function---------------------------------------------------- This function takes no arguments. Just call it this way: name:stop(); --------------------NEED HELP? DONT UNDERSTAND? HAVE A SUGGESTION?-------------------- Just write me a PM on the ED forums. My nickname is Oznerol256. I have attached a test mission that shows the functionality of the sitrep script. Feel free to use the script if you want to. Any comments would be appreciated.sitrep.luatest.mizsitrep readme.txt Edited April 27, 2013 by Oznerol256 [sIGPIC][/sIGPIC]
Oznerol256 Posted April 27, 2013 Author Posted April 27, 2013 UPDATE! Removed the dependency on mist. You dont need to load mist anymore Improved the design of the script. You can now use many scripts at the same time Added the ability to stop the script Added different operation modes Added support for sounds Added more default timings resulting in less required parameters [sIGPIC][/sIGPIC]
Recommended Posts