• Страница 1 из 1
  • 1
Модератор форума: INFERNOS  
Мой НПС такого еще нигде не видал
nekropolis
Скаут
Вообщем суть такова НПС под видом Паладина стоит там где поставите)
Игрок подходит и кидает ему дуэль))
кастует как паладин)
Убил 2 часа) на скриптовку так как в программировании не особо силен )

При 10% жизней у моба или у игрока дуэль отменяется выигрывает тот у кого осталось больше 10%
При несчастном случае то есть ударил в конце очень сильно моб умер ) поставил функцию авто респавна
Немного поработал над комбо в кастах , он сначала кидает стан , потом экзорцизм, и сразу открывается хилка мгновенка он ее и юзает )
Берите может кому пригодится, а может кто то допишет или улучшит) я думаю сделать под все классы по такому мобу)



SQL
Code

REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (900111, 0, 0, 0, 0, 0, 30199, 0, 0, 0, 'Paladin', 'FreeDom', 'pvp', 0, 85, 85, 0, 35, 35, 1, 1, 1, 1, 1, 2500.4, 2790.2, 0, 4600, 1, 2000, 0, 1, 0, 0, 0, 0, 0, 2, 0, 720, 1050.6, 320, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 68000, 20000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 363, 0, 0, 'test_npc_mikolas', 12340);

test_npc_mikolas.cpp
Code

/*######
       ## test_npc_mikolas
       ######*/
#include "ScriptPCH.h"

#define SAY_ENTER1                  -1560013
#define SAY_ENTER2                  -1560014
#define SAY_ENTER3                  -1560015
#define SAY_AGGRO1                  -1560016
#define SAY_AGGRO2                  -1560017
#define SAY_SLAY1                   -1560018
#define SAY_SLAY2                   -1560019
#define SAY_BREATH1                 -1560020
#define SAY_BREATH2                 -1560021
#define SAY_DEATH                   -1560022

#define SPELL_SAND_BREATH           853
#define SPELL_HILKA           635
#define SPELL_MAGIC_DISRUPTION_AURA 31801
#define SPELL_WING_BUFFET           879

/// айди спелов дуэлей не трогайте!!
#define SPELL_DUEL  52996   ///
#define SPELL_DUELS 52996   ///
#define SPELL_DUEL_VICTORY  52994   ///
#define SPELL_DUEL_FLAG  52991  ///
///-----------------------------------

#define SPELL_IMUN                  26573
#define SPELL_HVATKA                24275
#define SPELL_UDARCHUMI             31884
#define SPELL_PANSIR                20271
#define SPELL_STOIKA    7294

#define GOSSIP_HAH "Ti to4no hotish PVP?"
#define GOSSIP_SAH "Nu davai posmotrim)."

class test_npc_mikolas: public CreatureScript {
public:
          test_npc_mikolas() :
                  CreatureScript("test_npc_mikolas") {
          }

