Core/Movement:Fix waypointed creature aggro #11609

Merged
merged 1 commit into from Jun 23, 2014

8 participants

@zengwf

In original code, when creature is moving on waypoint(patroling), its homeposition will not be updated unless reaches non-repeating waypoint's destination. This means homeposition is always bound to its spawn position, so creatures with long waypoint path don't aggro even when approaches very near(instance creature is ok because not use this value).

This fix sets creature homepositon to its current position when on waypointed movement.(I think homepositon in code means "OOC return position".) Tested on some creatures(Duskwood emerald dragon, etc.) They can aggro correctly when move in range.

@zengwf

@Aokromes Should be ok now, new player to Github:)

@Rochet2

Nice. I think this should allow an NPC to return to the path point where he started attacking from?
I had a bit of trouble making an NPC to go back to patrol from the same spot they were before attacking.
Seems to work on mangos though.

@zengwf

Yeah, in my test, NPC returns to the aggro point and continues patroling as expected. But as far as I remember, there's some code that set creature homeposition to current position when he aggros...so I guess this patch only affects whether creature can correctly aggro when he waypoints far from spawn point.

@LordUsagi

Wouldn't this fix arthas in culling of strath?

@Rochet2

I tested on e4c57d8 and the issue for returning to waypoint didnt seem to be there anymore.

Tested in SWP creatures that have wp and and Duskwood Taerar

@dr-j

confirm the bug with wp creatures not aggroing, there is also a second issue with some wp mobs though where they will agro but will continue on wp while casting until get out of range and leave combat.

@Rochet2

confirm the bug with wp creatures not aggroing

Same on e4c57d8
and the suggested fix seems to work for that.
Any place could test the mob casting?

@joschiwald
TrinityCore member

if not sure if it's related to this, but https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Movement/MovementGenerator.h#L48 is not overriden by waypoint movementgenerator

@jackpoz
TrinityCore member

would

creature->SetHomePosition(creature->GetPosition())

work instead of that overload with x,y,z,o ?

@Rochet2

would

creature->SetHomePosition(creature->GetPosition())

work instead of that overload with x,y,z,o ?

Why wouldnt it work? They are basically the same function. Guess it was a suggestion.
Btw .. isnt creature already a Position*? So you could basically do SetHomePosition(*creature)
This isnt used? or is it just standard to use GetPosition always?

@jackpoz
TrinityCore member

It was indeed a suggestion, it's still much more clear a call to GetPosition() instead of *creature, it makes the code much more readable.

@Loukie

any how tested it works good.

@Aokromes Aokromes merged commit e319472 into TrinityCore:master Jun 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment