azerothcore-wotlk
azerothcore-wotlk copied to clipboard
[WIP] Fix (Core/SmartScript.cpp) Control the change of faction
Changes Proposed:
- Currently, the npc, performs a level increase effect, due to the fact that inside the script, previously, there was an update of the template.
- At the same time, the npc must remain neutral, and currently when using the item, it becomes friendly (due to the template change).
Issues Addressed:
- Closes https://github.com/chromiecraft/chromiecraft/issues/3775
- Closes https://github.com/azerothcore/azerothcore-wotlk/issues/12391
SOURCE:
https://youtu.be/g3Qz_liqHR0
Tests Performed:
- Windows 10
- In-game
How to Test the Changes:
- .go c 75965
- quest add 9303
Known Issues and TODO List:
How to Test AzerothCore PRs
When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].
You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:
http://www.azerothcore.org/wiki/How-to-test-a-PR
REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).
For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.
The script is wrong. I just realized, that the name of the NPC, should change, so the template change was ok. The problem then, must be in the template faction. But it strikes me, that there might be something wrong inside creature_template
, anyway, I will check it. Or, the faction change may be in the spell, so I will make changes in this pull request.
Name: Inoculated Nestlewood Owlkin
- Quick Facts
- Type: Humanoid
- Added in patch 2.5.1.38043
- Source: tbc.wowhead.com
Name: Inoculated Nestlewood Owlkin
- Quick Facts
- Level: 3 - 4
- React: A H
- Faction: Friendly
- Source: wowgaming
I think the script is fine, maybe at most, the level change effect, but according to the source, it looks like it would have to be friendly. Anyway, I will try to look for more information about it.
Tested and work fine.
Although it works, it is wrong, since when deleting the template, the name of the npc does not change. I think the problem is not in the smart_scripts, but in the spell. Thanks anyway for trying it, but this is not the solution we need. When I made the change, I thought it was the right thing to do, but then, the person who made the report, made me notice some points, that I had not taken into consideration. Like the fact that the npc changes its name after the spell is used on it.
I will check, if I find this spell inside the core, or if it is a dummy, we will have to create a spell, because it is doing some things that should not or rather, that it changes to friendly is fine, because the npc in creature_template is friendly, it would be a matter of modifying the behavior, only on that occasion. https://www.wowhead.com/spell=29528/inoculate-nestlewood-owlkin
src/server/game/Spells/Auras/SpellAuraEffects.cpp:5994: // Inoculate Nestlewood Owlkin
I'm going to check this out, see if we have any luck.
@Maelthyrr With this new change, it seems to be working. It no longer does the level change effect. It no longer changes the faction (in this case).
The faction is only changed if there is a level change.
This is a condition that does not convince me at all.
But if you want to make a SmartAI that changes faction
You would only have to set the bool changelevel
to True
.
I am not quite sure how I should resolve conflicts. If anything, we could create a new pull request, because now some things have changed. I'll wait for your confirmation to proceed.
I don't know if the conflict is well resolved. What happens, is that I didn't realize to update the file before making the change. But I think with that, it should be more than enough. Anyway, please, that someone receives it and confirms me to make the change.
I believe the merge conflict resolution went wrong.
This is removing SMART_ACTION_SET_INST_DATA64 completely.
Also, the bottom change doesn't make sense. Creature level update doesn't have anything to do with faction...
I believe the merge conflict resolution went wrong.
This is removing SMART_ACTION_SET_INST_DATA64 completely.
Also, the bottom change doesn't make sense. Creature level update doesn't have anything to do with faction...
It is true that it has no relation, but I needed some boolean variable, so that it is not always. My goal, is that as I pass false in the SmartAI call, then, by default, the faction change is not carried out. But in the case, if I passed true, then it would still work. That is the analysis I tried to make of the situation. I was not 100% convinced, but it occurred to me that it could become an alternative. But then came the conflict, and I resolved it badly. I think I am going to close the PR and reopen a new one, updating the information and from there on, we will see how we solve it. Because that's the way it works.
How do we make sure that the faction does not change, for example in this case? The only alternative I could think of is that, some kind of condition. I am not 100% satisfied with the solution, but as in the rest of the calls of the method, I never pass the changelevel
, it occurred to me that it could be an alternative. Anyway, the compilation doesn't fail because of that, it fails because I solved the conflict wrong.
This pull request, I have to close it. I tried to fix it, but on the way, I made a lot of mistakes, so I will create another one later. Thanks to everyone who participated in it.