diff --git a/addons/Attach/config.cpp b/addons/Attach/config.cpp
index 7d13b8e3ef..b3c27dd628 100644
--- a/addons/Attach/config.cpp
+++ b/addons/Attach/config.cpp
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
class CfgPatches {
class ADDON {
units[] = {};
@@ -12,6 +14,9 @@ class CfgPatches {
};
};
+#include "CfgEventHandlers.hpp"
+
+/*
class CfgFunctions {
class ADDON {
class ADDON {
@@ -24,6 +29,7 @@ class CfgFunctions {
};
};
};
+*/
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
diff --git a/addons/Attach/functions/fn_attach.sqf b/addons/Attach/functions/fn_attach.sqf
index 18c1af6fd3..704dc2c9f0 100644
--- a/addons/Attach/functions/fn_attach.sqf
+++ b/addons/Attach/functions/fn_attach.sqf
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
/*
Author: eRazeri and CAA-Picard
diff --git a/addons/Attach/functions/fn_canAttach.sqf b/addons/Attach/functions/fn_canAttach.sqf
index 93aa3dd3d8..fe5191d7e2 100644
--- a/addons/Attach/functions/fn_canAttach.sqf
+++ b/addons/Attach/functions/fn_canAttach.sqf
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
/*
* Author: commy2
*
diff --git a/addons/Attach/functions/fn_canDetach.sqf b/addons/Attach/functions/fn_canDetach.sqf
index fd093c329e..3ddfc6c11e 100644
--- a/addons/Attach/functions/fn_canDetach.sqf
+++ b/addons/Attach/functions/fn_canDetach.sqf
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
/*
* Author: commy2
*
diff --git a/addons/Attach/functions/fn_detach.sqf b/addons/Attach/functions/fn_detach.sqf
index ad934e51ab..caf2eff400 100644
--- a/addons/Attach/functions/fn_detach.sqf
+++ b/addons/Attach/functions/fn_detach.sqf
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
/*
Author: eRazeri and CAA-Picard
diff --git a/addons/Attach/functions/fn_openAttachUI.sqf b/addons/Attach/functions/fn_openAttachUI.sqf
index dac3785227..f16832bf00 100644
--- a/addons/Attach/functions/fn_openAttachUI.sqf
+++ b/addons/Attach/functions/fn_openAttachUI.sqf
@@ -1,3 +1,5 @@
+#include "script_component.hpp"
+
/*
Name: AGM_Attach_fnc_openAttachUI
diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp
new file mode 100644
index 0000000000..f4997ba248
--- /dev/null
+++ b/addons/attach/CfgEventHandlers.hpp
@@ -0,0 +1,5 @@
+class Extended_PreInit_EventHandlers {
+ class ADDON {
+ init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_preInit.sqf) );
+ };
+};
\ No newline at end of file
diff --git a/addons/attach/XEH_preInit.sqf b/addons/attach/XEH_preInit.sqf
new file mode 100644
index 0000000000..7f953d62d9
--- /dev/null
+++ b/addons/attach/XEH_preInit.sqf
@@ -0,0 +1,7 @@
+#include "script_component.hpp"
+
+PREPF(attach);
+PREPF(canAttach);
+PREPF(canDetach);
+PREPF(detach);
+PREPF(openAttachUI);
\ No newline at end of file
diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp
index 5f1b50c61d..8207dd12c3 100644
--- a/addons/main/script_macros.hpp
+++ b/addons/main/script_macros.hpp
@@ -167,4 +167,8 @@
#define ACE_TEXT_ORANGE(Text) ("" + ##Text + "")
#define ACE_TEXT_RED(Text) ("" + ##Text + "")
#define ACE_TEXT_GREEN(Text) ("" + ##Text + "")
-#define ACE_TEXT_YELLOW(Text) ("" + ##Text + "")
\ No newline at end of file
+#define ACE_TEXT_YELLOW(Text) ("" + ##Text + "")
+
+
+#define PREPF(fncName) FUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf))
+#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf))
\ No newline at end of file