Professional Documents
Culture Documents
We will assume that your linked your script using 'AddSC_my_script', if you don't know what that means, check other scripts to see how they are
linked. You first need to add under ' /* This is where custom scripts' loading functions should be declared. / ' and under '/ This is where custom
scripts should be added. */' at the bottom of the file the lines:
void AddSC_my_script();
AddSC_my_script();
Example
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
void AddSC_my_script();
#endif
and
void AddCustomScripts(){
#ifdef SCRIPTS
/* This is where custom scripts should be added. */
AddSC_my_script();
#endif
}
Open the TrinityCore solution file (~build-directory/TrinityCore.sln using the designated compiler that you selected during the CMake process).
Under the scripts project (left hand side of the screen), press the arrow on the left to open the project dependencies. Then right click on the Sour
ce Files folder, and select 'Add' -> 'Existing Item'. Navigate to the location of your custom script (should be something like
C:/Trinity/src/server/scripts/custom), select your script and press 'Add' or 'OK'.
Linux
Start by placing scripts in source directory:
~/TrinityCore/src/server/scripts/Custom
Next link each script into the build:
sudo vi ~/TrinityCore/src/server/scripts/Custom/CMakeLists.txt
add each script with a line break before the Parenthesis and after the Curly Brace with <font color="darkblue">Custom/</font> in front of each
script.
Example:
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
Custom/CS3.cpp
Custom/CS2.cpp
Custom/CS1.cpp
)
Note: Some script types (such as CommandScripts) do not need to be linked to anything in the DB
Example
Note: You might need to edit the creature/gameobject/etc to make sure the script has effect. For example, if you have created a gossip script for
a creature, you will need to set creature_template.npcflag=1 to enable gossip flag on the creature or the script will not work.