Likes: 0
Results 1 to 1 of 1
-
02-11-12, 10:33 AM #1
How to add a custom script to your compile
Register to remove this adMethod 1) Adding a custom script with CMake
Lets get this straight, you pulled the source, and have some .cpp scripts laying around you want to add to it. Fair enough, lets add them.
- Start by placing scripts in source directory.
Code:~/src/server/scripts/Custom
- Add your script to the solution by opening the following file:
Code:~src\server\game\Scripting\ScriptLoader.cpp
Code:#ifdef SCRIPTS /* This is where custom scripts' loading functions should be declared. */ void AddSC_my_script(); #endif
Code:void AddCustomScripts(){ #ifdef SCRIPTS /* This is where custom scripts should be added. */ AddSC_my_script(); #endif }
- Open the CMakeLists.txt and add each script to it as following:
Code:
Code:set(scripts_STAT_SRCS ${scripts_STAT_SRCS} Custom/CS3.cpp Custom/CS2.cpp Custom/CS1.cpp ) message(" -> Prepared: Custom")
Some scripts will require you do add some SQL queries to your database in order for them to work, whilst that should be straight forward, if adding your own code, you'd add it as following:
Code:
Code:UPDATE `areatrigger_scripts` SET ScriptName='my_script' WHERE `entry`=XXXX; UPDATE `creature_template` SET ScriptName='my_script' WHERE `entry`=XXXXX; UPDATE `gameobject_template` SET ScriptName='my_script' WHERE `entry`=XXXXXX; UPDATE `instance_template` SET ScriptName='my_script' WHERE `map`=XXX; UPDATE `item_template` SET ScriptName='my_script' WHERE `entry`=XXXXX;
That's all. Now compile it, and hope that you encounter no errors. (Else you'll have to dive into the code and fix whatever is wrong.)
Method 2) Applying a patch via GIT.
Another popular method to add custom stuff to the core is by applying a patch. People who follow my guide on compiling, already useGIT Extensions, where applying a patch is as easy as right clicking the source folder, and clicking 'Apply patch' in the GIT Extensions tab. For people not usingGIT Extensions, whom, I guess are familiar on how GIT works, use the following command:
Code:git apply < mypatch.patch
› See More: How to add a custom script to your compileLast edited by Wise; 02-11-12 at 10:37 AM.
- Start by placing scripts in source directory.