HubsInfo Network

Gaming => Online Games & Servers => World of Warcraft => Topic started by: Remix on May 24, 2014, 06:41:47 AM

Title: Adding scripts to SkyFireCore
Post by: Remix on May 24, 2014, 06:41:47 AM
You can add custom scripts as you would do it with trinity, you create a new cpp file on src/server/scripts/custom, for example src/server/scripts/custom/my_custom.cpp, then, inside of that file you create your script, remember to create the function void AddSC_my_custom() or wathever you call it, inside of that function you put this: new , this way:
my script is called my_custom
void AddSC_my_custom()
{
new my_custom();
}
then, you open src/server/game/scripting/scriptloader.cpp and search for this line: void AddCustomScripts(), inside of that function you must insert the name of the function that you created without the void, this way
void AddCustomScripts()
{
#ifdef SCRIPTS
/* This is where custom scripts should be added. */
AddSC_my_custom()
#endif
}
then you scroll up a little bit and you will see this line
/* This is where custom scripts' loading functions should be declared. */
there you must set the name of your function plus the void
like this
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
void AddSC_my_custom()
#endif

now, just 1 step to go, you go to src/server/scripts/custom (i guess here is where your script is at) and open the Cmakelist.txt file
modify it this way
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
Custom/my_custom.cpp
)

message(" -> Prepared: Custom")+
you must use Custom/ plus the name of your script and the extension of the file
and thats all, now you recompile and assign the name of the script to a npc if its a npc script, if it is a playerscript then you dont need to add it to the db