Welcome to AC Web.
Results 1 to 6 of 6
  1. #1


    Join Date
    Dec 2010
    Location
    www.TheForgottenCrusade.net
    Posts
    870

    Add spells to gameobjects?


    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    How does one exactly add spells to gameobjects on click?

    Example: Buff players when clicking on food gameobject.
    Or Knockback when clicking on explosive barrel.

  2. #2
    You can do it with c++, smart scripts or lua.

    In my opinion would be easier to go with c++.


  3. #3


    Join Date
    Dec 2010
    Location
    www.TheForgottenCrusade.net
    Posts
    870
    Quote Originally Posted by mindsear View Post
    You can do it with c++, smart scripts or lua.

    In my opinion would be easier to go with c++.

    I pref lua or smart_scripts for this task tbh.

  4. #4
    I don't use smart scripts, but if I recall correctly, that OnReportUse event should be supported in smart scripts as well.

    If you want a C++ script example, there's plenty of examples available in TrinityCore

    Here's one, using the master branch of TrinityCore:

    Code:
    class go_activation_crystal : public GameObjectScript
    {
        public:
            go_activation_crystal() : GameObjectScript("go_activation_crystal") { }
    
            bool OnGossipHello(Player* player, GameObject* /*go*/) override
            {
                player->CastSpell(player, SPELL_CRYSTAL_ACTIVATION, true);
                return false;
            }
    };
    Or if you're using 3.3.5 branch:

    Code:
    class go_activation_crystal : public GameObjectScript
    {
        public:
            go_activation_crystal() : GameObjectScript("go_activation_crystal") { }
    
            struct go_activation_crystalAI : public GameObjectAI
            {
                go_activation_crystalAI(GameObject* go) : GameObjectAI(go) { }
    
                bool GossipHello(Player* player) override
                {
                    player->CastSpell(player, SPELL_CRYSTAL_ACTIVATION, true);
                    return false;
                }
            };
    
            GameObjectAI* GetAI(GameObject* go) const override
            {
                return GetVioletHoldAI<go_activation_crystalAI>(go);
            }
    };
    Last edited by Krudor; 06-23-2018 at 01:51 PM. Reason: Added 3.3.5 version of script

  5. #5
    weird like that

    Join Date
    Feb 2010
    Location
    http://rochet2.github.io/
    Posts
    5,250
    you can also use gameobject type 10 and set the entry of an event_scripts table row to the eventid field (see documentation for which data column it is in gameobject_template)

  6. #6


    Join Date
    Dec 2010
    Location
    www.TheForgottenCrusade.net
    Posts
    870

    REGISTER! (FREE)
    Registered members see less ads
    and also gain access to other great features.
    Quote Originally Posted by Rochet2 View Post
    you can also use gameobject type 10 and set the entry of an event_scripts table row to the eventid field (see documentation for which data column it is in gameobject_template)
    A bit confusing, will try to get around it.
    Last edited by Nerc; 06-25-2018 at 11:43 PM.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •