Wise
02-11-12, 10:33 AM
Method 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.
~/src/server/scripts/Custom
Add your script to the solution by opening the following file:
~src\server\game\Scripting\ScriptLoader.cpp
And adding your scripts beneath the /* comments as shown below.
#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:
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:
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 use
GIT Extensions (http://code.google.com/p/gitextensions/)
, 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 using
GIT Extensions (http://code.google.com/p/gitextensions/)
, whom, I guess are familiar on how GIT works, use the following command:
git apply < mypatch.patch
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.
~/src/server/scripts/Custom
Add your script to the solution by opening the following file:
~src\server\game\Scripting\ScriptLoader.cpp
And adding your scripts beneath the /* comments as shown below.
#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:
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:
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 use
GIT Extensions (http://code.google.com/p/gitextensions/)
, 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 using
GIT Extensions (http://code.google.com/p/gitextensions/)
, whom, I guess are familiar on how GIT works, use the following command:
git apply < mypatch.patch