Originally Posted by JadeKnightblazer
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
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
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:
local announce = ZO_CenterScreenAnnounce_GetAnnounceObject()
ZO_CenterScreenAnnounce_SetEventPriority(EVENT_POWER_UPDATE)
--slots can be set by addon, this is just a simplified example (first quick slot is 9 (ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1)):
local quickSlots = {
[POWERTYPE_HEALTH] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 1,
[POWERTYPE_MAGICKA] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 2,
[POWERTYPE_STAMINA] = ACTION_BAR_FIRST_UTILITY_BAR_SLOT + 3,
}
local messages = {
[POWERTYPE_HEALTH] = "Health below 25%, press \"Q\"",
[POWERTYPE_MAGICKA] = "Magicka below 25%, press \"Q\"",
[POWERTYPE_STAMINA] = "Stamina below 25%, press \"Q\"",
}
EVENT_MANAGER:RegisterForEvent("MyAddon_OnPowerUpdate", EVENT_POWER_UPDATE,
function(eventCode, unitTag, _, powerType, powerValue, powerMax)
if (unitTag == "player") then
if (powerType == POWERTYPE_HEALTH) or (powerType == POWERTYPE_MAGICKA) or (powerType == POWERTYPE_STAMINA) then
if (powerValue / powerMax) < 0.25 then
SetCurrentQuickslot(quickSlots[powerType])
announce:AddMessage(eventCode, CSA_EVENT_SMALL_TEXT, SOUNDS.MESSAGE_BROADCAST, ZO_POWER_BAR_GRADIENT_COLORS[powerType][2]:Colorize(messages[powerType]))
end
end
end
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
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
|
- yes
- yes, but not using the /whisper from the guild leader