====== ArmA 2 Scripting ====== [[https://www.pmctactical.org/forum/viewforum.php?f=50|ArmA 2 Forum]], [[:arma2|ArmA 2 Home]], [[arma2:config|ArmA 2 Config]], [[arma2:file_formats|ArmA 2 File Formats]], [[arma2:missions|ArmA 2 Missions]], [[arma2:modeling|ArmA 2 3D Modeling]], [[arma2:scripting|ArmA 2 Scripting]], [[arma2:terrain|ArmA 2 Terrain]], [[arma2:texturing|ArmA 2 Texturing]], [[arma2:tools|ArmA 2 Tools]] ArmA 2 will be largely compatible with Armed Assault. To make porting of content from ArmA as simple as possible, there are few important things: * using of undefined variable in scripts (nil value) will be in ArmA 2 strictly reported as an error. All variables used in any scripts must be initialized before first use. * in ArmA 2 namespaces will be introduced for user scripts and variables. There are many low level reasons to do this and most of the content will be not be affected by this in any negative way. However, in order to be prepared, it is very important to separate UI related scripts and code as much as possible and not simply share global variables between UI and missions as UI namespace needs to be handled differently. * in order to maintain smooth frame rate in real-time content, time limit for all scripts in each frame is enforced by the engine in ArmA 2. Generally speaking, in case of more demanding scripts, be prepared that their result may come way later and also there probably can suffer from significant latency. It is under evaluation if and how possibly allow user scripts to change how much time they may take from the CPU in every frame. * SQS script format will be fully supported in ArmA 2 (but they should never be used). **initJIPcompatible.sqf** initJIPcompatible.sqf gets called from the MP mission framework (scripts in modules MP directory). A script waits until the player object is initialized and execs initJIPcompatible.sqf on clients (all clients, even those that were allready there at mission start as it is basically the same). Has nothing todo with init.sqf. [[arma2:scripting:basics_of_sqf|Basics of SQF]] Multiplayer [[arma2:scripting:dedicated_server_broadcasting|Dedicated server broadcasting]] to all clients. Some [[arma2:scripting:code_optimization|Code optimization]] tips. [[arma2:scripting:zone_markers|Zone Markers]] creating script for warning zones. [[arma2:scripting:ied_usage|IED usage]] improvised explosive device usage through script. Few more [[arma2:scripting:comref|Scripting command reference]] items. [[arma2:scripting:common_scripting_errors|Common scripting errors]] help you to debug your code. [[arma2:scripting:group_in_vehicle|Group in Vehicle]] check. [[arma2:scripting:bis_fnc_spawngroup|BIS_fnc_spawnGroup]] how to create whole groups from CfgGroups class. [[arma2:scripting:bis_fnc_findsafepos|BIS_fnc_findSafePos]] how to find safe position with open ground etc. Global scripts dir or common scripts dir is very useful. This feature has been known since OFP, check out the details from [[arma:scripting#global_scripts_dir|ArmA: Scripting - Global scripts dir]], as same feature works in ArmA 2. Howto create and use [[arma2:scripting:object-compositions|Object Compositions]] in missions. [[arma2:scripting:addpublicvariableeventhandler|addPublicVariableEventhandler]] examples. [[arma2:scripting:benchmark-cutscene|Benchmark Cutscene]] [[arma2:scripting:enablesaving|enableSaving]] and why its useful to disable.