Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4077,3 +4077,13 @@ When setting a property like MORE to the a spell or skill defname, trying to rea
- Changed: Object timers are now saved in worldsave files as TIMERMS, to avoid ambiguity and reliance on git build number to determine if TIMER expressed a number in seconds or milliseconds.
- Changed: Added 5 seconds timeout to DNS hostname resolution at startup (avoid getting stuck when connectivity is enabled but not working).
- Changed: CANMASK formatted in worldsave files as hexadecimal number, instead of decimal.

23-11-2025, canerksk
- Added: Sound and item effects for failed spells have been added to the sphere.ini setting. Additionally, the local.Sound (r/w) variable has been added, in addition to the previously existing local.CreateObject1 (r/w) variable.
@SpellFail or @Fail
local.Sound=0 / 05C
[sphere.ini]:
- Added MagicFizzleSound = 05C // The sound made when cast fails/aborts
- Added MagicFizzleEffect = 03735 // ID of the effect that occurs when the cast fails/aborts


8 changes: 8 additions & 0 deletions src/game/CServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ CServerConfig::CServerConfig()
m_iWordsOfPowerTalkMode = TALKMODE_SPELL;
m_fEquippedCast = true;
m_iMagicUnlockDoor = 900;

m_iSpellTimeout = 0;

m_iSpell_Teleport_Effect_Staff = ITEMID_FX_FLAMESTRIKE; // drama
Expand All @@ -92,6 +93,9 @@ CServerConfig::CServerConfig()
m_iSpell_Teleport_Effect_NPC = ITEMID_FX_HEAL_EFFECT;
m_iSpell_Teleport_Sound_NPC = 0x01fe;

m_iSpell_Magic_Fizzle_Sound = SOUND_SPELL_FIZZLE;
m_iSpell_Magic_Fizzle_Effect = ITEMID_FX_SPELL_FAIL;

// Decay
m_iDecay_Item = 30ll * 60 * MSECS_PER_SEC;
m_iDecay_CorpsePlayer = 7ll * 60 * MSECS_PER_SEC;
Expand Down Expand Up @@ -600,6 +604,8 @@ enum RC_TYPE
RC_LOGMASK, // GetLogMask
RC_LOOTINGISACRIME, // m_fLootingIsACrime
RC_LOSTNPCTELEPORT, // m_fLostNPCTeleport
RC_MAGICFIZZLEEFFECT, // m_iSpell_Magic_Fizzle_Effect
RC_MAGICFIZZLESOUND, // m_iSpell_Magic_Fizzle_Sound
RC_MAGICFLAGS,
RC_MAGICUNLOCKDOOR, // m_iMagicUnlockDoor
RC_MANALOSSABORT, // m_fManaLossAbort
Expand Down Expand Up @@ -895,6 +901,8 @@ const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY + 1]
{ "LOGMASK", { ELEM_VOID, 0 }}, // GetLogMask
{ "LOOTINGISACRIME", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fLootingIsACrime) }},
{ "LOSTNPCTELEPORT", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iLostNPCTeleport) }},
{ "MAGICFIZZLEEFFECT", { ELEM_INT, static_cast<uint> OFFSETOF(CServerConfig,m_iSpell_Magic_Fizzle_Effect) }},
{ "MAGICFIZZLESOUND", { ELEM_INT, static_cast<uint> OFFSETOF(CServerConfig,m_iSpell_Magic_Fizzle_Sound) }},
{ "MAGICFLAGS", { ELEM_MASK_INT,static_cast<uint>OFFSETOF(CServerConfig,m_iMagicFlags) }},
{ "MAGICUNLOCKDOOR", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iMagicUnlockDoor) }},
{ "MANALOSSABORT", { ELEM_BOOL, static_cast<uint>OFFSETOF(CServerConfig,m_fManaLossAbort) }},
Expand Down
4 changes: 4 additions & 0 deletions src/game/CServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ extern class CServerConfig : public CResourceHolder
SOUND_TYPE m_iSpell_Teleport_Sound_Players; // Sound sent when a Player teleports.
ITEMID_TYPE m_iSpell_Teleport_Effect_Staff; // ID of the item shown when a Staff member teleports.
SOUND_TYPE m_iSpell_Teleport_Sound_Staff; // Sound sent when a Staff member teleports.

ITEMID_TYPE m_iSpell_Magic_Fizzle_Effect; //
SOUND_TYPE m_iSpell_Magic_Fizzle_Sound; // Sound sent when a fizzle.

int64 m_iSpellTimeout; // Timeout for spell targeting in seconds.

// In Game Effects
Expand Down
21 changes: 15 additions & 6 deletions src/game/chars/CCharSpell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3316,7 +3316,8 @@ bool CChar::Spell_CastDone()
void CChar::Spell_CastFail(bool fAbort)
{
ADDTOCALLSTACK("CChar::Spell_CastFail");
ITEMID_TYPE iT1 = ITEMID_FX_SPELL_FAIL;
ITEMID_TYPE iEffectId = g_Cfg.m_iSpell_Magic_Fizzle_Effect;
SOUND_TYPE iSound = g_Cfg.m_iSpell_Magic_Fizzle_Sound;

ushort iManaLoss = 0, iTithingLoss = 0;
CSpellDef *pSpell = g_Cfg.GetSpellDef(m_atMagery.m_iSpell);
Expand All @@ -3342,8 +3343,9 @@ void CChar::Spell_CastFail(bool fAbort)

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("CreateObject1", iEffectId);
pScriptArgs->m_VarsLocal.SetNum("TithingLoss", iTithingLoss);
pScriptArgs->m_VarsLocal.SetNum("Sound", iSound);

if ( IsTrigUsed(TRIGGER_SPELLFAIL) )
{
Expand All @@ -3363,11 +3365,18 @@ void CChar::Spell_CastFail(bool fAbort)
HUE_TYPE iColor = (HUE_TYPE)(pScriptArgs->m_VarsLocal.GetKeyNum("EffectColor"));
dword dwRender = (dword)pScriptArgs->m_VarsLocal.GetKeyNum("EffectRender");

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 );
iEffectId = (ITEMID_TYPE)(ResGetIndex((dword)pScriptArgs->m_VarsLocal.GetKeyNum("CreateObject1")));
iSound = (SOUND_TYPE)(pScriptArgs->m_VarsLocal.GetKeyNum("Sound"));

if (iEffectId != ITEMID_NOTHING)
{
Effect(EFFECT_OBJ, iEffectId, this, 1, 30, false, iColor, dwRender);
}
if (iSound != SOUND_NONE)
{
Sound(iSound);
}

if ( IsClientActive() )
GetClientActive()->addObjMessage( g_Cfg.GetDefaultMsg( DEFMSG_SPELL_GEN_FIZZLES ), this );

Expand Down
6 changes: 6 additions & 0 deletions src/sphere.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,12 @@ HitPointPercentOnRez=10
// Amount of skill of lock picking needed to unlock a magically locked door
MagicUnlockDoor=900

// ID of the effect that occurs when the cast fails/aborts
MagicFizzleSound=05C

// The sound made when cast fails/aborts
MagicFizzleEffect=03735

// Teleport effect for GMs and players. Setting 0 disables the effect
TeleportEffectNPC=0376a
TeleportEffectPlayers=03728
Expand Down