21:14 Rswow.ru - Worl... 3 Обычные сервера WoW от StaF
02:08 Бесплатный игро... 3 Обычные сервера WoW от morra
02:44 ^^Limit-WoW^^ ^... 3 Обычные сервера WoW от adidas9699
22:14 Xz-WoW.Ru [FUN]... 3 Обычные сервера WoW от Milko
Rareportal.com
Хочешь разместить тут рекламу бесплатно?

[ Главная страница ] [ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » TrinityCore » Установка / Настройка TrinityCore » Призываем NPC итемом
Призываем NPC итемом
STALKER Дата: Вторник, 06.03.2012, 12:44 | Сообщение # 1 Offline





Гл. Администратор

Сообщений: 326

Репутация: 300 +

Статус: Offline
Я думаю много кто с этого портала задавался таким вопросом. Зачем?
Привилегии для игроков, интересно же к примеру призвать лича, продавца к примеру каких либо зелий? Или же своего личного охранника? Или телепортера?
Ну приступим, нечего сложного не потребуется, правда скрипт нужно вливать в ядро!


1) Создадим файл с расширением .cpp и переимовываем его в item_custom_summon.
Открываем его любым редактором, пример Блокнот. И копипастим в него:


Code
  
  /*  
  * Copyright (C) 2008 - 2011 Trinity <http://www.trinitycore.org/]  
  *  
  * Copyright (C) 2006 - 2011 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/]  
  *  
  * Copyright (C) 2011 Arcanum Core <https://bitbucket.org/Dimitro/arcanum-core/]  
  *  
  * This program is free software; you can redistribute it and/or modify  
  * it under the terms of the GNU General Public License as published by  
  * the Free Software Foundation; either version 2 of the License, or  
  * (at your option) any later version.  
  *  
  * This program is distributed in the hope that it will be useful,  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
  * GNU General Public License for more details.  
  *  
  * You should have received a copy of the GNU General Public License  
  * along with this program; if not, write to the Free Software  
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
  */  

  #include "ScriptPCH.h"  

  #define NPC_ENTRY_TO_SUMMON "Y"  
  #define UNSUMMON_TIME "X"  

  class item_custom_summon : public ItemScript  
  {  
  public:  
             item_custom_summon() : ItemScript("item_custom_summon") {}  

             bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/)  
             {  
                     if ((pPlayer-]isInCombat()) || (pPlayer-]isInFlight()) || (pPlayer-]isDead()))  
                     {  
                             pPlayer-]SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);  
                             return false;  
                     }  

                     if (pPlayer-]IsMounted()) // Is player mounted  
                     {  
                             pPlayer-]SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);  
                             return true;  
                     }  

                     pPlayer-]SummonCreature(NPC_ENTRY_TO_SUMMON, pPlayer-]GetPositionX()+1, pPlayer-]GetPositionY(), pPlayer-]GetPositionZ()+2, 0, TEMPSUMMON_TIMED_DESPAWN, UNSUMMON_TIME);  
                     return false;  
             }  
  };  

  void AddSC_item_custom_summon()  
  {  
             new item_custom_summon();  
  }


Где

Code
#define NPC_ENTRY_TO_SUMMON "Y"  
  #define UNSUMMON_TIME "X"

X-Время на которое призывается NPC, указывать в миллисекундах, к примеру минута будет: #define NPC_ENTRY_TO_SUMMON 60000 (кавычки и переменную меняете на свое значение!)
Y-Entry(id) вашего NPC (кавычки и переменную меняете на свое значение!)
Теперь сохраняем и помещаем этот файл в
Code
..\исходники\src\server\scripts\Custom\

Ну и компилим, как обычно.


2) Теперь приступим к предмету, для того чтобы все работало нужно указать название скрипта в поле ScriptName(Название указывать без расширения .cpp).
Вот и все ваш нпк и предмет готовы к работе!
 
Форум » TrinityCore » Установка / Настройка TrinityCore » Призываем NPC итемом
  • Страница 1 из 1
  • 1
Поиск: