Jump to content

Server Sided Custom Mount Script

By bfx
in Serverside

Recommended Posts

Greetings Model-Changing community,

I posted this on Emu-devs not too long ago maybe someone has use for it.

How to setup?

Create an item in the database with an on use effect, use a test spell such as http://www.wowhead.com/spell=33208/gossip-npc-periodic-talk

modify scriptname column to the scriptname of the script and you're done.

Limitations

When re logging visual of mount is removed and the current mount aura will override it.

Tooltip of spell still shows the real mount aura(your mount visual will obviously be different however)

enum mount_timer
{
    MOUNT_TIMER = 3000,
};

enum MountSpells
{
    SPELL_MOUNT_SPECTRAL_TIGER = 42777, //We use this as the actual mount spell, the display id overrides it via the script.
};

enum MountDisplayIds
{
    RABID_BEAR_MOUNT_DISPLAY_ID = 1082,
};

/* [Reins Of The Custom Bear] */
class item_reins_of_the_custom_bear : public ItemScript
{
public:
    item_reins_of_the_custom_bear() : ItemScript("item_reins_of_the_custom_bear") { }

    bool OnUse(Player* player, Item* item, SpellCastTargets const& targets)
    {
        player->CastSpell(player, SPELL_MOUNT_SPECTRAL_TIGER, false); //A mount spell to modify ground movement speed
        player->m_Events.AddEvent(new reins_of_the_custom_bear_handler(player), player->m_Events.CalculateTime(MOUNT_TIMER)); // OnUse is instant so we need to delay the changing of mount visual until cast is complete.
        return true;
    }

    class reins_of_the_custom_bear_handler : public BasicEvent
    {
    public:
        reins_of_the_custom_bear_handler(Player* player) : player(player) {}

        bool Execute(uint64 /*time*/, uint32 /*diff*/)
        {
            if (player->HasAura(SPELL_MOUNT_SPECTRAL_TIGER)) //Check if mounted before changing mount visual, prevents bugs
            {
                player->Mount(RABID_BEAR_MOUNT_DISPLAY_ID); //The custom mount display id
            }
            return true;
        }
        Player* player;
    };
};

void AddSC_item_custom_mounts() 
{
    new item_reins_of_the_custom_bear();
}

 

Link to comment
Share on other sites

×
×
  • Create New...