Core/SAI: Implement SMART_TARGET_SUMMONED_ENTRY#31696
Open
carl3175 wants to merge 1 commit intoTrinityCore:masterfrom
Open
Core/SAI: Implement SMART_TARGET_SUMMONED_ENTRY#31696carl3175 wants to merge 1 commit intoTrinityCore:masterfrom
carl3175 wants to merge 1 commit intoTrinityCore:masterfrom
Conversation
## Summary This commit implements a new SmartAI target type SMART_TARGET_SUMMONED_ENTRY that allows SmartAI scripts to find summoned creatures (pets, vehicles, or other controlled units) by their entry ID. ## Problem Previously, SmartAI scripts had no way to target specific summoned creatures by their entry ID. There was no target type that could: - Find pets or vehicles summoned by a specific unit - Match summoned creatures by their creature entry - Support both SAI source object's summons and invoker's summons ## Solution Added SMART_TARGET_SUMMONED_ENTRY target type with the following parameters: - target_param1 : Summoned creature entry to target - target_param2 : Summoner source - 0 : SAI source object's summons - 1 : Current SmartAI invoker's summons The implementation: 1. Validates the summoner parameter 2. Retrieves the summoner unit based on parameter 3. Iterates through the summoner's m_Controlled list 4. Filters by entry ID and world presence ## Impact - Adds new functionality without breaking existing features - Supports all controlled unit types (pets, vehicles, guardians) - Includes proper validation and debug logging - Fixed null pointer safety by checking ToUnit() result before assignment to prevent potential crashes when scriptTrigger is not a Unit type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This commit implements a new SmartAI target type SMART_TARGET_SUMMONED_ENTRY that allows SmartAI scripts to find summoned creatures (pets, vehicles, or other controlled units) by their entry ID.
Problem
Previously, SmartAI scripts had no way to target specific summoned creatures by their entry ID. There was no target type that could:
Solution
Added SMART_TARGET_SUMMONED_ENTRY target type with the following parameters:
The implementation:
Impact