          CreatureAI* GetAI(Creature* pCreature) const {
              return new test_npc_mikolasAI(pCreature);
          }
       // второе меню госипа
          bool OnGossipSelect(Player* pPlayer, Creature* pCreature,
                  uint32 /*uiSender*/, uint32 uiAction) {
              pPlayer->PlayerTalkClass->ClearMenus();
              switch (uiAction) {
              case GOSSIP_ACTION_INFO_DEF + 1:
                  pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
                  pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID());
                  break;
              case GOSSIP_ACTION_INFO_DEF + 2:
                  pPlayer->CLOSE_GOSSIP_MENU();
         pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true);
                  pCreature->setFaction(21);
                  if (pPlayer)
                      CAST_AI(test_npc_mikolas::test_npc_mikolasAI, pCreature->AI())->AttackStart(pPlayer);
                  break;
              }
              return true;
          }

       // Первое меню госипа

          bool OnGossipHello(Player* pPlayer, Creature* pCreature) {
                 
                  pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);

              pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID());
              

              return true;
          }

          struct test_npc_mikolasAI: public ScriptedAI {
              test_npc_mikolasAI(Creature *c) :
                      ScriptedAI(c)
          {

                m_bIsDuelInProgress = false;

              }
              bool lose;
              uint64 m_uiDuelerGUID;
              uint32 m_uiDuelTimer;
              bool m_bIsDuelInProgress;
        uint32 SandBreath_Timer;
              uint32 hilka_Timer;
              uint32 WingBuffet_Timer;
              uint32 Mda_Timer;

        uint32 IMUN_Timer;
        uint32 HVATKA_Timer;
        uint32 UDARCHUMI_Timer;
        uint32 PANSIR_Timer;
        uint32 STOIKA_Timer;

// таймеры
              void Reset()       
        {
                  me->setFaction(35);
         SandBreath_Timer = 1000 + rand() % 5000;
                  hilka_Timer = 25000 + rand() % 5000;
                  WingBuffet_Timer = 15000;
                  Mda_Timer = 25000;
         IMUN_Timer= 50000;
         HVATKA_Timer= 22000;
         UDARCHUMI_Timer= 13000;
         PANSIR_Timer= 7000;
         STOIKA_Timer= 3000;
               

              }

/// при входе в комбат варнякаем чет и кастум)

              void EnterCombat(Unit*)       
        {
          DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2), me);
            DoCast(me->getVictim(), SPELL_STOIKA);
                 
              }

              
             

         void SpellHit(Unit* pCaster, const SpellEntry* pSpell)       
        {
                  if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)       
         {
                      m_uiDuelerGUID = pCaster->GetGUID();
                      m_bIsDuelInProgress = true;

                       

                  }
              }

         void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
        {
                  if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer())       
         {

          // во время дуэли моб зеленый для других игроков

                      if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID)       
                          uiDamage = 0;
                      else if (uiDamage >= me->GetHealth())       
          {
                          uiDamage = 0;

                          if (!lose)       
           {
                    pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true);
                    pDoneBy->AttackStop();
                    me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true);
                    lose = true;
                    me->CastSpell(me, 7267, true);
                    me->RestoreFaction();

                          }

                      }
                  }
              }

// при смерти говорим SAY_DEATH

              void JustDied(Unit * /*who*/)
        {
                     
           DoScriptText(SAY_DEATH, me);
           me->Respawn();

               
              }

         void UpdateAI(const uint32 diff)
         {
                       
                  if (!UpdateVictim())
                      return;

///если у игрока  жизней меньше 10 % останавливаем дуэль и плачем)

          else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER
                    && me->getVictim()->HealthBelowPct(10))       
          {
                          me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg
                          me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);
           me->CastSpell(me, 7267, true);
              me->AttackStop();
                          DoResetThreat();
                          EnterEvadeMode();
                          return;
                      }
                        
