HubsInfo Network
Login or Register to remove ads! You're browsing our forum and website as a Guest meaning you can only see a portion of the forum in read-only mode.
PHP MySQL Linux Material Design Web Hosting Online Games SimCity BuildIt

Adding scripts to SkyFireCore

0 Members and 1 Guest are viewing this topic.

Adding scripts to SkyFireCore
« 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
 



Linux Ubuntu Guides Linux games - Lutris.net