[DiscordArchive] Could you overwrite this immunity with a spell script?
[DiscordArchive] Could you overwrite this immunity with a spell script?
Archived author: Crane • Posted: 2025-07-30T12:18:13.617000+00:00
Original source
Could you overwrite this immunity with a spell script?
Archived author: Northstrider • Posted: 2025-07-30T12:18:30.472000+00:00
Original source
You can,ye
Archived author: Crane • Posted: 2025-07-30T12:20:11.403000+00:00
Original source
You would have to set this dunkrion _me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
_me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true); to false in a spellscript
Archived author: Crane • Posted: 2025-07-30T13:09:14.056000+00:00
Original source
So, I'm starting to have doubts about whether it's actually possible to override this hardcoding with a spellscript.
My last attempt was:
```class spell_54458_knockback_on_vehicle : public SpellScript
{
PrepareSpellScript(spell_54458_knockback_on_vehicle);
void HandleOnHit()
{
if (Unit* target = GetHitUnit())
{
if (target->IsVehicle())
{
// Effect 0 = Knockback
target->ApplySpellImmune(EFFECT_0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, false);
}
}
}
void Register() override
{
OnHit += SpellHitFn(spell_54458_knockback_on_vehicle::HandleOnHit);
}
};
```
but has no effect
Archived author: Crane • Posted: 2025-07-30T13:13:28.953000+00:00
Original source
Or does anyone know how to write it correctly? Unfortunately, I'm not that good at it and am trying to tinker with it by analyzing and incorporating other things, but it doesn't seem to work.
Archived author: Tea • Posted: 2025-07-30T13:14:30.302000+00:00
Original source
this is not going to work
Archived author: Tea • Posted: 2025-07-30T13:14:54.710000+00:00
Original source
immunity means the unit (vehicle) is not selected as a target for the knockback effect at all
Archived author: Tea • Posted: 2025-07-30T13:15:12.241000+00:00
Original source
script with OnHit is already too late
Archived author: Crane • Posted: 2025-07-30T13:21:26.745000+00:00
Original source
with BeforeHit += SpellScript::BeforeHitHandler(&spell_54458_knockback_on_vehicle::HandleBeforeHit); I've already tested it, but it only gives compile errors ^^
Archived author: Tea • Posted: 2025-07-30T13:21:49.155000+00:00
Original source
beforehit is also too late