Added local.sound to spell fail triggers (see #1520)

This commit is contained in:
David Kindl 2026-07-23 14:19:48 +02:00
parent fc6eedbd82
commit 420dc2bfd4
No known key found for this signature in database
GPG key ID: AF8B556A96DF4C32
2 changed files with 12 additions and 2 deletions

View file

@ -4127,7 +4127,7 @@ When setting a property like MORE to the a spell or skill defname, trying to rea
local.BypassMagicReflection (R/W): When set to a value above 0, bypass the magic reflection.
- Fixed: Poison buff was using the expired timer duration instead of the poison delay timer.
Notice that the delay values of poison are hardcoded and you have to use addbuff function if you change the local.delay in @SpellEffectTick/@EffectTick
Notice that the delay values of poison are hardcoded and you have to use addbuff function if you change the local.delay in @SpellEffectTick/@EffectTick
02-04-2026, Mulambo
- Fixed: Timer on field spells with `SPELLFLAG_FIELD_RANDOMDECAY` was incrementally increasing for each field item created.
@ -4141,3 +4141,6 @@ When setting a property like MORE to the a spell or skill defname, trying to rea
19-05-2026, nightNR
- Fixed: pre-AOS armor rating (AR) calculation (#1550).
- Fixed NPCs can't cast spells from spellbook after respawn (#1551).
23-07-2026, canerksk
- Added: New local variable local.Sound to @SpellFail/@Fail triggers (R/W). If you set local.sound = 0, no sound will be played.

View file

@ -3398,9 +3398,11 @@ void CChar::Spell_CastFail(bool fAbort)
iTithingLoss = g_Cfg.Calc_SpellTithingCost(this, pSpell, m_Act_Prv_UID.ObjFind());
}
SOUND_TYPE iSound = SOUND_SPELL_FIZZLE;
CScriptTriggerArgsPtr pScriptArgs = CScriptParserBufs::GetCScriptTriggerArgsPtr();
pScriptArgs->Init(m_atMagery.m_iSpell, iManaLoss, 0, m_Act_Prv_UID.ObjFind());
pScriptArgs->m_VarsLocal.SetNum("CreateObject1",iT1);
pScriptArgs->m_VarsLocal.SetNum("Sound", iSound);
pScriptArgs->m_VarsLocal.SetNum("TithingLoss", iTithingLoss);
if ( IsTrigUsed(TRIGGER_SPELLFAIL) )
@ -3424,7 +3426,12 @@ void CChar::Spell_CastFail(bool fAbort)
iT1 = (ITEMID_TYPE)(ResGetIndex((dword)pScriptArgs->m_VarsLocal.GetKeyNum("CreateObject1")));
if (iT1)
Effect(EFFECT_OBJ, iT1, this, 1, 30, false, iColor, dwRender);
Sound( SOUND_SPELL_FIZZLE );
iSound = static_cast<SOUND_TYPE>(pScriptArgs->m_VarsLocal.GetKeyNum("Sound"));
if (iSound)
{
Sound(iSound);
}
if ( IsClientActive() )
GetClientActive()->addObjMessage( g_Cfg.GetDefaultMsg( DEFMSG_SPELL_GEN_FIZZLES ), this );