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

smartscript waypoint_reached (40)/waypoint_ended(58) Not working properly #18938

Open
fangshun2004 opened this issue May 22, 2024 · 4 comments
Open

Comments

@fangshun2004
Copy link
Contributor

Current Behaviour

"waypoint_reached (40)/waypoint_ended(58)" in Smat Script uses "wp_pause(54)" in the last waypoint-1 to always trigger an event when the last waypoint has not yet arrived

Expected Blizzlike Behaviour

In any case, the event should always be triggered when the location is reached or when the waypoint is completed

Source

No response

Steps to reproduce the problem

  1. Import SQL path
DELETE FROM `waypoints` WHERE `entry`=104350;
INSERT INTO `waypoints` VALUES 
(104350, 1, 3684.35, -3605.47, 137.872, NULL, 0, NULL),
(104350, 2, 3700.3, -3604.13, 139.578, NULL, 0, NULL),
(104350, 3, 3723.08, -3600.48, 142.359, NULL, 0, NULL);
  1. The guide was tested using the "Smart Cripp" move event
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 10435;

DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 10435);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(10435, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 16792, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Reset - Cast \'Furious Anger\''),
(10435, 0, 1, 0, 0, 0, 100, 0, 6000, 10000, 12000, 21000, 0, 0, 11, 10887, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - In Combat - Cast \'Crowd Pummel\''),
(10435, 0, 2, 0, 0, 0, 100, 0, 11000, 12000, 15000, 15000, 0, 0, 11, 14099, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - In Combat - Cast \'Mighty Blow\''),
(10435, 0, 3, 0, 0, 0, 100, 0, 4000, 4000, 12000, 15000, 0, 0, 11, 16793, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - In Combat - Cast \'Draining Blow\''),
(10435, 0, 4, 0, 6, 0, 100, 512, 0, 0, 0, 0, 0, 0, 11, 16794, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Just Died - Cast \'Transformation\''),
(10435, 0, 5, 0, 37, 0, 100, 512, 0, 0, 0, 0, 0, 0, 11, 16794, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Initialize - Cast \'Transformation\''),
(10435, 0, 6, 0, 38, 0, 100, 257, 1, 1, 0, 0, 0, 0, 53, 1, 104350, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Data Set 1 1 - Start Waypoint Path 104350 (No Repeat)'),
(10435, 0, 7, 8, 40, 0, 100, 512, 1, 104350, 0, 0, 0, 0, 54, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Point 1 of Path 104350 Reached - Pause Waypoint'),
(10435, 0, 8, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Point 1 of Path 104350 Reached - Say Line 0'),
(10435, 0, 9, 10, 40, 0, 100, 512, 2, 104350, 0, 0, 0, 0, 54, 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Point 2 of Path 104350 Reached - Pause Waypoint'),
(10435, 0, 10, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Point 2 of Path 104350 Reached - Say Line 0'),
(10435, 0, 11, 0, 40, 0, 100, 512, 3, 104350, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Magistrate Barthilas - On Point 3 of Path 104350 Reached - Say Line 0');
  1. .go xyz 3622.75 -3641.75 138.51 329 Open the gate Mob 10435 should start moving, fleeing, and moving, and at each waypoint it should shout red first (3 times in total) The last time it would normally be shouted after reaching the gate, but it was used in path 2 wp_pause started shouting before the final waypoint 3 was reached, deleted from the database waypoint 3 only kept waypoints 1 and 2, and when run again, there will be a shout for waypoint 2, which will appear before waypoint 2 has arrived

Extra Notes

No response

AC rev. hash/commit

f8e584a

Operating system

windows 10

Custom changes or Modules

No response

@fangshun2004
Copy link
Contributor Author

If you add a random approach point before the last waypoint, it will work

DELETE FROM `waypoints` WHERE `entry`=104350;
INSERT INTO `waypoints` VALUES 
(104350, 1, 3684.35, -3605.47, 137.872, NULL, 0, NULL),
(104350, 2, 3700.3, -3604.13, 139.578, NULL, 0, NULL),
-- A new coordinate must be inserted before the last waypoint is reached for this to work
(104350, 3, 3723.08, -3600.48, 142.359, NULL, 0, NULL),
(104350, 4, 3723.08, -3600.48, 142.359, NULL, 0, NULL);

@fangshun2004 fangshun2004 changed the title smartscript waypoint_reached (40)/waypoint_ended(58) smartscript waypoint_reached (40)/waypoint_ended(58) Not working properly May 22, 2024
@Gultask
Copy link
Contributor

Gultask commented May 22, 2024

This happens when there is less than 4 points. Yes, it's bizarre, and I don't know what causes this, but it happens consistently with waypoints with less than 4 points.

I added a new set of actions and events that make use of the waypoint_data table, if you prefer, it shouldn't have this issue, I think.

@fangshun2004
Copy link
Contributor Author

SMART_ACTION_MOVEMENT_PAUSE。 I see that the description timer is not implemented. I need to make the creature pause and move again. I tested it myself and creatures can only walk. Can't run. I tried set_run(59 )set_movement_speed(136)

@Gultask
Copy link
Contributor

Gultask commented May 24, 2024

SMART_ACTION_MOVEMENT_PAUSE。 I see that the description timer is not implemented. I need to make the creature pause and move again. I tested it myself and creatures can only walk. Can't run. I tried set_run(59 )set_movement_speed(136)

@fangshun2004

The movement type (run, walk) is set in the waypoint_data itself, under the field move_type. It'll run if it has move_type equal to 1.
Pausing isn't implemented because we can't set a proper timer yet, it'll use a generic one. That's because we're missing a Movement Master rework TC did. To pause we set the pause timer in waypoint_data itself as well.

Try this:

SET @GUID := [NPC GUID];
DELETE FROM `waypoint_data` WHERE `id` = @GUID*10;
INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`) VALUES
(@GUID*10, 1, 3684.35, -3605.47, 137.872, NULL, 3000, 1),
(@GUID*10, 2, 3700.3, -3604.13, 139.578, NULL, 3000, 1),
(@GUID*10, 3, 3723.08, -3600.48, 142.359, NULL, 0, 1);

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

2 participants