///если у моба  жизней меньше 10 % останавливаем дуэль и плачем)

         if (me->HealthBelowPct(10))
         {
         me->AttackStop();
                  DoResetThreat();
                  EnterEvadeMode();
                  return;
               
         }

                  //Sand Breath
                  if (SandBreath_Timer <= diff) {
                      if (me->IsNonMeleeSpellCasted(false))
                          me->InterruptNonMeleeSpells(false);

                      DoCast(me->getVictim(), SPELL_SAND_BREATH);

                      DoScriptText(RAND(SAY_BREATH1, SAY_BREATH2), me);

                      SandBreath_Timer = 10000 + rand() % 10000;
                  } else
                      SandBreath_Timer -= diff;

                  if (hilka_Timer <= diff)       
         {
                     me->CastSpell(me, SPELL_HILKA, true);
                      hilka_Timer = 25000 + rand() % 5000;
                  } else
                      hilka_Timer -= diff;

                  if (WingBuffet_Timer <= diff)
         {
                      if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                          DoCast(pTarget, SPELL_WING_BUFFET);
                      WingBuffet_Timer = 25000 + rand() % 10000;
                  } else
                      WingBuffet_Timer -= diff;

                  if (Mda_Timer <= diff)
         {
                      DoCast(me, SPELL_MAGIC_DISRUPTION_AURA);
                      Mda_Timer = 15000;
                  } else
                      Mda_Timer -= diff;

         //______________________

         if (HVATKA_Timer <= diff)
         {
                      if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                          DoCast(pTarget, SPELL_HVATKA);
                      HVATKA_Timer = 25000 + rand() % 10000;
                  } else
                      HVATKA_Timer -= diff;

         if (IMUN_Timer <= diff)
         {
                      if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                          DoCast(pTarget, SPELL_IMUN);
                      IMUN_Timer = 25000 + rand() % 10000;
                  } else
                      IMUN_Timer -= diff;

         if (UDARCHUMI_Timer <= diff)
         {
                      if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                          DoCast(pTarget, SPELL_UDARCHUMI);
                      UDARCHUMI_Timer = 25000 + rand() % 10000;
                  } else
                      UDARCHUMI_Timer -= diff;

         if (PANSIR_Timer <= diff)
         {
                      if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                          DoCast(pTarget, SPELL_PANSIR);
                      PANSIR_Timer = 25000 + rand() % 10000;
                  } else
                      PANSIR_Timer -= diff;

                  DoMeleeAttackIfReady();
              }

          };
};

void AddSC_test_npc_mikolas() {
          new test_npc_mikolas();
               
}


Не забудьте добавить его в скриптлоадер )
Сообщение # 1 отредактировано nekropolis - Воскресенье, 29.07.2012, 13:32
doomkas
Центурион
Патч понравился, но то что моб говорит это не ок )
Сообщение # 2 написано 29.07.2012 в 12:18
_dm666
<3 Death Metal
doomkas, смени ид текстов или задефайнь свой текст .
Сообщение # 3 написано 30.07.2012 в 11:09
nekropolis
Скаут
Вот нем как рыба) только охкает ))
Code

/*######  
        ## test_npc_mikolas  
        ######*/  
#include "ScriptPCH.h"  

////#define SAY_ENTER1                  -1560013  
////#define SAY_ENTER2                  -1560014  
////#define SAY_ENTER3                  -1560015  
////#define SAY_AGGRO1                  -1560016  
////#define SAY_AGGRO2                  -1560017  
////#define SAY_SLAY1                   -1560018  
////#define SAY_SLAY2                   -1560019  
////#define SAY_BREATH1                 -1560020  
////#define SAY_BREATH2                 -1560021  
////#define SAY_DEATH                   -1560022  

#define SPELL_SAND_BREATH           853  
#define SPELL_HILKA           635  
#define SPELL_MAGIC_DISRUPTION_AURA 31801  
#define SPELL_WING_BUFFET           879  

/// айди спелов дуэлей не трогайте!!  
#define SPELL_DUEL  52996   ///  
#define SPELL_DUELS 52996   ///  
#define SPELL_DUEL_VICTORY  52994   ///  
#define SPELL_DUEL_FLAG  52991  ///  
///-----------------------------------  

#define SPELL_IMUN                  26573  
#define SPELL_HVATKA                24275  
#define SPELL_UDARCHUMI             31884  
#define SPELL_PANSIR                20271  
#define SPELL_STOIKA    7294  

#define GOSSIP_HAH "Ti to4no hotish PVP?"  
#define GOSSIP_SAH "Nu davai posmotrim)."  

class test_npc_mikolas: public CreatureScript {  
public:  
           test_npc_mikolas() :  
                   CreatureScript("test_npc_mikolas") {  
           }  

