1 - very simple click system suggestion
Hi, i've been thinking of creating my own add-on that does pretty much what you did. Since you did the hard part i condensed it a bit to my needs. please find the code below if you are interested:
only additional step is: make a macro that has: /script EMonitor.settarget()
bind this macro to a key and voila ondemand updates.
main "updates" from my side are: playernr = GetNumGroupmates() and ignore dead players (annoying if you keep targetting dead players in scenario's)
thanks for your efforts. feel free to use or ignore any of this.
-- Proof of concept for an Emergency Monitor mod
-- Written by Khalid on the warhammer alliance forums and WoW Temporary Insanity on Kilrogg
-- 9/10/2008
-- Uses some LibSlash from Aiiane and the prettyprint command from http://www.thewarwiki.com/wiki/WAR_API
-- Props to Aiiane, the most helpful person on the Warhammer Alliance forums
-- Plans:
-- Try and make a button that the user can click to turn mod off instead of the slash command
-- More intelligent target picking
-- Extend to Warparty
EMonitor = {}
GroupData = GetGroupData()
LowestName = GameData.Player.name
function EMonitor.Initialize()
-- Register events, list of events gotten from CleanUnitFrames by Aiiane, email=aiiane@aiiane.net
-- Possibly do not need all these atm
RegisterEventHandler( SystemData.Events.GROUP_UPDATED "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.GROUP_STATUS_UPDATED "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.GROUP_EFFECTS_UPDATED "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.GROUP_PLAYER_ADDED "EMonitor.OnGroupUpdated";)
--RegisterEventHandler( SystemData.Events.SCENARIO_BEGIN "EMonitor.OnGroupUpdated";)
--RegisterEventHandler( SystemData.Events.SCENARIO_END "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.SCENARIO_GROUP_JOIN "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.SCENARIO_GROUP_LEAVE "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED "EMonitor.OnGroupUpdated";)
--RegisterEventHandler( SystemData.Events.PLAYER_MAX_HIT_POINTS_UPDATED "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.PLAYER_EFFECTS_UPDATED "EMonitor.OnGroupUpdated";)
--RegisterEventHandler( SystemData.Events.PLAYER_DEATH "EMonitor.OnGroupUpdated";)
RegisterEventHandler( SystemData.Events.PLAYER_DEATH_CLEARED "EMonitor.OnGroupUpdated";)
-- Register a slash command for toggling the mod on and off
--local success = LibSlash.RegisterSlashCmd("emt";, function() EMonitor_Toggle() end)
-- pprint("Registering emt, result was=",success)
-- Turn the mod off, then toggle it on
--EMonitor_Enabled = false
--EMonitor_Toggle()
end
-- Checks if the group member is valid, gotten from CleanUnitFrames by Aiiane, email=aiiane@aiiane.net
function EMonitor.IsMemberValid(index)
return ( GroupData ~= nil and
GroupData[index] ~= nil and
GroupData[index].name ~= nil and
GroupData[index].name ~= L"" )
end
function EMonitor.OnGroupUpdated()
-- Default lowest health percent as the player
LowestHealthPercent = (GameData.Player.hitPoints.current * 100)/ GameData.Player.hitPoints.maximum
-- pprint("Player=",LowestHealthPercent)
LowestName = GameData.Player.name
GroupData = GetGroupData()
playernr = GetNumGroupmates()
-- Find lowest health percentage and store it
for i = 1, playernr do
-- make sure group member is valid
-- pprint("EMonitor.IsMemberValid=",EMonitor.IsMemberValid(i))
if (EMonitor.IsMemberValid(i) == true) then
-- pprint("GroupMember ",i," ",GroupData[i].healthPercent)
-- Is it lower than the lowest so far?
if (GroupData[i].healthPercent > 0 ) then
if (GroupData[i].healthPercent <= LowestHealthPercent ) then
-- Save it then
LowestHealthPercent = GroupData[i].healthPercent
LowestName = GroupData[i].name
end
end
end
end
-- Now target this lowest health member
--local success = TargetPlayer(LowestName)
--DEBUG( L"EMonitor.OnGroupUpdated():Error, Could not target the player with the lowest health, who was")
end
function EMonitor.settarget()
local success = TargetPlayer(LowestName)
end
| User | When | Change |
|---|---|---|
| oyzyu | Thu, 11 Sep 2008 11:54:00 | Create |
Facts
- Reported on
- 11 Sep 2008
- Status
- New - Issue has not had initial review yet.
- Type
- Enhancement - A change which is intended to better the project in some way
- Priority
- Medium - Normal priority.