FANDOM


Adding the script to the Solution Bearbeiten

Assuming you created a script called My_script.cpp in C:\Trinity\src\server\scripts\Custom directory, if you are reading this guide it means you can't figure out how to put it in your solution and compile it with the rest of the source.

If you are converting an older script, be sure to replace #include "precompiled.h" with #include "ScriptedPch.h"

Open the file: C:\Trinity\src\server\game\Scripting\ScriptLoader.cpp

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 '//custom' at the top of the file and under '//custom' at the bottom of the file the lines:

void AddSC_my_script();
AddSC_my_script();

Example

//custom
void AddSC_my_script();

//examples
void AddSC_example_creature();
void AddSC_example_escort();
void AddSC_example_gossip_codebox();
void AddSC_example_misc();

and

//custom
AddSC_my_script();

//examples
AddSC_example_creature();
AddSC_example_escort();
AddSC_example_gossip_codebox();
AddSC_example_misc();

Adding the script to the Scripts project Bearbeiten

Windows Bearbeiten

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 Source 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'.

You are done! Now you can build the solution.

Linux Bearbeiten

Simply add the following line to /home/trinity/core_directory/src/scripts/CMakeLists.txt:

/custom/my_script.cpp

Adding the script to the Database Bearbeiten

You need to link the script to the appropriate areatrigger/creature/gameobject/instance/item the script is for.

Example

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;

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.

Störung durch Adblocker erkannt!


Wikia ist eine gebührenfreie Seite, die sich durch Werbung finanziert. Benutzer, die Adblocker einsetzen, haben eine modifizierte Ansicht der Seite.

Wikia ist nicht verfügbar, wenn du weitere Modifikationen in dem Adblocker-Programm gemacht hast. Wenn du sie entfernst, dann wird die Seite ohne Probleme geladen.