playScriptedMission: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "</dd> </dl>" to "</dd> </dl>")
m (Some wiki formatting)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| arma2
|game1= arma2
|1.00
|version1= 1.00


|game2= arma2oa
|game2= arma2oa
Line 15: Line 15:
|gr1= System
|gr1= System


| Load the given world, launch an empty mission, and execute the given expression.
|descr= Load the given world, launch an empty mission, and execute the given expression.
Config (optional) can reference to the config entry, replacing [[Description.ext]] for this mission.
If provided, ''config'' can reference to the config entry, replacing [[Description.ext]] for this mission.


|s1= '''playScriptedMission''' [world, expression, config, ignoreChildWindow]
|s1= [[playScriptedMission]] [world, expression, config, ignoreChildWindow]


|p1= world: [[String]]
|p1= world: [[String]]
Line 24: Line 24:
|p2= expression: [[Code]]
|p2= expression: [[Code]]


|p3= config (Optional): [[Config]]
|p3= config: [[Config]] - (Optional)


|p4= ignoreChildWindow (Optional): [[Boolean]]
|p4= ignoreChildWindow: [[Boolean]] - (Optional)


|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>[[playScriptedMission]]
|x1= <sqf>playScriptedMission
[
[
"desert_e",
"desert_e",
{
{
[[execVM]] "\ca\missions_e\data\scenes\credits1\init.sqf";
execVM "\ca\missions_e\data\scenes\credits1\init.sqf";
},
},
[[configFile]] / "CfgMissions" / "Cutscenes" / "Credits"
configFile / "CfgMissions" / "Cutscenes" / "Credits"
];
];</sqf>
</code>


|seealso= [[hostMission]], [[playMission]]
|seealso= [[hostMission]] [[playMission]]
}}
}}


{{GameCategory|arma3|Scripting Commands}}
{{Note
{{GameCategory|tkoh|Scripting Commands}}
|user= SkaceKachna
 
|timestamp= 20151231175500
<dl class="command_description">
|text= For this command to work, you will need to:
 
<dt></dt>
<dd class="notedate">Posted on December 31, 2015 - 17:55 (UTC)</dd>
<dt class="note">[[User:SkaceKachna|SkaceKachna]]</dt>
<dd class="note">
For this command to work, you will need to:
 
# call command with ignoreChildWindow param set to true (in VBS docs its called fromMission)
# call command with ignoreChildWindow param set to true (in VBS docs its called fromMission)
# close any opened display (not sure about this part, but closing every display (but #0) seems to work):
# close any opened display (not sure about this part, but closing every display (but #0) seems to work):
#* If mission is run from 2D editor, you can just close RscDisplayArcadeMap display (idd 26) (because this was done from 2D editor, so RscDisplayArcadeMap is still active in background -- [[user:benargee|benargee]])
#* if mission is run from 2D editor, you can just close RscDisplayArcadeMap display (idd 26) (because this was done from 2D editor, so RscDisplayArcadeMap is still active in background -- [[user:benargee|benargee]])
#* If mission is run from single mission browser, you can just close RscDisplaySingleMission (idd 2)
#* if mission is run from single mission browser, you can just close RscDisplaySingleMission (idd 2)
# end mission
# end mission


Line 63: Line 55:


Command is a bit bugged:
Command is a bit bugged:
* Third (config) param doesn't seem to work
* third (config) param doesn't seem to work
* If you run this command in mission loaded from pbo, said pbo won't be writable until you close the game (you can't update it)
* if you run this command in mission loaded from pbo, said pbo won't be writable until you close the game (you can't update it)


Following code will change change island to Stratis and spawns player as basic soldier at [0,0,0] coordinates.
Following code will change change island to Stratis and spawns player as basic soldier at [0,0,0] coordinates.
<code>[[disableSerialization]];
<sqf>
[[playScriptedMission]] ['Stratis', {
disableSerialization;
[[private]] _grp = [[createGroup]] [[west]];
playScriptedMission ['Stratis', {
[[private]] _player = _grp [[createUnit]] ["B_Soldier_F", [0,0,0], [], 0, "NONE"];
private _grp = createGroup west;
[[selectPlayer]] _player;
private _player = _grp createUnit ["B_Soldier_F", [0,0,0], [], 0, "NONE"];
}, [[missionConfigFile]], [[true]]];<br>
selectPlayer _player;
{{cc|Close all displays that could be the background display ... this is essentialy [[forceEnd]] command}}
}, missionConfigFile, true];
{{cc|Closing #0 will cause game to fail}}
 
_zero = [[findDisplay]] 0;
// Close all displays that could be the background display ... this is essentially forceEnd command
// Closing #0 will cause game to fail
_zero = findDisplay 0;
{
{
[[if]] (_x != _zero) [[then]] {
if (_x != _zero) then {
_x [[closeDisplay]] 1;
_x closeDisplay 1;
};
};
} [[foreach]] [[allDisplays]];<br>
} foreach allDisplays;
[[failMission]] "END1";</code>
failMission "END1";
</sqf>
(tested in {{arma3}} 1.54.133741)
(tested in {{arma3}} 1.54.133741)
</dd>
}}
 
</dl>

Latest revision as of 03:23, 1 August 2022

Hover & click on the images for description

Description

Description:
Load the given world, launch an empty mission, and execute the given expression. If provided, config can reference to the config entry, replacing Description.ext for this mission.
Groups:
System

Syntax

Syntax:
playScriptedMission [world, expression, config, ignoreChildWindow]
Parameters:
world: String
expression: Code
config: Config - (Optional)
ignoreChildWindow: Boolean - (Optional)
Return Value:
Nothing

Examples

Example 1:
playScriptedMission [ "desert_e", { execVM "\ca\missions_e\data\scenes\credits1\init.sqf"; }, configFile / "CfgMissions" / "Cutscenes" / "Credits" ];

Additional Information

See also:
hostMission playMission

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
SkaceKachna - c
Posted on Dec 31, 2015 - 17:55 (UTC)
For this command to work, you will need to:
  1. call command with ignoreChildWindow param set to true (in VBS docs its called fromMission)
  2. close any opened display (not sure about this part, but closing every display (but #0) seems to work):
    • if mission is run from 2D editor, you can just close RscDisplayArcadeMap display (idd 26) (because this was done from 2D editor, so RscDisplayArcadeMap is still active in background -- benargee)
    • if mission is run from single mission browser, you can just close RscDisplaySingleMission (idd 2)
  3. end mission
Debriefing will show and player will be moved to new mission after clicking on Continue.

Command is a bit bugged:
  • third (config) param doesn't seem to work
  • if you run this command in mission loaded from pbo, said pbo won't be writable until you close the game (you can't update it)
Following code will change change island to Stratis and spawns player as basic soldier at [0,0,0] coordinates.
disableSerialization; playScriptedMission ['Stratis', { private _grp = createGroup west; private _player = _grp createUnit ["B_Soldier_F", [0,0,0], [], 0, "NONE"]; selectPlayer _player; }, missionConfigFile, true]; // Close all displays that could be the background display ... this is essentially forceEnd command // Closing #0 will cause game to fail _zero = findDisplay 0; { if (_x != _zero) then { _x closeDisplay 1; }; } foreach allDisplays; failMission "END1";
(tested in Arma 3 1.54.133741)