Angepinnt How to add a custom script

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • How to add a custom script

      If you start with a new .cpp/.h file you have to add it to the right project and link it to cmake.

      1. Create a new .cpp/.h files
      1.1 Go to your main folder (the one you choose for cmake).
      1.2 Navigate to src/scripts/src/
      1.3 Choose the right project (in this example we choose "GossipScripts")
      1.4 Create your new file. (in this example I create ExampleScript.cpp and ExampleScript.h)

      2. Add your new files to CMakeLists
      2.1 Go to your main folder (the one you choose for cmake).
      2.2 Navigate to cmake\scripts\gossipscripts
      2.3 Open the CMakeLists.txt
      2.4 Add your files to the CmakeLists.txt

      3. Re-Run cmake
      Run cmake. After cmake is done you will find your files in the vs project "GossipScripts"

      4. Add your scripts to Setup.cpp/.h and to your npc
      4.1 Link your script to your npc:



      1. #include "ExampleScript.h" // include our header
      2. #include "Setup.h" // include the Setup header
      3. class ExampleScript : public Arcemu::Gossip::Script
      4. {
      5. YOUR SCRIP...
      6. };
      7. // Register the script to the npc
      8. void ExampleScript(ScriptMgr* mgr)
      9. { //(NPC_ID, Our Script)
      10. mgr->register_creature_gossip(30051, new ExampleScript);
      11. }
      Alles anzeigen

      4.2 Open Setup.cpp and Setup.h and add the following lines:
      Add the lines near to the other registered scripts.



      1. ExampleScript(mgr);



      1. ExampleScript(ScriptMgr* mgr);

      Done :)
      Now you can start with your script. Make shure you set the right flags in creature_proto table.

      Best wishes