Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 1 of 1
  1. #1
    Graphics Guru

    Join Date
    Feb 2009
    Posts
    1,377
    Post Thanks / Like
    Rep Power
    22
    Reputation
    382

    How to add a custom script to your compile


    Register to remove this ad
    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.




      Code:
      ~/src/server/scripts/Custom




    • Add your script to the solution by opening the following file:


      Code:
      ~src\server\game\Scripting\ScriptLoader.cpp
      And adding your scripts beneath the /* comments as shown below.

      Code:
      #ifdef SCRIPTS  /* This is where custom scripts' loading functions should be declared. */ void AddSC_my_script();  #endif
      Code:

      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:

      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:

    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
    , 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
    , whom, I guess are familiar on how GIT works, use the following command:
    Code:
    
    
    git apply < mypatch.patch



    › See More: How to add a custom script to your compile
    Last edited by Wise; 02-11-12 at 10:37 AM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Visitors found this page by searching for:

how to add custom scritpt an d recompfile

script .cpp wow

custom script

SEO Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 06:42 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org