Skip to content

fix(CORE/SAI): Properly Implement START_CLOSEST_WAYPOINT #22256

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wetbrownsauce
Copy link

@wetbrownsauce wetbrownsauce commented Jun 1, 2025

  • SMART_ACTION_START_CLOSEST_WAYPOINT was not functioning due to code errors.
  • The proposed changes implement the intended functionality.

Changes Proposed:

This PR proposes changes to:

  • Core (units, players, creatures, game systems).
  • Scripts (bosses, spell scripts, creature scripts).
  • Database (SAI, creatures, etc).

Issues Addressed:

Smart action now functions

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

  • This pull request requires further testing. Provide steps to test your changes. If it requires any specific setup e.g multiple players please specify it as well.
  1. Run the following scripts in the acore_world db to set up a testing environment prior to merging the PR:
INSERT INTO `creature_template` (`entry`, `name`, `faction`, `unit_class`, `type`, `AIName`) VALUES
(7000000, 'waypoint test', 35, 1, 7, 'SmartAI');

INSERT INTO `creature_template_model` VALUES
(7000000, 0, 3969, 1, 1, 1);

INSERT INTO `creature` (`guid`, `id1`, `map`, `position_x`, `position_y`, `position_z`, `comment`) VALUES
(7000001, 7000000, 1, 16226.201, 16259.444, 13.281408, 'waypoint test 1 on gmisland'),
(7000002, 7000000, 1, 16218.536, 16254.207, 13.04466, 'waypoint test 2 on gmisland');

INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`) VALUES
(700000100, 1, 16228.133, 16258.381, 13.417116),
(700000100, 2, 16225.328, 16251.92, 12.700019),
(700000100, 3, 16222.595, 16244.262, 11.332173),
(700000200, 1, 16218.536, 16254.207, 13.04466),
(700000200, 2, 16229.254, 16251.723, 13.117613);

INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `event_type`, `action_type`, `action_param1`, `action_param2`, `target_type`, `comment`) VALUES
(7000000, 0, 0, 11, 113, 700000100, 700000200, 1, 'WP Test Creature - On Spawn - Start Closest WP');
  1. This creates 2 dwarf npc on GM island and 2 waypoints near them. As well as a single smart script for both dwarves instructing them to start closest waypoint on spawn.
  2. Before this PR is merged, log in and .tele gmisland you will see the dwarf do not move.
  3. After PR is merged, log in and .tele gmisland you will see dwarves pick closest waypoint to them and begin movement as per the smart script logic.
  4. After you are done testing, you can undo the test db changes using this:
DELETE FROM `creature_template` WHERE `entry` = 7000000;
DELETE FROM `creature_template_model` WHERE `CreatureID` = 7000000;
DELETE FROM `creature` WHERE `guid` IN (7000001, 7000002);
DELETE FROM `waypoints` WHERE `entry` IN (700000100, 700000200);
DELETE FROM `smart_scripts` WHERE `entryorguid` = 7000000;

Known Issues and TODO List:

  • Someone confirm that I didn't do something stupid. I'm new to c++
    I tested it myself before/after PR, and everything works perfectly unless someone can see something I don't.

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.

- SMART_ACTION_START_CLOSEST_WAYPOINT was not functioning due to code errors.
- The proposed changes implement the intended functionality.
@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Jun 1, 2025
@wetbrownsauce wetbrownsauce changed the title fix(CORE/SAI): START_CLOSEST_WAYPOINT Fix fix(CORE/SAI): Properly Implement START_CLOSEST_WAYPOINT Jun 3, 2025
@wetbrownsauce
Copy link
Author

This smart_action is not currently used by anything in the game (no smart scripts with this action type). In order to test it, please follow the testing steps above. (or create your own creatures/waypoints/scripts)

From my own testing, this smart action did not function prior to this PR, and after applying the PR, the smart action works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core file-cpp Used to trigger the matrix build Ready to be Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants