From 50110fb267f1c46d34febb65e7069a64da0ec2e8 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Sun, 23 May 2021 16:12:29 -0300
Subject: Exception() - avoid self-error

---
 npc/functions/main.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 8fc2accc1..2e3e03b0a 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -426,6 +426,15 @@ function	script	Exception	{
     .@msg$=getarg(0);
     .@gf=getarg(1,RB_DEFAULT);
 
+    // Avoid self-errors
+    if (!playerattached()) {
+        if (.@gf & RB_DISPBOTTOM)
+            .@gf = .@gf ^ RB_DISPBOTTOM;
+        if (.@gf & RB_SPEECH)
+            .@gf = .@gf ^ RB_SPEECH;
+    }
+
+    // Main protocols
     if (.@gf & RB_DISPBOTTOM)
         dispbottom("ERROR: "+.@msg$);
 
-- 
cgit v1.2.3-70-g09d2