{"name":"Arma 3: Eden Editor Event Handlers","title":"Arma 3: Eden Editor Event Handlers","type":"topic","url":"https://community.bistudio.com/wiki/Arma_3:_Eden_Editor_Event_Handlers","revid":376091,"updated":"2025-08-15T03:30:27Z","aliases":["Arma 3: Event Handlers: Eden Editor"],"markdown":"### Editor Event Handlers\n\nEden Editor Event Handlers are added to the editor instance and will remain active for the duration of a session.\nLaunching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance.\n\n#### Related commands\n\n- add3DENEventHandler\n- remove3DENEventHandler\n\n#### Event Scripts\n\n- See init3DEN.sqf\n\n#### Config\n\nAlternatively, you can define event handlers directly in the config.\nUse your custom section (**mySection** in the example) to prevent overriding handlers from other sources.\nHandlers defined here will automatically be added when Eden Editor is opened.\n\n```cpp\nclass Cfg3DEN\n{\n    class EventHandlers\n    {\n        class mySection\n        {\n            onUndo = \"hint 'Undo';\";\n            // <handlerName> = <handlerExpression>\n        };\n    };\n};\n```\n\n#### Events\n\nThe following Magic Variables are available inside the event's code:\n\n- Event Handler parameters are accessible via `_this` (only if event has parameters)\n- The Event Handler type is available as `_thisEvent`\n- The Event Handler index is available as `_thisEventHandler`\n\n> [!NOTE]\n> - Most handlers do not receive any arguments; this is intended, as in most cases required data can be obtained using either get3DENActionState or specialised 'get*' Eden Editor commands.\n> - Note that unlike object's or mission's event handlers, the **On** prefix is present in both config and command event name.\n\n##### Init\n\nIs executed when Eden Editor display was created. Only happens when Eden Editor is opened for the first time during game session, only available through config modding.\n\n```cpp\ninit = \" params ['_display3DEN']; systemChat 'First Eden launch this session'; \";\n```\n\n- display3DEN: Display\n\n##### OnBeforeMissionPreview (Arma 3 v2.18)\n\nRuns before the scenario preview is started. If an event handler of this type returns true, the mission preview will not be initialised.\n\n```sqf\nadd3DENEventHandler [\"OnBeforeMissionPreview\", {\n    params [\"_isPreviewMultiplayer\"];\n}];\n```\n\n##### OnConnectingStart\n\nWhen Connecting operation is initiated.\n\n```sqf\nadd3DENEventHandler [\"OnConnectingStart\", {\n    params [\"_class\", \"_from\"];\n}];\n```\n\n- class: Config - connection config class\n- from: Array of Eden Entities\n\n##### OnConnectingEnd\n\nWhen Connecting operation is terminated, no matter if it was confirmed or canceled.\n\n```sqf\nadd3DENEventHandler [\"OnConnectingEnd\", {\n    params [\"_class\", \"_from\", \"_to\"];\n}];\n```\n\n- class: Config - connection config class\n- from: Array of 3DEN entities\n- to: Eden Entity (when connecting was successful) or nil (when connecting was terminated)\n\n##### OnCopy\n\nFires when entities are copied.\nAlso fires when entities are cut, but unlike OnCut, OnCopy fires before the entities are deleted, meaning the entities are still accessible with get3DENSelected.\n\n```sqf\nadd3DENEventHandler [\"OnCopy\", {\n    // no arguments\n}];\n```\n\n##### OnCut\n\nFires when entities are cut (after the entities have been deleted).\n\n```sqf\nadd3DENEventHandler [\"OnCut\", {\n    // no arguments\n}];\n```\n\n##### OnDeleteUnits\n\nWhen entities are deleted.\n\n```sqf\nadd3DENEventHandler [\"OnDeleteUnits\", {\n    // no arguments\n}];\n```\n\n##### OnEditableEntityAdded (Arma 3 v2.18)\n\nWhen an entity gets added to the scenario. When compositions are added, the event triggers for every entity in the composition.\n\n```sqf\nadd3DENEventHandler [\"OnEditableEntityAdded\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity\n\n##### OnEditableEntityRemoved (Arma 3 v2.18)\n\nWhen an entity gets removed from the scenario.\n\n```sqf\nadd3DENEventHandler [\"OnEditableEntityRemoved\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity\n\n##### OnEntityAttributeChanged (Arma 3 v2.18)\n\nWhen an entity's attribute got changed. Fires for each changed attribute separately.\n\n```sqf\nadd3DENEventHandler [\"OnEntityAttributeChanged\", {\n    params [\"_entity\", \"_property\"];\n}];\n```\n\n- entity: Eden Entity\n- property: String - property name of the attribute that was changed\n\n##### OnEntityDragged (Arma 3 v2.18)\n\nWhen an entity gets dragged. Fires continiously until the left mouse button is released.\n\n```sqf\nadd3DENEventHandler [\"OnEntityDragged\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity\n\n##### OnEntityMenu\n\nWhen Entity Context Menu is opened.\n\n```sqf\nadd3DENEventHandler [\"OnEntityMenu\", {\n    params [\"_position\", \"_entity\", \"_listPath\"];\n}];\n```\n\n- position: Array - Position where user clicked to open the menu.\n  - Entity position when clicked on an entity.\n  - Empty array when clicked on something that doesn't have position (i.e. abstract folder in Edit list like BLUFOR, Trigger, etc.)\n- entity: Eden Entity\n  - Nil when clicked on empty space\n- listPath: Array - UI tree path when clicked on entity in the entity list.\n  - Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)\n\n##### OnEntityParentChanged (Arma 3 v2.18)\n\nFires when the parent of an entity changes. For example, creating waypoints, moving entities into layers or out of layers.\nIt seems that this EH always fires twice. First event returns objNull for _newParentEntityID.\n\n```sqf\nadd3DENEventHandler [\"OnEntityParentChanged\", {\n    params [\"_affectedEntity\", \"_newParentEntityID\"]\n}];\n```\n\n- affectedEntity: Array, Object, String, Number\n  - Array - waypoint\n  - Object - trigger, unit, vehicle, logic\n  - String - marker\n  - Number - layer\n- newParentEntityID: Number or objNull\n  - Number- the new parent entity\n  - objNull - If new parent entity is a system layer.\n\n##### OnGridChange\n\nWhen grid changes, either using Toolbar option, ot by scripting command set3DENGrid.\n\n```sqf\nadd3DENEventHandler [\"OnGridChange\", {\n    params [\"_gridType\", \"_gridValue\"];\n}];\n```\n\n- gridType: String - can be \"translation\", \"rotation\" or \"scaling\"\n- gridValue: Number\n\n##### OnHistoryChange\n\nWhen history changes.\n\n```sqf\nadd3DENEventHandler [\"OnHistoryChange\", {\n    // no arguments\n}];\n```\n\n##### OnMapClosed\n\nWhen map is closed.\n\n```sqf\nadd3DENEventHandler [\"OnMapClosed\", {\n    // no arguments\n}];\n```\n\n##### OnMapOpened\n\nWhen map is opened.\n\n```sqf\nadd3DENEventHandler [\"OnMapOpened\", {\n    // no arguments\n}];\n```\n\n##### OnMessage\n\nHandler used for showing on-screen notifications, triggered by various range of events.\nMessage IDs:\n\n- 0 - Mission saved\n- 1 - Mission autosaved\n- 2 - Trying to move a character into full vehicle\n- 3 - Moved character into enemy vehicle\n- 4 - Trying to run mission without any player\n- 5 - Mission exported to SP\n- 6 - Mission exported to MP\n- 7 - Attempting to delete a default layer\n\n```sqf\nadd3DENEventHandler [\"OnMessage\", {\n    params [\"_messageID\"];\n}];\n```\n\n- messageID: Number\n\n##### OnMissionAttributeChanged (Arma 3 v2.18)\n\nWhen a mission attribute or the preferences are changed.\n\n```sqf\nadd3DENEventHandler [\"OnMissionAttributeChanged\", {\n    params [\"_section\", \"_property\"];\n}];\n```\n\n- section - String - section name, see sections\n- property - String - property name of the attribute, see properties\n\n##### OnMissionAutosave\n\nWhen scenario is autosaved.\n\n```sqf\nadd3DENEventHandler [\"OnMissionAutosave\", {\n    // no arguments\n}];\n```\n\n##### OnMissionExportSP\n\nWhen a scenario is exported to singleplayer.\n\n```sqf\nadd3DENEventHandler [\"OnMissionExportSP\", {\n    // no arguments\n}];\n```\n\n##### OnMissionExportMP\n\nWhen a scenario is exported to multiplayer.\n\n```sqf\nadd3DENEventHandler [\"OnMissionExportMP\", {\n    // no arguments\n}];\n```\n\n##### OnMissionListChange\n\nWhen the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.\n\n```sqf\nadd3DENEventHandler [\"OnMissionListChange\", {\n    // no arguments\n}];\n```\n\n##### OnMissionLoad\n\nWhen scenario is loaded.\n\nIf a missing config is preventing the scenario from being loaded, this event handler will only be executed after pressing the \"Force Load\" button.\n\n```sqf\nadd3DENEventHandler [\"OnMissionLoad\", {\n    // no arguments\n}];\n```\n\n##### OnMissionNew\n\nWhen new scenario is started. Executed also when Eden is opened with an empty scenario.\n\n```sqf\nadd3DENEventHandler [\"OnMissionNew\", {\n    // no arguments\n}];\n```\n\n##### OnMissionPreview\n\nWhen scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.\n\n```sqf\nadd3DENEventHandler [\"OnMissionPreview\", {\n    params [\"_objects\", \"_groups\", \"_waypoints\", \"_markers\"];\n}];\n```\n\n- objects: Array\n- groups: Array\n- waypoints: Array\n- markers: Array\n\nEach array is in format:\n\n```\n[entity1, id1, entity2, id2, ..., entityN, idN]\n```\n\n- entity: Object, Group, Array or String\n- ID: Number\n\n##### OnMissionPreviewEnd\n\nWhen preview ends and user returns back to Eden Editor.\n\n> [!IMPORTANT]\n> In order to manipulate entities during this event the code needs to be run scheduled with some delay!\n\n```sqf\nadd3DENEventHandler [\"OnMissionPreviewEnd\", {\n    // no arguments\n}];\n```\n\n##### OnMissionSave\n\nWhen scenario is saved.\n\n```sqf\nadd3DENEventHandler [\"OnMissionSave\", {\n    // no arguments\n}];\n```\n\n##### OnMissionSaveAs\n\nWhen *Save As* action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).\n\n```sqf\nadd3DENEventHandler [\"OnMissionSaveAs\", {\n    // no arguments\n}];\n```\n\n##### OnModeChange\n\nWhen editing mode is changed (i.e. from Objects to Triggers).\n\n```sqf\nadd3DENEventHandler [\"OnModeChange\", {\n    // no arguments\n}];\n```\n\n##### OnMoveGridDecrease\n\n```sqf\nadd3DENEventHandler [\"OnMoveGridDecrease\", {\n    // params [\"?\"];\n}];\n```\n\n##### OnMoveGridIncrease\n\n```sqf\nadd3DENEventHandler [\"OnMoveGridIncrease\", {\n    // params [\"?\"];\n}];\n```\n\n##### OnMoveGridToggle\n\nWhen **translation** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnMoveGridToggle\", {\n    // no arguments\n}];\n```\n\n##### OnPaste\n\nWhen entities are pasted.\n\n```sqf\nadd3DENEventHandler [\"OnPaste\", {\n    // no arguments\n}];\n```\n\n##### OnPasteUnitOrig\n\nWhen entities are pasted on their original positions.\n\n```sqf\nadd3DENEventHandler [\"OnPasteUnitOrig\", {\n    // no arguments\n}];\n```\n\n##### OnRedo\n\nWhen undo operation is redone.\n\n```sqf\nadd3DENEventHandler [\"OnRedo\", {\n    // no arguments\n}];\n```\n\n##### OnRotateGridDecrease\n\n```sqf\nadd3DENEventHandler [\"OnRotateGridDecrease\", {\n    // params [\"?\"];\n}];\n```\n\n##### OnRotateGridIncrease\n\n```sqf\nadd3DENEventHandler [\"OnRotateGridIncrease\", {\n    // params [\"?\"];\n}];\n```\n\n##### OnRotateGridToggle\n\nWhen **rotation** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnRotateGridToggle\", {\n    // no arguments\n}];\n```\n\n##### OnScaleGridToggle\n\nWhen **area scaling** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnScaleGridToggle\", {\n    // no arguments\n}];\n```\n\n##### OnSearchCreate\n\nWhen \"SearchCreate\" action is triggered (e.g. when pressing Ctrl+Shift+F).\n\n```sqf\nadd3DENEventHandler [\"OnSearchCreate\", {\n    // no arguments\n}];\n```\n\n##### OnSearchEdit\n\nWhen \"SearchEdit\" action is triggered (e.g. when pressing Ctrl+F).\n\n```sqf\nadd3DENEventHandler [\"OnSearchEdit\", {\n    // no arguments\n}];\n```\n\n##### OnSelectionChange\n\nWhen entity selection changes. Use get3DENSelected to return currently selected entities.\n\n```sqf\nadd3DENEventHandler [\"OnSelectionChange\", {\n    // no arguments\n}];\n```\n\n##### OnServerToggle\n\nWhen server is created or destroyed from the preview.\n\n```sqf\nadd3DENEventHandler [\"OnServerToggle\", {\n    // no arguments\n}];\n```\n\n##### OnSubmodeChange\n\nWhen submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.\n\n```sqf\nadd3DENEventHandler [\"OnSubmodeChange\", {\n    // no arguments\n}];\n```\n\n##### OnSurfaceSnapToggle\n\nWhen surface snap settings are changed.\n\n```sqf\nadd3DENEventHandler [\"OnSurfaceSnapToggle\", {\n    // no arguments\n}];\n```\n\n##### OnTerrainNew\n\nWhen new terrain is loaded. Executed also when Eden is opened.\n\n```sqf\nadd3DENEventHandler [\"OnTerrainNew\", {\n    // no arguments\n}];\n```\n\n##### OnToggleMapIDs\n\nWhen map IDs are toggled with `do3DENAction \"ToggleMapIDs\"`. Only triggers if map is open.\n\n```sqf\nadd3DENEventHandler [\"OnToggleMapIDs\", {\n    // no arguments\n}];\n```\n\n##### OnToggleMapTextures\n\nWhen map textures are toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnToggleMapTextures\", {\n    // no arguments\n}];\n```\n\n##### OnTogglePlaceEmptyVehicle\n\nWhen the *Place vehicles with crew* is toggled on/off in Objects mode.\n\n```sqf\nadd3DENEventHandler [\"OnTogglePlaceEmptyVehicle\", {\n    // no arguments\n}];\n```\n\n##### OnUndo\n\nWhen an operation is undone.\n\n```sqf\nadd3DENEventHandler [\"OnUndo\", {\n    // no arguments\n}];\n```\n\n##### OnVerticalToggle\n\nWhen vertical mode settings are changed.\n\n```sqf\nadd3DENEventHandler [\"OnVerticalToggle\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetArea\n\nWhen area widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetArea\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetNone\n\nWhen no widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetNone\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetRotation\n\nWhen rotation widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetRotation\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetScale\n\nWhen scaling widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetScale\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetToggle\n\nWhen widget is toggled (i.e. browsing through all widget types)\n\n```sqf\nadd3DENEventHandler [\"OnWidgetToggle\", {\n    // no arguments\n}];\n```\n\n##### OnWidgetTranslation\n\nWhen translation widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetTranslation\", {\n    // no arguments\n}];\n```\n\n##### OnWorkspacePartSwitch\n\nWhen scenario phase is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWorkspacePartSwitch\", {\n    // no arguments\n}];\n```\n\n### Object Event Handlers\n\nEditor specific event handlers can be also added directly to objects, using addEventHandler command.\n\n> [!IMPORTANT]\n> These handlers exist only for the duration of active workspace.\n> Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again.\n\n#### Related commands\n\n- addEventHandler\n- removeEventHandler\n\n#### Events\n\n> [!NOTE]\n> Most handlers do not receive any arguments.\n> This is intended, because in most cases, required data can be obtained using either get3DENActionState or specialised 'get' commands.\n\n> [!IMPORTANT]\n> None of the following event handlers work for triggers.\n\n##### AttributesChanged3DEN\n\nFires when object's attributes are changed. Can happen when:\n\n- Changing the attributes by dragging, rotating or using one of the widgets\n- Changing and saving the attributes from within the attributes window\n- When attributes get changed using scripting commands such as set3DENAttributes or set3DENAttribute\n\nUnlike *Dragged3DEN* this event handler will not fire continuously but only when the attributes were changed **and** saved\n\n```sqf\nedenObject addEventHandler [\"AttributesChanged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object\n\n##### ConnectionChanged3DEN\n\nWhen a connection is added or removed from an object.\n\n```sqf\nedenObject addEventHandler [\"ConnectionChanged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object\n\n##### RegisteredToWorld3DEN\n\nWhen object is re-added to the scenario after undoing a delete operation.\n\n```sqf\nedenObject addEventHandler [\"RegisteredToWorld3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object\n\n##### UnregisteredFromWorld3DEN\n\nWhen object is removed from the scenario. That happens when you delete it, but also when you undo placement operation.\n\n```sqf\nedenObject addEventHandler [\"UnregisteredFromWorld3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object\n\n##### Dragged3DEN\n\nWhen object is **dragged** and/or **rotated**. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.\n\n```sqf\nedenObject addEventHandler [\"Dragged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object","sections":[{"heading":"Editor Event Handlers","level":3,"markdown":"Eden Editor Event Handlers are added to the editor instance and will remain active for the duration of a session.\nLaunching a preview will keep the event handlers, but closing the editor will erase all of them and you will have to add them again on the next Eden instance."},{"heading":"Related commands","level":4,"markdown":"- add3DENEventHandler\n- remove3DENEventHandler"},{"heading":"Event Scripts","level":4,"markdown":"- See init3DEN.sqf"},{"heading":"Config","level":4,"markdown":"Alternatively, you can define event handlers directly in the config.\nUse your custom section (**mySection** in the example) to prevent overriding handlers from other sources.\nHandlers defined here will automatically be added when Eden Editor is opened.\n\n```cpp\nclass Cfg3DEN\n{\n    class EventHandlers\n    {\n        class mySection\n        {\n            onUndo = \"hint 'Undo';\";\n            // <handlerName> = <handlerExpression>\n        };\n    };\n};\n```"},{"heading":"Events","level":4,"markdown":"The following Magic Variables are available inside the event's code:\n\n- Event Handler parameters are accessible via `_this` (only if event has parameters)\n- The Event Handler type is available as `_thisEvent`\n- The Event Handler index is available as `_thisEventHandler`\n\n> [!NOTE]\n> - Most handlers do not receive any arguments; this is intended, as in most cases required data can be obtained using either get3DENActionState or specialised 'get*' Eden Editor commands.\n> - Note that unlike object's or mission's event handlers, the **On** prefix is present in both config and command event name."},{"heading":"Init","level":5,"markdown":"Is executed when Eden Editor display was created. Only happens when Eden Editor is opened for the first time during game session, only available through config modding.\n\n```cpp\ninit = \" params ['_display3DEN']; systemChat 'First Eden launch this session'; \";\n```\n\n- display3DEN: Display"},{"heading":"OnBeforeMissionPreview (Arma 3 v2.18)","level":5,"markdown":"Runs before the scenario preview is started. If an event handler of this type returns true, the mission preview will not be initialised.\n\n```sqf\nadd3DENEventHandler [\"OnBeforeMissionPreview\", {\n    params [\"_isPreviewMultiplayer\"];\n}];\n```"},{"heading":"OnConnectingStart","level":5,"markdown":"When Connecting operation is initiated.\n\n```sqf\nadd3DENEventHandler [\"OnConnectingStart\", {\n    params [\"_class\", \"_from\"];\n}];\n```\n\n- class: Config - connection config class\n- from: Array of Eden Entities"},{"heading":"OnConnectingEnd","level":5,"markdown":"When Connecting operation is terminated, no matter if it was confirmed or canceled.\n\n```sqf\nadd3DENEventHandler [\"OnConnectingEnd\", {\n    params [\"_class\", \"_from\", \"_to\"];\n}];\n```\n\n- class: Config - connection config class\n- from: Array of 3DEN entities\n- to: Eden Entity (when connecting was successful) or nil (when connecting was terminated)"},{"heading":"OnCopy","level":5,"markdown":"Fires when entities are copied.\nAlso fires when entities are cut, but unlike OnCut, OnCopy fires before the entities are deleted, meaning the entities are still accessible with get3DENSelected.\n\n```sqf\nadd3DENEventHandler [\"OnCopy\", {\n    // no arguments\n}];\n```"},{"heading":"OnCut","level":5,"markdown":"Fires when entities are cut (after the entities have been deleted).\n\n```sqf\nadd3DENEventHandler [\"OnCut\", {\n    // no arguments\n}];\n```"},{"heading":"OnDeleteUnits","level":5,"markdown":"When entities are deleted.\n\n```sqf\nadd3DENEventHandler [\"OnDeleteUnits\", {\n    // no arguments\n}];\n```"},{"heading":"OnEditableEntityAdded (Arma 3 v2.18)","level":5,"markdown":"When an entity gets added to the scenario. When compositions are added, the event triggers for every entity in the composition.\n\n```sqf\nadd3DENEventHandler [\"OnEditableEntityAdded\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity"},{"heading":"OnEditableEntityRemoved (Arma 3 v2.18)","level":5,"markdown":"When an entity gets removed from the scenario.\n\n```sqf\nadd3DENEventHandler [\"OnEditableEntityRemoved\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity"},{"heading":"OnEntityAttributeChanged (Arma 3 v2.18)","level":5,"markdown":"When an entity's attribute got changed. Fires for each changed attribute separately.\n\n```sqf\nadd3DENEventHandler [\"OnEntityAttributeChanged\", {\n    params [\"_entity\", \"_property\"];\n}];\n```\n\n- entity: Eden Entity\n- property: String - property name of the attribute that was changed"},{"heading":"OnEntityDragged (Arma 3 v2.18)","level":5,"markdown":"When an entity gets dragged. Fires continiously until the left mouse button is released.\n\n```sqf\nadd3DENEventHandler [\"OnEntityDragged\", {\n    params [\"_entity\"];\n}];\n```\n\nentity - Eden Entity"},{"heading":"OnEntityMenu","level":5,"markdown":"When Entity Context Menu is opened.\n\n```sqf\nadd3DENEventHandler [\"OnEntityMenu\", {\n    params [\"_position\", \"_entity\", \"_listPath\"];\n}];\n```\n\n- position: Array - Position where user clicked to open the menu.\n  - Entity position when clicked on an entity.\n  - Empty array when clicked on something that doesn't have position (i.e. abstract folder in Edit list like BLUFOR, Trigger, etc.)\n- entity: Eden Entity\n  - Nil when clicked on empty space\n- listPath: Array - UI tree path when clicked on entity in the entity list.\n  - Nil when clicked in the scene (we cannot use empty array, because that's a path to root item)"},{"heading":"OnEntityParentChanged (Arma 3 v2.18)","level":5,"markdown":"Fires when the parent of an entity changes. For example, creating waypoints, moving entities into layers or out of layers.\nIt seems that this EH always fires twice. First event returns objNull for _newParentEntityID.\n\n```sqf\nadd3DENEventHandler [\"OnEntityParentChanged\", {\n    params [\"_affectedEntity\", \"_newParentEntityID\"]\n}];\n```\n\n- affectedEntity: Array, Object, String, Number\n  - Array - waypoint\n  - Object - trigger, unit, vehicle, logic\n  - String - marker\n  - Number - layer\n- newParentEntityID: Number or objNull\n  - Number- the new parent entity\n  - objNull - If new parent entity is a system layer."},{"heading":"OnGridChange","level":5,"markdown":"When grid changes, either using Toolbar option, ot by scripting command set3DENGrid.\n\n```sqf\nadd3DENEventHandler [\"OnGridChange\", {\n    params [\"_gridType\", \"_gridValue\"];\n}];\n```\n\n- gridType: String - can be \"translation\", \"rotation\" or \"scaling\"\n- gridValue: Number"},{"heading":"OnHistoryChange","level":5,"markdown":"When history changes.\n\n```sqf\nadd3DENEventHandler [\"OnHistoryChange\", {\n    // no arguments\n}];\n```"},{"heading":"OnMapClosed","level":5,"markdown":"When map is closed.\n\n```sqf\nadd3DENEventHandler [\"OnMapClosed\", {\n    // no arguments\n}];\n```"},{"heading":"OnMapOpened","level":5,"markdown":"When map is opened.\n\n```sqf\nadd3DENEventHandler [\"OnMapOpened\", {\n    // no arguments\n}];\n```"},{"heading":"OnMessage","level":5,"markdown":"Handler used for showing on-screen notifications, triggered by various range of events.\nMessage IDs:\n\n- 0 - Mission saved\n- 1 - Mission autosaved\n- 2 - Trying to move a character into full vehicle\n- 3 - Moved character into enemy vehicle\n- 4 - Trying to run mission without any player\n- 5 - Mission exported to SP\n- 6 - Mission exported to MP\n- 7 - Attempting to delete a default layer\n\n```sqf\nadd3DENEventHandler [\"OnMessage\", {\n    params [\"_messageID\"];\n}];\n```\n\n- messageID: Number"},{"heading":"OnMissionAttributeChanged (Arma 3 v2.18)","level":5,"markdown":"When a mission attribute or the preferences are changed.\n\n```sqf\nadd3DENEventHandler [\"OnMissionAttributeChanged\", {\n    params [\"_section\", \"_property\"];\n}];\n```\n\n- section - String - section name, see sections\n- property - String - property name of the attribute, see properties"},{"heading":"OnMissionAutosave","level":5,"markdown":"When scenario is autosaved.\n\n```sqf\nadd3DENEventHandler [\"OnMissionAutosave\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionExportSP","level":5,"markdown":"When a scenario is exported to singleplayer.\n\n```sqf\nadd3DENEventHandler [\"OnMissionExportSP\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionExportMP","level":5,"markdown":"When a scenario is exported to multiplayer.\n\n```sqf\nadd3DENEventHandler [\"OnMissionExportMP\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionListChange","level":5,"markdown":"When the current list of missions in the open/save mission dialog changes, i.e when first opened or a different folder is selected.\n\n```sqf\nadd3DENEventHandler [\"OnMissionListChange\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionLoad","level":5,"markdown":"When scenario is loaded.\n\nIf a missing config is preventing the scenario from being loaded, this event handler will only be executed after pressing the \"Force Load\" button.\n\n```sqf\nadd3DENEventHandler [\"OnMissionLoad\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionNew","level":5,"markdown":"When new scenario is started. Executed also when Eden is opened with an empty scenario.\n\n```sqf\nadd3DENEventHandler [\"OnMissionNew\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionPreview","level":5,"markdown":"When scenario preview is started. Executed when the scenario is already loaded, so entities in it can be accessed.\n\n```sqf\nadd3DENEventHandler [\"OnMissionPreview\", {\n    params [\"_objects\", \"_groups\", \"_waypoints\", \"_markers\"];\n}];\n```\n\n- objects: Array\n- groups: Array\n- waypoints: Array\n- markers: Array\n\nEach array is in format:\n\n```\n[entity1, id1, entity2, id2, ..., entityN, idN]\n```\n\n- entity: Object, Group, Array or String\n- ID: Number"},{"heading":"OnMissionPreviewEnd","level":5,"markdown":"When preview ends and user returns back to Eden Editor.\n\n> [!IMPORTANT]\n> In order to manipulate entities during this event the code needs to be run scheduled with some delay!\n\n```sqf\nadd3DENEventHandler [\"OnMissionPreviewEnd\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionSave","level":5,"markdown":"When scenario is saved.\n\n```sqf\nadd3DENEventHandler [\"OnMissionSave\", {\n    // no arguments\n}];\n```"},{"heading":"OnMissionSaveAs","level":5,"markdown":"When *Save As* action is triggered (i.e. Save window is opened, but the mission is not necessarily saved yet).\n\n```sqf\nadd3DENEventHandler [\"OnMissionSaveAs\", {\n    // no arguments\n}];\n```"},{"heading":"OnModeChange","level":5,"markdown":"When editing mode is changed (i.e. from Objects to Triggers).\n\n```sqf\nadd3DENEventHandler [\"OnModeChange\", {\n    // no arguments\n}];\n```"},{"heading":"OnMoveGridDecrease","level":5,"markdown":"```sqf\nadd3DENEventHandler [\"OnMoveGridDecrease\", {\n    // params [\"?\"];\n}];\n```"},{"heading":"OnMoveGridIncrease","level":5,"markdown":"```sqf\nadd3DENEventHandler [\"OnMoveGridIncrease\", {\n    // params [\"?\"];\n}];\n```"},{"heading":"OnMoveGridToggle","level":5,"markdown":"When **translation** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnMoveGridToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnPaste","level":5,"markdown":"When entities are pasted.\n\n```sqf\nadd3DENEventHandler [\"OnPaste\", {\n    // no arguments\n}];\n```"},{"heading":"OnPasteUnitOrig","level":5,"markdown":"When entities are pasted on their original positions.\n\n```sqf\nadd3DENEventHandler [\"OnPasteUnitOrig\", {\n    // no arguments\n}];\n```"},{"heading":"OnRedo","level":5,"markdown":"When undo operation is redone.\n\n```sqf\nadd3DENEventHandler [\"OnRedo\", {\n    // no arguments\n}];\n```"},{"heading":"OnRotateGridDecrease","level":5,"markdown":"```sqf\nadd3DENEventHandler [\"OnRotateGridDecrease\", {\n    // params [\"?\"];\n}];\n```"},{"heading":"OnRotateGridIncrease","level":5,"markdown":"```sqf\nadd3DENEventHandler [\"OnRotateGridIncrease\", {\n    // params [\"?\"];\n}];\n```"},{"heading":"OnRotateGridToggle","level":5,"markdown":"When **rotation** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnRotateGridToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnScaleGridToggle","level":5,"markdown":"When **area scaling** grid is toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnScaleGridToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnSearchCreate","level":5,"markdown":"When \"SearchCreate\" action is triggered (e.g. when pressing Ctrl+Shift+F).\n\n```sqf\nadd3DENEventHandler [\"OnSearchCreate\", {\n    // no arguments\n}];\n```"},{"heading":"OnSearchEdit","level":5,"markdown":"When \"SearchEdit\" action is triggered (e.g. when pressing Ctrl+F).\n\n```sqf\nadd3DENEventHandler [\"OnSearchEdit\", {\n    // no arguments\n}];\n```"},{"heading":"OnSelectionChange","level":5,"markdown":"When entity selection changes. Use get3DENSelected to return currently selected entities.\n\n```sqf\nadd3DENEventHandler [\"OnSelectionChange\", {\n    // no arguments\n}];\n```"},{"heading":"OnServerToggle","level":5,"markdown":"When server is created or destroyed from the preview.\n\n```sqf\nadd3DENEventHandler [\"OnServerToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnSubmodeChange","level":5,"markdown":"When submode (e.g. BLUFOR or OFPOR for Objects, or Modules for Systems) changes.\n\n```sqf\nadd3DENEventHandler [\"OnSubmodeChange\", {\n    // no arguments\n}];\n```"},{"heading":"OnSurfaceSnapToggle","level":5,"markdown":"When surface snap settings are changed.\n\n```sqf\nadd3DENEventHandler [\"OnSurfaceSnapToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnTerrainNew","level":5,"markdown":"When new terrain is loaded. Executed also when Eden is opened.\n\n```sqf\nadd3DENEventHandler [\"OnTerrainNew\", {\n    // no arguments\n}];\n```"},{"heading":"OnToggleMapIDs","level":5,"markdown":"When map IDs are toggled with `do3DENAction \"ToggleMapIDs\"`. Only triggers if map is open.\n\n```sqf\nadd3DENEventHandler [\"OnToggleMapIDs\", {\n    // no arguments\n}];\n```"},{"heading":"OnToggleMapTextures","level":5,"markdown":"When map textures are toggled on or off.\n\n```sqf\nadd3DENEventHandler [\"OnToggleMapTextures\", {\n    // no arguments\n}];\n```"},{"heading":"OnTogglePlaceEmptyVehicle","level":5,"markdown":"When the *Place vehicles with crew* is toggled on/off in Objects mode.\n\n```sqf\nadd3DENEventHandler [\"OnTogglePlaceEmptyVehicle\", {\n    // no arguments\n}];\n```"},{"heading":"OnUndo","level":5,"markdown":"When an operation is undone.\n\n```sqf\nadd3DENEventHandler [\"OnUndo\", {\n    // no arguments\n}];\n```"},{"heading":"OnVerticalToggle","level":5,"markdown":"When vertical mode settings are changed.\n\n```sqf\nadd3DENEventHandler [\"OnVerticalToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetArea","level":5,"markdown":"When area widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetArea\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetNone","level":5,"markdown":"When no widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetNone\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetRotation","level":5,"markdown":"When rotation widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetRotation\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetScale","level":5,"markdown":"When scaling widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetScale\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetToggle","level":5,"markdown":"When widget is toggled (i.e. browsing through all widget types)\n\n```sqf\nadd3DENEventHandler [\"OnWidgetToggle\", {\n    // no arguments\n}];\n```"},{"heading":"OnWidgetTranslation","level":5,"markdown":"When translation widget is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWidgetTranslation\", {\n    // no arguments\n}];\n```"},{"heading":"OnWorkspacePartSwitch","level":5,"markdown":"When scenario phase is selected.\n\n```sqf\nadd3DENEventHandler [\"OnWorkspacePartSwitch\", {\n    // no arguments\n}];\n```"},{"heading":"Object Event Handlers","level":3,"markdown":"Editor specific event handlers can be also added directly to objects, using addEventHandler command.\n\n> [!IMPORTANT]\n> These handlers exist only for the duration of active workspace.\n> Running a preview or loading the same scenario again will erase all object event handlers, because objects themselves are despawned from the world and then created again."},{"heading":"Related commands","level":4,"markdown":"- addEventHandler\n- removeEventHandler"},{"heading":"Events","level":4,"markdown":"> [!NOTE]\n> Most handlers do not receive any arguments.\n> This is intended, because in most cases, required data can be obtained using either get3DENActionState or specialised 'get' commands.\n\n> [!IMPORTANT]\n> None of the following event handlers work for triggers."},{"heading":"AttributesChanged3DEN","level":5,"markdown":"Fires when object's attributes are changed. Can happen when:\n\n- Changing the attributes by dragging, rotating or using one of the widgets\n- Changing and saving the attributes from within the attributes window\n- When attributes get changed using scripting commands such as set3DENAttributes or set3DENAttribute\n\nUnlike *Dragged3DEN* this event handler will not fire continuously but only when the attributes were changed **and** saved\n\n```sqf\nedenObject addEventHandler [\"AttributesChanged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object"},{"heading":"ConnectionChanged3DEN","level":5,"markdown":"When a connection is added or removed from an object.\n\n```sqf\nedenObject addEventHandler [\"ConnectionChanged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object"},{"heading":"RegisteredToWorld3DEN","level":5,"markdown":"When object is re-added to the scenario after undoing a delete operation.\n\n```sqf\nedenObject addEventHandler [\"RegisteredToWorld3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object"},{"heading":"UnregisteredFromWorld3DEN","level":5,"markdown":"When object is removed from the scenario. That happens when you delete it, but also when you undo placement operation.\n\n```sqf\nedenObject addEventHandler [\"UnregisteredFromWorld3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object"},{"heading":"Dragged3DEN","level":5,"markdown":"When object is **dragged** and/or **rotated**. Also triggers when widgets are used to manipulate position and orientation. Does not trigger when the object's size is changed.\n\n```sqf\nedenObject addEventHandler [\"Dragged3DEN\", {\n    params [\"_object\"];\n}];\n```\n\n- object: Object - affected object"}],"categories":["Eden Editor: Modding","Event Handlers","To-do"],"groups":["Event Handlers"]}