           CreatureAI* GetAI(Creature* pCreature) const {  
               return new test_npc_mikolasAI(pCreature);  
           }  
        // второе меню госипа  
           bool OnGossipSelect(Player* pPlayer, Creature* pCreature,  
                   uint32 /*uiSender*/, uint32 uiAction) {  
               pPlayer->PlayerTalkClass->ClearMenus();  
               switch (uiAction) {  
               case GOSSIP_ACTION_INFO_DEF + 1:  
                   pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);  
                   pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID());  
                   break;  
               case GOSSIP_ACTION_INFO_DEF + 2:  
                   pPlayer->CLOSE_GOSSIP_MENU();  
          pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true);  
                   pCreature->setFaction(21);  
                   if (pPlayer)  
                       CAST_AI(test_npc_mikolas::test_npc_mikolasAI, pCreature->AI())->AttackStart(pPlayer);  
                   break;  
               }  
               return true;  
           }  

        // Первое меню госипа  

           bool OnGossipHello(Player* pPlayer, Creature* pCreature) {  
                   
                   pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);  

               pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID());  
                

               return true;  
           }  

           struct test_npc_mikolasAI: public ScriptedAI {  
               test_npc_mikolasAI(Creature *c) :  
                       ScriptedAI(c)  
           {  

                 m_bIsDuelInProgress = false;  

               }  
               bool lose;  
               uint64 m_uiDuelerGUID;  
               uint32 m_uiDuelTimer;  
               bool m_bIsDuelInProgress;  
         uint32 SandBreath_Timer;  
               uint32 hilka_Timer;  
               uint32 WingBuffet_Timer;  
               uint32 Mda_Timer;  

         uint32 IMUN_Timer;  
         uint32 HVATKA_Timer;  
         uint32 UDARCHUMI_Timer;  
         uint32 PANSIR_Timer;  
         uint32 STOIKA_Timer;  

// таймеры  
               void Reset()        
         {  
                   me->setFaction(35);  
          SandBreath_Timer = 1000 + rand() % 5000;  
                   hilka_Timer = 25000 + rand() % 5000;  
                   WingBuffet_Timer = 15000;  
                   Mda_Timer = 25000;  
          IMUN_Timer= 50000;  
          HVATKA_Timer= 22000;  
          UDARCHUMI_Timer= 13000;  
          PANSIR_Timer= 7000;  
          STOIKA_Timer= 3000;  
                 

               }  

/// при входе в комбат варнякаем чет и кастум)  

               void EnterCombat(Unit*)        
         {  
           DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2), me);  
             DoCast(me->getVictim(), SPELL_STOIKA);  
                   
               }  

                
               

          void SpellHit(Unit* pCaster, const SpellEntry* pSpell)        
         {  
                   if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)        
          {  
                       m_uiDuelerGUID = pCaster->GetGUID();  
                       m_bIsDuelInProgress = true;  

                         

                   }  
               }  

          void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)  
         {  
                   if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer())        
          {  

           // во время дуэли моб зеленый для других игроков  

                       if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID)        
                           uiDamage = 0;  
                       else if (uiDamage >= me->GetHealth())        
           {  
                           uiDamage = 0;  

                           if (!lose)        
            {  
                     pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true);  
                     pDoneBy->AttackStop();  
                     me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true);  
                     lose = true;  
                     me->CastSpell(me, 7267, true);  
                     me->RestoreFaction();  

                           }  

                       }  
                   }  
               }  

// при смерти говорим SAY_DEATH  

               void JustDied(Unit * /*who*/)  
         {  
                       
            DoScriptText(SAY_DEATH, me);  
            me->Respawn();  

                 
               }  

          void UpdateAI(const uint32 diff)  
          {  
                         
                   if (!UpdateVictim())  
                       return;  

///если у игрока  жизней меньше 10 % останавливаем дуэль и плачем)  

           else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER  
                     && me->getVictim()->HealthBelowPct(10))        
           {  
                           me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg  
                           me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true);  
            me->CastSpell(me, 7267, true);  
               me->AttackStop();  
                           DoResetThreat();  
                           EnterEvadeMode();  
                           return;  
                       }  
                          
