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
CreatureAI: Adjust AI behavior when a charm ends #16020
Conversation
It's not related to SPELL_ATTR1_NO_THREAT and SPELL_ATTR3_NO_INITIAL_AGGRO ? #15089 |
Pretty much any issue with smartai mobs behaving weirdly while MCed might be related to this. SmartAI used to suppress the change from regular to possessed/charmed AI. I didn't look for any particular issue IDs. ED: Just to clarify, that could include mobs not automatically aggroing the person casting MC if the MC is released, yes. |
if (!apply && !me->IsInEvadeMode() && me->GetCharmerGUID()) | ||
if (Unit* charmer = ObjectAccessor::GetUnit(*me, me->GetCharmerGUID())) | ||
AttackStart(charmer); | ||
CreatureAI::OnCharmed(apply); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debated this with @Shauren some time ago, and this is not ok.
He claimed that AI change should not be done (it will prevent smartscripts to trigger)
I dont know the right solution, but this is what i came up with:
- Enable AI change only on CHARM_TYPE_CHARM
This is like a middle term solution, but needs also to check for- If creature is vehicle.
- If creature is possessed.
If charm is one of those cases just store the ReactState to fix the aggro behaviour
Else use the CreatureAI::OnCharmed(apply)
to change into the PetAI
- Enable the AI change just as u did
Prevents any smartscript to trigger, and there are some creatures that use them while charmed
(texts for example) - Implement PetAI functionallities inside the SmartAI
That would be the perfect solution but a huuuuuuuuuge load of work:- Autocast
- Follow
- Disable events with cast action (or just disable cast without a special flag)
- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With all due respect, any smartscript mob is currently a huge pile of steaming bugs when mind controlled. They actively fight player control, cast spells without player input, and move without player input.
If you weigh this against the questionable benefit of having smart scripts still trigger while controlled (how many creatures with elaborate smartscripts can you think of that can be targeted by such abilities), there should be no question as to which is infinitely preferable.
PS: Your fix does not work. Mind Control is a possess, and is by far the most broken type of charm for SmartAI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree with u, SAI Charm mechanics are incomplete.
My "solution" works. There are several important points:
- If its one of the cases in which no PetAI is needed, just store the ReactState on charm and restore on remove. On a clean TC it works, I've tested it.
- SmartScripts on charms without PetAI are triggered (events like casts or texts do trigger). Example: http://www.wowhead.com/item=38302/ruby-beacon-of-the-dragon-queen
- SmartScripts on charms which replace SAI for PetAI dont trigger. Like I said this is the incorrect point of this solution, to avoid handling PetAI inside SAI.
The perfect solution is still the last one I wrote down, implement PetAI inside SAI.
Like I said, huge effort for a small group of cases; but still the right thing to do.
To handle events that should be triggered while charm, for example, we could implement a flag like SMART_EVENT_FLAG_TRIGGER_ONCHARM = 512
This PR introduces some issues in conjunction with controlled pets for drakuru quest that use SmartAI. Labeling WIP. |
There are many charmed creatures that have SAI to trigger credit, texts, casts,... Just like I told you xd |
Removed SmartAI changes from the scope of this PR. |
…nvoked on the creature's base (non-charmed) AI, allowing the AI to react to the creature no longer being charmed.
CreatureAI: Adjust AI behavior when a charm ends: