Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] UNIT_FIELD_FLAG_IMMUNE_TO_NPC causes creature to not attack #366

Open
tikki100 opened this issue May 28, 2021 · 3 comments
Open

[Bug] UNIT_FIELD_FLAG_IMMUNE_TO_NPC causes creature to not attack #366

tikki100 opened this issue May 28, 2021 · 3 comments

Comments

@tikki100
Copy link
Contributor

tikki100 commented May 28, 2021

Hi there!

TrinityCore here.

When setting a creatures unit_flags in either creature_template to 512 or through pUnit:SetUInt32Value(59, 512) the creature no longer attacks players. Instead, it just stands passively and takes damage.

When the creature is immune to NPC, it is supposed to ignore all NPCs around it but not players. My best bet is that this is caused by an error in the Eluna AI

local function Brain_GhoulOnSpawn(event, pUnit)
	pUnit:SetUInt32Value(59, 512)
	pUnit:SendUnitSay("Spawned",0)
end

RegisterCreatureEvent(50302, 5,Brain_GhoulOnSpawn)
@anzz1
Copy link
Contributor

anzz1 commented Jan 30, 2022

This is not a Eluna issue but a core issue. That function you do just calls the core to set unit's flags and the core handles it from there onwards. Eluna does not have an "AI" by itself.

@Rochet2
Copy link
Member

Rochet2 commented Jan 31, 2022

Eluna does not have an "AI" by itself.

Not entirely true. As it is now, registering a creature event will override the creature's AI with Eluna specific C++ AI class that has the hooks for different events.
So it is possible that the Eluna AI class needs to be modified / updated if the AI handles the interactions. See https://github.com/ElunaLuaEngine/Eluna/blob/master/ElunaCreatureAI.h
Moving away from the AI class would be nice though.

Need to investigate more on what is the default behavior and if eluna affects that. It is possible that the core should just handle it. But its also possible that the AI class Eluna uses is bypassing that check for example.

@Foereaper
Copy link
Member

We're currently not updating the AI of the creature at all when the immune to npc flag is set. Logic needs to be revised, or like rochet said, possibly remove the AI class entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants