View Single Post
06/02/14, 06:55 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by JadeKnightblazer View Post
Is it possible to code an addon that will automatically select a presetted quickslot (the player picks which quickslot that will be for the Emergency slot) when the character falls below a threshold of their choosing. Then a popup with this items Icon will pop up larger and ask the player to hit [Q].
Yes this is possible.

Originally Posted by JadeKnightblazer View Post
This style of Emergency / Warning will be like player the first Fable. Which each time the Heros resource gets low the Guild Leader will whisper "They you health is low, watch that", following with a quick button to press to recover said resource.
It is not possible to send chat message to other players from addon.

Originally Posted by JadeKnightblazer View Post
Threshold Options Check Box:
[] Low health (25%)
[] Low Magicka (25%)
[] Low stam (25%)
[] Stat boost potion effect fades
[] Food Buff fades


Emergency Quickslot:
Silder/Pull down: 1 - 8
This is a simplified example how it can be done:
Lua Code:
  1. local announce = ZO_CenterScreenAnnounce_GetAnnounceObject()
  2. ZO_CenterScreenAnnounce_SetEventPriority(EVENT_POWER_UPDATE)
  3. --slots can be set by addon, this is just a simplified example (first quick slot is 9 (ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1)):
  4. local quickSlots = {
  5.    [POWERTYPE_HEALTH] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1,
  6.    [POWERTYPE_MAGICKA] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 2,
  7.    [POWERTYPE_STAMINA] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 3,
  8. }
  9. local messages = {
  10.    [POWERTYPE_HEALTH] = "Health below 25%, press \"Q\"",
  11.    [POWERTYPE_MAGICKA] = "Magicka below 25%, press \"Q\"",
  12.    [POWERTYPE_STAMINA] = "Stamina below 25%, press \"Q\"",
  13. }
  14.  
  15. EVENT_MANAGER:RegisterForEvent("MyAddon_OnPowerUpdate", EVENT_POWER_UPDATE,
  16.    function(eventCode, unitTag, _, powerType, powerValue, powerMax)
  17.       if (unitTag == "player") then
  18.          if (powerType == POWERTYPE_HEALTH) or (powerType == POWERTYPE_MAGICKA) or (powerType == POWERTYPE_STAMINA) then
  19.             if (powerValue / powerMax) < 0.25 then
  20.                SetCurrentQuickslot(quickSlots[powerType])
  21.                announce:AddMessage(eventCode, CSA_EVENT_SMALL_TEXT, SOUNDS.MESSAGE_BROADCAST, ZO_POWER_BAR_GRADIENT_COLORS[powerType][2]:Colorize(messages[powerType]))
  22.             end
  23.          end
  24.       end
  25.    end)
This code checks if your health/magicka/stamina is below 25%, automatically selects 1st/2nd/3rd quick slot and displays warning message. It does not check cooldowns on potions (probably if QUICKSLOT_WINDOW.quickSlots[quickSlots[powerType]].useable then ...do something... end).

Originally Posted by JadeKnightblazer View Post
Over all: Is it possible to Automate the Selecting of the Quickslot (To a presetted slot), Then reqest for the player to Hit Q.

-Thanks
  1. yes
  2. yes, but not using the /whisper from the guild leader

Last edited by Garkin : 06/02/14 at 08:14 AM.
  Reply With Quote