Jump to content
TrinityCore

want help with a basic smart_script


oRKENtaL
 Share

Recommended Posts

Hello,

I'm trying to get the hang of SmartAI but it's proving to be difficult. Starting with someone easy, I picked a random npc (Jaina, entry id 35320) and doing
event is on recieve_emote (id 17, which is kiss)
the action is DIE (37)
And target self.

xXKEa6d.jpg

UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 35320;

DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 35320); INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES (35320, 0, 0, 0, 22, 0, 100, 0, 17, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Lady Jaina Proudmoore - Received Emote 17 - Kill Self');

But the problem is that it doesn't work. I've resspawned her, restarted the server but she still doesn't die.
Any help would be most appreciated.

Thanks!

Edited by oRKENtaL
Link to comment
Share on other sites

You're welcome!

Emotes (NPCs): creature_addon, creature_template_addon and smarts (SMART_ACTION_PLAY_EMOTE (5) & SMART_ACTION_SET_EMOTE_STATE (17))

In creature addon tables you must use EMOTE_STATE only.

EmotesText (players): /kiss, etc.

Edited by Meji
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Selune
      Hi !
      I'm using last version of 3.3.5 TC branch (with TDB 335.19061), and we have an issue with the mage lvl 20 class quest (Investigate the Alchemist Shop).
      This bug has been reported and partially fixed by different people, as seen on this github page : https://github.com/TrinityCore/TrinityCore/issues/18997
      I tried to re-apply this :
      https://github.com/TrinityCore/TrinityCore/commit/aadd58284e94bc70c96244b61c3933db2211fed1
      The ghosts are now selectable but the box cannot be placed neither.
      Conclusion : at the moment, this quest is supposed to be fixed in #9717, but there are still problems with it. A c++ rewrite has even be proposed in 2014. This seems to be tricky though.
      Anyone here could maybe help me about it ?
      I'm trying to fix it for 3 days by myself, and quite confused now...
      Thanks in advance
       
    • By Mekonuts
      Hello and thanks for the reading first,
      i would love to know if there's a way to make a certain SmartScript force a player to cast certain Spell. I know there's a possibility of put and remove auras and sometimes the same Spell can be used as Aura to force the debuff of the same spell but i would like to know if there's a possibility to do this without need to do an scriptname.
      I used this as guide along this years: https://trinitycore.atlassian.net/wiki/spaces/tc/pages/2130108/smart+scripts
      I searched a bit for the TrinityCore issue tracker about this and didn't found anything useful about the question itself.
      Thanks for reading!
    • By frostys11
      Hey again,  I'm implementing the script for the Aman'thuls Vision trinket and the procs are working correct although it procs from pretty much anything like mounting etc. Is there anyway I can change that? I know this might have to do with the spellfamily masks in the spellclassoptions.db2 file. However, how does bit mask matching actually work? I tried to add a new bit mask in the spell_proc table in trinitycore but was unable to get it to work correctly. I could hardcode it in the script files to trigger from the spells I want but that would be an ugly solution in my opinion.
      The second question is that I get the wrong stat from Aman'Thul's Grandeur buff (http://www.wowhead.com/spell=256832/amanthuls-grandeur). I noticed it has four different auraeffects. How can i cast a spell in trintycore with a specific aura effect to get the right stat?
      The third question is that I have implemented the Acrid Catalyst trinket proc and the logic works correctly but I'm getting 0 stat for the buffs and the proc chance seems to be slightly off. How could I fix these two things? I guess its a db thing since the stat needs to scale accroding to the ilvl version of the trinket? I tried to look a trinitycore documentation regarding this and I cant seem to find nor can I find it in the mangos documentation
      This is the code for the two trinket implementations:
      enum AcridCatalystInjector
      {
          SPELL_FERVOR_OF_THE_LEGION = 253261, // Haste
          SPELL_BURTALITY_OF_THE_LEGION = 255742, // Critical
          SPELL_MALICE_OF_THE_LEGION = 255744, // Mastery
          SPELL_CYCLE_OF_THE_LEGION = 253260 // Haste, Mastery, and Critical
      };
      // Item - 151955: Acrid Catalyst Injector
      // 253259 - Item - Antorus, the Burning Throne (End raid of legion expansion)
      template <uint32 CriticalSpellId, uint32 HasteSpellId, uint32 MasterySpellId>
      class SpellItemAcridCatalystInjector : public SpellScriptLoader
      {
      public:
          SpellItemAcridCatalystInjector(char const* ScriptName) : SpellScriptLoader(ScriptName) { }
          template <uint32 Critical, uint32 Haste, uint32 Mastery>
          class SpellItemAcridCatalystInjectorAuraScript : public AuraScript
          {
              PrepareAuraScript(SpellItemAcridCatalystInjectorAuraScript);
              bool Validate(SpellInfo const* /*spellInfo*/) override
              {
                  return ValidateSpellInfo(
                      {
                          Critical,
                          Haste,
                          Mastery
                      });
              }
              void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
              {
                  /*if (eventInfo.GetHitMask() & PROC_HIT_CRITICAL)
                  {*/
                      static std::vector<uint32> const triggeredSpells[1] =
                      {
                          { Critical, Haste, Mastery }
                      };
                      PreventDefaultAction();
                      Unit* caster = eventInfo.GetActor();
                      std::vector<uint32> const& randomSpells = triggeredSpells[0];
                      if (randomSpells.empty())
                          return;
                      uint32 spellId = Trinity::Containers::SelectRandomContainerElement(randomSpells);
                      caster->CastSpell(caster, spellId, true, nullptr, aurEff);
                      for (std::vector<uint32>::const_iterator it = randomSpells.begin(); it != randomSpells.end(); ++it)
                      {
                          if (caster->HasAura((*it)))
                          {
                              auto trinketAura = caster->GetAura((*it));
                              if (trinketAura->GetStackAmount() >= 5)
                              {
                                  caster->CastSpell(caster, SPELL_CYCLE_OF_THE_LEGION, true, nullptr, aurEff);
                                  caster->RemoveAura(Critical);
                                  caster->RemoveAura(Haste);
                                  caster->RemoveAura(Mastery);
                                  break;
                              }
                          }
                      }
                  //}
              }
              void Register() override
              {
                  OnEffectProc += AuraEffectProcFn(SpellItemAcridCatalystInjectorAuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
              }
          };
          AuraScript* GetAuraScript() const override
          {
              return new SpellItemAcridCatalystInjectorAuraScript<CriticalSpellId, HasteSpellId, MasterySpellId>();
          }
      };
      enum AmanThulsVision
      {
          SPELL_GLIMPSE_OF_ENLIGHTENMENT = 256818,
          SPELL_AMANTHULS_GRANDEUR = 256832
      };
      // Item - 154172: Aman'Thul's Vision
      // 256817 - Item - Antorus, the Burning Throne (End raid of legion expansion)
      template <uint32 GlimpseOfEnlightenmentSpellId, uint32 AmanthulsGrandeurSpellId>
      class SpellItemAmanThulsVision : public SpellScriptLoader
      {
      public:
          SpellItemAmanThulsVision(char const* ScriptName) : SpellScriptLoader(ScriptName) { }
          template <uint32 GlimpseOfEnlightenment, uint32 AmanthulsGrandeur>
          class SpellItemAmanThulsVisionAuraScript : public AuraScript
          {
              PrepareAuraScript(SpellItemAmanThulsVisionAuraScript);
              bool Validate(SpellInfo const* /*spellInfo*/) override
              {
                  return ValidateSpellInfo(
                      {
                          GlimpseOfEnlightenment,
                          AmanthulsGrandeur
                      });
              }
              void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
              {
                  static std::vector<uint32> const triggeredSpells[1] =
                  {
                      { GlimpseOfEnlightenment, AmanthulsGrandeur }
                  };
                  PreventDefaultAction();
                  Unit* caster = eventInfo.GetActor();
                  caster->CastSpell(caster, GlimpseOfEnlightenment, true, nullptr, aurEff);
                  //AuraEffect* test = caster->GetAuraEffect(256817, EFFECT_2, GetCasterGUID());
            
                  caster->CastSpell(caster, AmanthulsGrandeur, true, nullptr, aurEff); //<--- How do I get the specific aureffect from SPELL_AMANTHULS_GRANDEUR?
                  //AuraEffect* test2 = caster->GetAuraEffect(SPELL_AMANTHULS_GRANDEUR, EFFECT_2, GetCasterGUID());
                  //caster->CastSpell(caster, AmanthulsGrandeur, true, nullptr, aurEff);
              }
              void Register() override
              {
                  OnEffectProc += AuraEffectProcFn(SpellItemAmanThulsVisionAuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
              }
          };
          AuraScript* GetAuraScript() const override
          {
              return new SpellItemAmanThulsVisionAuraScript<GlimpseOfEnlightenmentSpellId, AmanthulsGrandeurSpellId>();
          }
      };
    • By LordPsyan
      I am trying to make a spell script, something I have never messed with before. Simply put, a spell is cast upon you when you touch an object. I have that working, since that is a game object script. it also adds a 30 second duration, which also works, but does not show the countdown timer like many other spells. I think this needs to be done in a spell script, instead of newSpell->SetDuration(30000); in gameobject script.
      I cannot figure out how to get the timer working, and then get another spell cast upon the player.
      I have this set in my spell script, so if the spell is removed by any other means, the script shouldn't do anything:
                      if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
                          return;
      so to sum up my question:
      spell cast upon player. timer counts down 30 seconds, which gives player enough time to remove the spell, then at end of countdown, another spell cast upon player. Can anyone give me some sample code? I tried working with professor putricide spell codes, and the life bloom spell, but its just not triggering. Yes I added an entry in spell_script_names...
       
      Thanks.
×
×
  • Create New...