From 513230988c47f227f9a55f5d356f44eccf03183d Mon Sep 17 00:00:00 2001 From: Henning Bock Date: Wed, 31 Dec 2025 16:38:49 +0100 Subject: [PATCH] Erstellung der Scripte --- OutH.lua | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ OutH.toc | 7 ++++++ 2 files changed, 74 insertions(+) create mode 100644 OutH.lua create mode 100644 OutH.toc diff --git a/OutH.lua b/OutH.lua new file mode 100644 index 0000000..d198a17 --- /dev/null +++ b/OutH.lua @@ -0,0 +1,67 @@ +-- ========================================== +-- OutcH v1.0 - Erstellt von Quasimoder +-- ========================================== + +-- 1. EINSTELLUNGEN & VARIABLEN +local enableFlash = true -- Standard: Flackern ist AN +local soundPath = "Interface\\AddOns\\OutcH\\media\\" +local sounds = { + "outch01.ogg", + "outch02.ogg", + "outch03.ogg", + "outch04.ogg" +} + +-- 2. FLASH-FRAME ERSTELLEN (VISUELLER EFFEKT) +local flashFrame = CreateFrame("Frame", nil, UIParent) +flashFrame:SetAllPoints(UIParent) +flashFrame:SetFrameStrata("BACKGROUND") +flashFrame:Hide() + +local texture = flashFrame:CreateTexture(nil, "BACKGROUND") +texture:SetAllPoints(flashFrame) +-- Nutzt die Standard-WoW-Textur für den roten Rand +texture:SetTexture("Interface\\FullScreenTextures\\LowHealth") +texture:SetBlendMode("ADD") +texture:SetVertexColor(1, 0, 0, 1) -- Farbe: Rot + +-- 3. SLASH-BEFEHL (/outch) +SLASH_OUTCH1 = "/outch" +SlashCmdList["OUTCH"] = function() + enableFlash = not enableFlash + local status = enableFlash and "|cFF00FF00AN|r" or "|cFFFF0000AUS|r" + print("|cFFFF0000OutcH|r: Flackern ist jetzt " .. status) +end + +-- 4. LOGIK FÜR HP-VERLUST +local lastHealth = UnitHealth("player") +local mainFrame = CreateFrame("Frame") +mainFrame:RegisterEvent("UNIT_HEALTH") + +mainFrame:SetScript("OnEvent", function(self, event, unit) + -- Wir prüfen nur die HP des Spielers + if unit == "player" then + local currentHealth = UnitHealth("player") + + -- Nur auslösen, wenn HP gesunken ist (nicht bei Heilung) + if currentHealth < lastHealth then + + -- Zufälligen Sound aus der Liste wählen + local randomSound = sounds[math.random(1, #sounds)] + PlaySoundFile(soundPath .. randomSound, "Master") + + -- Rotes Aufblitzen zeigen, falls aktiviert + if enableFlash then + flashFrame:Show() + -- Nach 0.15 Sekunden wieder verstecken + C_Timer.After(0.15, function() flashFrame:Hide() end) + end + end + + -- Aktuellen Wert für den nächsten Vergleich speichern + lastHealth = currentHealth + end +end) + +-- Startmeldung im Chat +print("|cFFFF0000OutcH|r v1.0 geladen! Nutze |cFFFFFF00/outch|r zum Umschalten des Flackerns.") diff --git a/OutH.toc b/OutH.toc new file mode 100644 index 0000000..0b7f7f2 --- /dev/null +++ b/OutH.toc @@ -0,0 +1,7 @@ +## Interface: 110007, 11505 +## Title: OutcH +## Notes: Spielt zufällige Sounds bei HP-Verlust und lässt den Bildschirm flackern. +## Author: Quasimoder +## Version: 1.0 + +OutcH.lua