# BGB Target Macros  


## Description  
BGB Target Macros enables the use of target macros for enemies in Battleground Blitz, similar to how "arena1", "arena2", and "arena3" macros work in arenas.  
It ensures that your macros always correspond to the correct enemy players in each match.  
Additionally, it allows for enemy-directed spell macros, provides automatic numbering for enemy frames in BattleGroundEnemies, and improves battlefield awareness by making enemy targets easier to locate.  


## Features  
- Automatically generates and updates target macros ("BG1 - BG8") when all 8 enemies are detected.  
- Allows you to create both targeting macros and spell macros for enemy players.  
- Adds numbering to enemy frames in BattleGroundEnemies for improved target recognition.  
- Provides an Advanced Macro Editor to modify macros permanently.  
- Stores macros under General Macros, making them accessible across all characters.  
- Automatically updates macros at the start of each Battleground Blitz match.  
- Manually update macros at any time via the Update Macros button in the configuration menu.  
- Enhances situational awareness by making enemy nameplates easier to locate while moving the camera.  
- Allows customization of macros to include specific spells, commands, or even messages.  


## How to Use  
1. Install & Enable  
   - Ensure both BGB Target Macros and BattleGroundEnemies are installed and active.  

2. Open Configuration Menu  
   - Type `/btmconfig` in chat to open the settings menu.  

3. Configure Macro Creation  
   - Select how many enemy targets ("BG1 - BG8") you want macros for.  
   - Choose which spells should be included in the macros.  

4. Generate Macros  
   - Click "Create Macros" to generate the specified macros.  
   - The macros will appear in WoW’s macro menu and can be dragged into your action bars.  

5. Automatic Updates in Battlegrounds  
   - Macros are updated each time all 8 enemy players have entered a new Battleground Blitz match.  
   - If changes are needed mid-match, use "Update Macros" to refresh them manually.  

6. Advanced Macro Editing  
   - Any modifications to macros must be made in the Advanced Macro Editor.  
   - Macros edited in Blizzard’s standard macro menu will be overwritten when a new match starts.  


## Important: If you want to create macros for spells

There is an important limitation you need to be aware of.  
Ideally, a macro for Polymorph would look like this:  

/cast [target="enemyname"] Polymorph

However, Blizzard does not allow this because the target condition only works with UnitIDs (such as focus, targettarget, party, arena, etc.).  

The only working solution is:


/targetexact "enemyname"
/cast Polymorph
/targetlasttarget


When used correctly, this functions exactly the same!  


However, there are two things to keep in mind:  

1. Don't use the spell macros on targets you have already targeted  
- If you already have the intended target selected while pressing the macro, it will force a target switch and revert back to the previous target after casting (due to `/targetlasttarget`).  
-> The best practice is to only use these macros on players you are not currently targeting, which is the intended purpose anyway.  
-> Although knowing about this behavior would allow you to use it intentionally.


2. Don't use the spell macros on targets who can't be targeted  
- This is mainly a problem against stealth classes.  
- If an enemy enters stealth just before you press the macro, he cannot be selected, and therefore, an unwanted target switch will happen (again, due to /targetlasttarget)
-> Stealth enemies are displayed faded in BattleGroundEnemies. So if you pay close attention, you can see whether you can cast a spell on the target or not.


## Additional Notes
- "Convert Cyrillic" in BattleGroundEnemies does not work when "Numbering of BGE Frames" is enabled (which is the default setting). If you want to use "Convert Cyrillic," you need to disable "Numbering of BGE Frames" in the addon’s settings.
- Once custom-created macros have been generated, their icons can be changed in Blizzard's macro menu. When updating, only the target-macro icons will be overwritten.
- If you want a different target-macro icon, edit the `BTM_Macros.lua` file. In line 90, change `"achievement_bg_winwsg"` to any valid WoW icon name.


## Feedback  
Feel free to provide feedback about missing features or bugs in the Curse comment section or via ticket on CurseForge.  

## Credits  
Created by OpticTuning, built with ChatGPT.