Forum > Serverside Modding

Passive Spell Scripting

(1/1)

Caedes:
Hey, I'm trying to script Twist of Fate on the 'newest' Trinity 6.2.4 core (took the last source before they merged legion into 6.x) and my hook doesn't seem to work.

--- Code: --- class spell_pri_twist_of_fate_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pri_twist_of_fate_AuraScript);

bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_TWIST_OF_FATE))
return false;
return true;
}

bool CheckProc(ProcEventInfo& eventInfo)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "bool CheckProc got called.");
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
if (eventInfo.GetActionTarget()->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellInfo, eventInfo.GetActor()))
sWorld->SendServerMessage(SERVER_MSG_STRING, "'If' returns true.");
return true;
sWorld->SendServerMessage(SERVER_MSG_STRING, "'If' returns false.");
return false;
}
void Register() override
{
DoCheckProc += AuraCheckProcFn(spell_pri_twist_of_fate_AuraScript::CheckProc);
}
--- End code ---

The spell gets called by 109.142 (that's the Twist of Fate passive you get from choosing the talent) in the DB and I checked the number & script name a hundred times already. None of the server messages are sent when used and the passive procs the healing bonus whenever I heal without checking the health of my target (which is also how it works when I completely remove the script).

What I've tried to do to fix this:
- I've tried changing hooks (from DoCheckProc to OnEffectProc and others), but the script still doesn't get called. I've also made sure that the core doesn't 'unapply' the script on loading due to faulty dbc data by checking the server log output.
- There also don't seem to be any warnings while compiling.

schlumpf:
No idea about why it isn't called, but note that C++ isn't python. Indentation ≠ a block.


--- Code: ---if (x)
  a();
  b();
--- End code ---

will execute b even if !x. Always use braces:


--- Code: ---if (x)
{
  a();
  b();
}
--- End code ---

Caedes:
Oh, thanks for the input!

I've fixed the problem. It was indeed a spelling error (but not where I thought it would be). /facepalm.

Navigation

[0] Message Index

Go to full version