///если у моба  жизней меньше 10 % останавливаем дуэль и плачем)  

          if (me->HealthBelowPct(10))  
          {  
          me->AttackStop();  
                   DoResetThreat();  
                   EnterEvadeMode();  
                   return;  
                 
          }  

                   //Sand Breath  
                   if (SandBreath_Timer <= diff) {  
                       if (me->IsNonMeleeSpellCasted(false))  
                           me->InterruptNonMeleeSpells(false);  

                       DoCast(me->getVictim(), SPELL_SAND_BREATH);  

                       DoScriptText(RAND(SAY_BREATH1, SAY_BREATH2), me);  

                       SandBreath_Timer = 10000 + rand() % 10000;  
                   } else  
                       SandBreath_Timer -= diff;  

                   if (hilka_Timer <= diff)        
          {  
                      me->CastSpell(me, SPELL_HILKA, true);  
                       hilka_Timer = 25000 + rand() % 5000;  
                   } else  
                       hilka_Timer -= diff;  

                   if (WingBuffet_Timer <= diff)  
          {  
                       if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))  
                           DoCast(pTarget, SPELL_WING_BUFFET);  
                       WingBuffet_Timer = 25000 + rand() % 10000;  
                   } else  
                       WingBuffet_Timer -= diff;  

                   if (Mda_Timer <= diff)  
          {  
                       DoCast(me, SPELL_MAGIC_DISRUPTION_AURA);  
                       Mda_Timer = 15000;  
                   } else  
                       Mda_Timer -= diff;  

          //______________________  

          if (HVATKA_Timer <= diff)  
          {  
                       if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))  
                           DoCast(pTarget, SPELL_HVATKA);  
                       HVATKA_Timer = 25000 + rand() % 10000;  
                   } else  
                       HVATKA_Timer -= diff;  

          if (IMUN_Timer <= diff)  
          {  
                       if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))  
                           DoCast(pTarget, SPELL_IMUN);  
                       IMUN_Timer = 25000 + rand() % 10000;  
                   } else  
                       IMUN_Timer -= diff;  

          if (UDARCHUMI_Timer <= diff)  
          {  
                       if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))  
                           DoCast(pTarget, SPELL_UDARCHUMI);  
                       UDARCHUMI_Timer = 25000 + rand() % 10000;  
                   } else  
                       UDARCHUMI_Timer -= diff;  

          if (PANSIR_Timer <= diff)  
          {  
                       if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))  
                           DoCast(pTarget, SPELL_PANSIR);  
                       PANSIR_Timer = 25000 + rand() % 10000;  
                   } else  
                       PANSIR_Timer -= diff;  

                   DoMeleeAttackIfReady();  
               }  

           };  
};  

void AddSC_test_npc_mikolas() {  
           new test_npc_mikolas();  
                 
}  
Сообщение # 4 написано 30.07.2012 в 11:33
doomkas
Центурион
+ сик дал за старание, тестанул все работает, но ставить себе его не буду )
Сообщение # 5 написано 30.07.2012 в 20:40
StivenStiffler
Скаут
Делал такое год назад через SmartAI на ныне закрытом сервере Global 3.3.5. Игрокам нравились бои с ними.
Цитата
поставлены нпц - дуэлянты в Штормград/Оргриммар, как только вы одержите победу над ним вы получите немного золота и с не большим шансом получите эмблему триумфа

Вконтакте - Добавлены новые нпц - Дуэлянты.
Сделал классы прист(с выбором шп или дц), дк, паладин, маг под разные уровни.


Но ты через ядро можешь сделать гораздо лучше. Так что продолжай.
Сообщение # 6 отредактировано StivenStiffler - Воскресенье, 13.01.2013, 14:51
XkillerX
Сержант
Ранее выкладывалось для 3.3.5...
С 0 писал или все таки переделал?
Сайт: Athear
Форум: Athear/Forum
Set realmlist Athear.ru
Сообщение # 7 написано 14.01.2013 в 11:23
nekropolis
Скаут
C нуля мужик за основу взял коды квестовых нпс У ДК
Сообщение # 8 написано 26.01.2013 в 15:05
  • Страница 1 из 1
  • 1
Поиск: