[DiscordArchive] But should it still be in the spell script itself? Thinking that "something else" is launching the m
[DiscordArchive] But should it still be in the spell script itself? Thinking that "something else" is launching the m
Archived author: syntaxhell • Posted: 2025-04-07T09:43:13.567000+00:00
Original source
But should it still be in the spell script itself? Thinking that "something else" is launching the missiles?
Archived author: ModoX • Posted: 2025-04-07T09:59:31.512000+00:00
Original source
Iirc maxtargets are set to 3 by db2 (you can see that in spellwork tool). So your spellscript should only do:
if not has aura
RandomResize to 1
Archived author: syntaxhell • Posted: 2025-04-07T09:59:56.731000+00:00
Original source
Huh okay, I thought there was something else I had to change too
Archived author: syntaxhell • Posted: 2025-04-07T10:00:14.742000+00:00
Original source
Shauren gave me really good pointers, where I obviously didn't look
Archived author: syntaxhell • Posted: 2025-04-07T10:00:19.568000+00:00
Original source
And thank you for the tips
Archived author: syntaxhell • Posted: 2025-04-07T10:00:31.673000+00:00
Original source
If I get this figured out, maybe I can make my very first PR
Archived author: syntaxhell • Posted: 2025-04-07T10:04:01.020000+00:00
Original source
Maybe I am doing the resize part wrong?
Archived author: ModoX • Posted: 2025-04-07T10:04:12.370000+00:00
Original source
Show code
Archived author: syntaxhell • Posted: 2025-04-07T10:04:20.665000+00:00
Original source
```class spell_warr_storm_bolt : public SpellScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({
SPELL_WARRIOR_STORM_BOLT_STUN
});
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.size() > 1)
Trinity::Containers::RandomResize(targets, 1);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
return;
// Apply the stun effect to the primary target
caster->CastSpell(target, SPELL_WARRIOR_STORM_BOLT_STUN, true);
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_storm_bolt::FilterTargets, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
OnEffectHitTarget += SpellEffectFn(spell_warr_storm_bolt::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY);
}
};```
Archived author: syntaxhell • Posted: 2025-04-07T10:04:37.784000+00:00
Original source
Maybe OnObjectAreaTargetSelect is the wrong way of doing it here