From 9198b1c0070028b3c33853ca865058391eb9e85a Mon Sep 17 00:00:00 2001
From: Coffee <coffee@coffee-EP45-UD3L.(none)>
Date: Thu, 14 Jul 2011 09:34:54 -0300
Subject: Some critical bugfixes

---
 world/map/npc/025-3/barriers.txt    | 162 ++++++++++++++++++------------------
 world/map/npc/025-4/battlecaves.txt |  83 ++++++++++--------
 2 files changed, 127 insertions(+), 118 deletions(-)

(limited to 'world/map/npc')

diff --git a/world/map/npc/025-3/barriers.txt b/world/map/npc/025-3/barriers.txt
index eefe5b2c..d6c69016 100644
--- a/world/map/npc/025-3/barriers.txt
+++ b/world/map/npc/025-3/barriers.txt
@@ -5,7 +5,7 @@
 025-3.gat,78,127,0	script	#WarpBattleCave1	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 26, 63, 60, 97) >= 1 || $@battlecave1 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 26, 63, 60, 97) >= 1 || $@battlecave1 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE1) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -57,7 +57,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave1, 0;
     set $@cave1_kills, 0;
     set $@cave1start, 0;
@@ -70,37 +70,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 78, 129;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave1fighter$));
     warp "025-3.gat", 78, 129;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave1fighter$));
     warp "025-3.gat", 78, 129;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave1fighter$));
     warp "025-3.gat", 78, 129;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -115,7 +115,7 @@ L_AlreadyClean:
 025-3.gat,53,107,0	script	#WarpBattleCave2	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 97, 62, 126, 96) >= 1 || $@battlecave2 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 97, 62, 126, 96) >= 1 || $@battlecave2 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE2) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -167,7 +167,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave2, 0;
     set $@cave2_kills, 0;
     set $@cave2start, 0;
@@ -180,37 +180,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 53, 109;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave2fighter$));
     warp "025-3.gat", 53, 109;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave2fighter$));
     warp "025-3.gat", 53, 109;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave2fighter$));
     warp "025-3.gat", 53, 109;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -224,7 +224,7 @@ L_AlreadyClean:
 025-3.gat,71,83,0	script	#WarpBattleCave3	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 150, 84, 177, 117) >= 1 || $@battlecave3 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 150, 84, 177, 117) >= 1 || $@battlecave3 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE3) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -276,7 +276,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave3, 0;
     set $@cave3_kills, 0;
     set $@cave3start, 0;
@@ -289,37 +289,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 71, 85;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave3fighter$));
     warp "025-3.gat", 71, 85;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave3fighter$));
     warp "025-3.gat", 71, 85;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave3fighter$));
     warp "025-3.gat", 71, 85;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -333,7 +333,7 @@ L_AlreadyClean:
 025-3.gat,80,83,0	script	#WarpBattleCave4	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 28, 124, 57, 156) >= 1 || $@battlecave4 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 28, 124, 57, 156) >= 1 || $@battlecave4 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE4) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -385,7 +385,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave4, 0;
     set $@cave4_kills, 0;
     set $@cave4start, 0;
@@ -398,37 +398,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 80, 85;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave4fighter$));
     warp "025-3.gat", 80, 85;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave4fighter$));
     warp "025-3.gat", 80, 85;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave4fighter$));
     warp "025-3.gat", 80, 85;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -442,7 +442,7 @@ L_AlreadyClean:
 025-3.gat,71,30,0	script	#WarpBattleCave5	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 91, 131, 124, 160) >= 1 || $@battlecave5 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 91, 131, 124, 160) >= 1 || $@battlecave5 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE5) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -494,7 +494,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave5, 0;
     set $@cave5_kills, 0;
     set $@cave5start, 0;
@@ -507,37 +507,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 71, 32;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave5fighter$));
     warp "025-3.gat", 71, 32;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave5fighter$));
     warp "025-3.gat", 71, 32;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave5fighter$));
     warp "025-3.gat", 71, 32;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -551,7 +551,7 @@ L_AlreadyClean:
 025-3.gat,128,35,0	script	#WarpBattleCave6	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 153, 143, 178, 174) >= 1 || $@battlecave6 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 153, 143, 178, 174) >= 1 || $@battlecave6 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE6) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -603,7 +603,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave6, 0;
     set $@cave6_kills, 0;
     set $@cave6start, 0;
@@ -616,37 +616,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 128, 37;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave6fighter$));
     warp "025-3.gat", 128, 37;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave6fighter$));
     warp "025-3.gat", 128, 37;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave6fighter$));
     warp "025-3.gat", 128, 37;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -660,7 +660,7 @@ L_AlreadyClean:
 025-3.gat,70,57,0	script	#WarpBattleCave7	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 27, 185, 61, 219) >= 1 || $@battlecave7 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 27, 185, 61, 219) >= 1 || $@battlecave7 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE7) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -712,7 +712,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave7, 0;
     set $@cave7_kills, 0;
     set $@cave7start, 0;
@@ -725,37 +725,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 70, 59;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave7fighter$));
     warp "025-3.gat", 70, 59;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave7fighter$));
     warp "025-3.gat", 70, 59;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave7fighter$));
     warp "025-3.gat", 70, 59;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -769,7 +769,7 @@ L_AlreadyClean:
 025-3.gat,138,92,0	script	#WarpBattleCave8	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 90, 193, 119, 216) >= 1 || $@battlecave8 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 90, 193, 119, 216) >= 1 || $@battlecave8 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE8) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -821,7 +821,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave8, 0;
     set $@cave8_kills, 0;
     set $@cave8start, 0;
@@ -834,37 +834,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 138, 94;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave8fighter$));
     warp "025-3.gat", 138, 94;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave8fighter$));
     warp "025-3.gat", 138, 94;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave8fighter$));
     warp "025-3.gat", 138, 94;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -878,7 +878,7 @@ L_AlreadyClean:
 025-3.gat,138,160,0	script	#WarpBattleCave9	45,1,1,{
 
     if (Rossy_Quest >= 16 || FLAGS & FLAG_ROSSI_COMPLETED) goto L_AlreadyHelped;
-    if (getareausers("025-4.gat", 144, 192, 173, 226) >= 1 || $@battlecave9 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 144, 192, 173, 226) >= 1 || $@battlecave9 > 0) goto L_SomeoneInside;
     if (cavefights & BATTLE_CAVE9) goto L_AlreadyDone;
     if (Rossy_Quest < 15) goto L_Block;
 
@@ -930,7 +930,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave9, 0;
     set $@cave9_kills, 0;
     set $@cave9start, 0;
@@ -943,37 +943,37 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-3.gat", 138, 158;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run away!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave9fighter$));
     warp "025-3.gat", 138, 158;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave9fighter$));
     warp "025-3.gat", 138, 158;
     message strcharinfo(0), "You were not strong enough to eliminate this power source.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave9fighter$));
     warp "025-3.gat", 138, 158;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
@@ -998,7 +998,7 @@ L_AlreadyClean:
     if (cavefights & BATTLE_CAVE8) set @barrier_force, @barrier_force + 1;
     if (cavefights & BATTLE_CAVE9) set @barrier_force, @barrier_force + 1;
     if (@barrier_force != 0) goto L_Hurt;
-    if (getareausers("025-4.gat", 142, 24, 172, 48) >= 1 || $@battlecave10 == 1) goto L_SomeoneInside;
+    if (getareausers("025-4.gat", 142, 24, 172, 48) >= 1 || $@battlecave10 > 0) goto L_SomeoneInside;
     if (@barrier_force == 0) goto L_StartFight;
     end;
 
@@ -1049,7 +1049,7 @@ L_Win:
     setnpctimer 0;
     end;
 
-S_PreCleaning:
+S_Cleaning:
     set $@wave_cave10, 0;
     set $@cave10_kills, 0;
     set $@cave10start, 0;
@@ -1063,44 +1063,44 @@ S_PreCleaning:
     return;
 
 L_Ranaway:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 L_BadAir:
-    callsub S_PreCleaning;
     warp "025-4.gat", 93, 33;
     message strcharinfo(0), "You can't stand the foul air inside the cave and run as fast as you can to save Julia!";
+    callsub S_Cleaning;
     end;
 
 L_Cleaning:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave10fighter$));
     warp "025-3.gat", 77, 168;
     message strcharinfo(0), "You took too much time to eliminate this source of energy... If you stay one more second in this cave you won't be able to breathe....";
+    callsub S_Cleaning;
     end;
 
 L_CleaningDead:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave10fighter$));
     warp "025-3.gat", 77, 168;
     if ($@wave_cave10 < 5) message strcharinfo(0), "You were not strong enough to eliminate this power source.";
     if ($@wave_cave10 == 5) message strcharinfo(0), "This horrible monster is probably too powerful for you right now.";
+    callsub S_Cleaning;
     end;
 
 L_CleaningNorid:
-    callsub S_PreCleaning;
+    callsub S_Cleaning;
     end;
 
 OnGetout:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave10fighter$));
     warp "025-3.gat", 77, 168;
+    callsub S_Cleaning;
     end;
 
 OnWin:
-    callsub S_PreCleaning;
     attachrid(getcharid(3,$@cave10fighter$));
     warp "025-4.gat", 93, 33;
+    callsub S_Cleaning;
     end;
 
 L_AlreadyClean:
diff --git a/world/map/npc/025-4/battlecaves.txt b/world/map/npc/025-4/battlecaves.txt
index 8fffc869..0862312c 100644
--- a/world/map/npc/025-4/battlecaves.txt
+++ b/world/map/npc/025-4/battlecaves.txt
@@ -3,8 +3,8 @@
 // ---------------------------------    Cave 1    -----------------------------------
 
 025-4.gat,41,85,0	script	#StartCaveFight1	324,{
-    if ($@wave_cave1 != 0 && $@cave1fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave1 != 0 && $@cave1fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave1 == 2 && $@cave1fighter$ == strcharinfo(0)) end;
+    if ($@battlecave1 == 2 && $@cave1fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave1 == 1) goto L_Start;
 
@@ -21,7 +21,8 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
-    
+    set $@battlecave1, 2;
+
 L_Summon:
     set $@cave1_loop, $@cave1_loop + 1;
     areamonster "025-4.gat",26,63,60,97,"",$@CAVE1_MONSTERS_IDS[$@cave1_loop],$@CAVE1_MONSTERS_QTY[$@cave1_loop],"#StartCaveFight1::OnMonsterDeath";
@@ -133,7 +134,7 @@ onInit:
 // ---------------------  Cave 1 Checker  ----------------------------
 
 025-4.gat,41,97,0	script	#CheckCaveFight1	45,1,1,{
-    if (cavefights & BATTLE_CAVE1 || $@wave_cave1 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE1 || $@battlecave1 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -146,8 +147,8 @@ L_Done:
 
 
 025-4.gat,115,77,0	script	#StartCaveFight2	324,{
-    if ($@wave_cave2 != 0 && $@cave2fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave2 != 0 && $@cave2fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave2 == 2 && $@cave2fighter$ == strcharinfo(0)) end;
+    if ($@battlecave2 == 2 && $@cave2fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave2 == 1) goto L_Start;
     
@@ -164,7 +165,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
- 
+    set $@battlecave2, 2;
 
 L_Summon:
     set $@cave2_loop, $@cave2_loop + 1;
@@ -205,7 +206,7 @@ L_no_root:
 // ---------------------  Cave 2 Checker  ----------------------------
 
 025-4.gat,110,96,0	script	#CheckCaveFight2	45,1,1,{
-    if (cavefights & BATTLE_CAVE2 || $@wave_cave2 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE2 || $@battlecave2 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -216,8 +217,8 @@ L_Done:
 
 // ------------------------------------    Cave 3    --------------------------------------
 025-4.gat,164,103,0	script	#StartCaveFight3	324,{
-    if ($@wave_cave3 != 0 && $@cave3fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave3 != 0 && $@cave3fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave3 == 2 && $@cave3fighter$ == strcharinfo(0)) end;
+    if ($@battlecave3 == 2 && $@cave3fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave3 == 1) goto L_Start;
     
@@ -234,7 +235,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
- 
+    set $@battlecave3, 2;
 
 L_Summon:
     set $@cave3_loop, $@cave3_loop + 1;
@@ -276,7 +277,7 @@ L_no_root:
 // ---------------------  Cave 3 Checker  ----------------------------
 
 025-4.gat,168,117,0	script	#CheckCaveFight3	45,1,1,{
-    if (cavefights & BATTLE_CAVE3 || $@wave_cave3 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE3 || $@battlecave3 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -287,8 +288,8 @@ L_Done:
 
 // ---------------------------    Cave 4    --------------------------------
 025-4.gat,39,143,0	script	#StartCaveFight4	324,{
-    if ($@wave_cave4 != 0 && $@cave4fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave4 != 0 && $@cave4fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave4 == 2 && $@cave4fighter$ == strcharinfo(0)) end;
+    if ($@battlecave4 == 2 && $@cave4fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave4 == 1) goto L_Start;
     
@@ -305,6 +306,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
+    set $@battlecave4, 2;
 
 L_Summon:
     set $@cave4_loop, $@cave4_loop + 1;
@@ -346,20 +348,23 @@ L_no_root:
 // ---------------------  Cave 4 Checker  ----------------------------
 
 025-4.gat,32,156,0	script	#CheckCaveFight4	45,1,1,{
-    if (cavefights & BATTLE_CAVE4 || $@wave_cave4 == 0) goto L_Done;
+    message strcharinfo(0), $@battlecave4;
+    if (cavefights & BATTLE_CAVE4 || $@battlecave4 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
 L_Done:
+    message strcharinfo(0), $@battlecave4;
     donpcevent "#WarpBattleCave4::OnGetout";
+    message strcharinfo(0), $@battlecave4;
     end;
 }
 
 // ----------------------------    Cave 5    ------------------------------
 
 025-4.gat,109,143,0	script	#StartCaveFight5	324,{
-    if ($@wave_cave5 != 0 && $@cave5fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave5 != 0 && $@cave5fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave5 == 2 && $@cave5fighter$ == strcharinfo(0)) end;
+    if ($@battlecave5 == 2 && $@cave5fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave5 == 1) goto L_Start;
     
@@ -376,6 +381,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
+    set $@battlecave5, 2;
 
 L_Summon:
     set $@cave5_loop, $@cave5_loop + 1;
@@ -417,7 +423,7 @@ L_no_root:
 // ---------------------  Cave 5 Checker  ----------------------------
 
 025-4.gat,100,160,0	script	#CheckCaveFight5	45,1,1,{
-    if (cavefights & BATTLE_CAVE5 || $@wave_cave5 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE5 || $@battlecave5 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -429,8 +435,8 @@ L_Done:
 // --------------------------------    Cave 6    -----------------------------------------
 
 025-4.gat,162,162,0	script	#StartCaveFight6	324,{
-    if ($@wave_cave6 != 0 && $@cave6fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave6 != 0 && $@cave6fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave6 == 2 && $@cave6fighter$ == strcharinfo(0)) end;
+    if ($@battlecave6 == 2 && $@cave6fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave6 == 1) goto L_Start;
     
@@ -447,6 +453,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
+    set $@battlecave6, 2;
 
 L_Summon:
     set $@cave6_loop, $@cave6_loop + 1;
@@ -488,7 +495,7 @@ L_no_root:
 // ---------------------  Cave 6 Checker  ----------------------------
 
 025-4.gat,159,174,0	script	#CheckCaveFight6	45,1,1,{
-    if (cavefights & BATTLE_CAVE6 || $@wave_cave6 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE6 || $@battlecave6 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -500,8 +507,8 @@ L_Done:
 // --------------------------------    Cave 7    -----------------------------------
 
 025-4.gat,44,202,0	script	#StartCaveFight7	324,{
-    if ($@wave_cave7 != 0 && $@cave7fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave7 != 0 && $@cave7fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave7 == 2 && $@cave7fighter$ == strcharinfo(0)) end;
+    if ($@battlecave7 == 2 && $@cave7fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave7 == 1) goto L_Start;
 
@@ -518,8 +525,8 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
-  
-    
+    set $@battlecave7, 2;
+
 L_Summon:
     set $@cave7_loop, $@cave7_loop + 1;
     areamonster "025-4.gat",27, 185, 61, 219,"",$@CAVE7_MONSTERS_IDS[$@cave7_loop],$@CAVE7_MONSTERS_QTY[$@cave7_loop],"#StartCaveFight7::OnMonsterDeath";
@@ -560,7 +567,7 @@ L_no_root:
 // ---------------------  Cave 7 Checker  ----------------------------
 
 025-4.gat,42,219,0	script	#CheckCaveFight7	45,1,1,{
-    if (cavefights & BATTLE_CAVE7 || $@wave_cave7 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE7 || $@battlecave7 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -572,8 +579,8 @@ L_Done:
 // ---------------------------    Cave 8    -------------------------------
 
 025-4.gat,105,210,0	script	#StartCaveFight8	324,{
-    if ($@wave_cave8 != 0 && $@cave8fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave8 != 0 && $@cave8fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave8 == 2 && $@cave8fighter$ == strcharinfo(0)) end;
+    if ($@battlecave8 == 2 && $@cave8fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave8 == 1) goto L_Start;
     
@@ -589,8 +596,8 @@ L_Start:
     if ((countitem("Root")<1)) goto L_no_root;
     close2;
     delitem "Root", 1;
-    message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
-  
+    message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";
+    set $@battlecave8, 2;
 
 L_Summon:
     set $@cave8_loop, $@cave8_loop + 1;
@@ -632,7 +639,7 @@ L_no_root:
 // ---------------------  Cave 8 Checker  ----------------------------
 
 025-4.gat,105,216,0	script	#CheckCaveFight8	45,1,1,{
-    if (cavefights & BATTLE_CAVE8 || $@wave_cave8 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE8 || $@battlecave8 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -644,8 +651,8 @@ L_Done:
 // ---------------------------    Cave 9    -------------------------------
 
 025-4.gat,157,220,0	script	#StartCaveFight9	324,{
-    if ($@wave_cave9 != 0 && $@cave9fighter$ == strcharinfo(0)) end;
-    if ($@wave_cave9 != 0 && $@cave9fighter$ != strcharinfo(0)) goto L_Cheat;
+    if ($@battlecave9 == 2 && $@cave9fighter$ == strcharinfo(0)) end;
+    if ($@battlecave9 == 2 && $@cave9fighter$ != strcharinfo(0)) goto L_Cheat;
     if (Rossy_Quest < 15) goto L_Cheat;
     if ($@battlecave9 == 1) goto L_Start;
     
@@ -662,6 +669,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
+    set $@battlecave9, 2;
 
 L_Summon:
     set $@cave9_loop, $@cave9_loop + 1;
@@ -703,7 +711,7 @@ L_no_root:
 // ---------------------  Cave 9 Checker  ----------------------------
 
 025-4.gat,157,226,0	script	#CheckCaveFight9	45,1,1,{
-    if (cavefights & BATTLE_CAVE9 || $@wave_cave9 == 0) goto L_Done;
+    if (cavefights & BATTLE_CAVE9 || $@battlecave9 == 1) goto L_Done;
     message strcharinfo(0), "You can't get out! Seems like a barrier was created when the energy transmuted itself into monsters.";
     end;
 
@@ -715,7 +723,7 @@ L_Done:
 // ---------------------  Boss Cave  ----------------------------
 
 025-4.gat,157,30,0	script	#StartBossCaveFight	325,{
-    if ($@wave_cave10 != 0) end;
+    if ($@battlecave10 == 2 && $@cave10fighter$ == strcharinfo(0)) end;
     if (Rossy_Quest >= 16) end;
     if ($@battlecave10 == 1 && cavefights & BATTLE_CAVE1 && cavefights & BATTLE_CAVE2 && cavefights & BATTLE_CAVE3 && cavefights & BATTLE_CAVE4 && cavefights & BATTLE_CAVE5 && cavefights & BATTLE_CAVE6 && cavefights & BATTLE_CAVE7 && cavefights & BATTLE_CAVE8 && cavefights & BATTLE_CAVE9 && Rossy_Quest == 15) goto L_Start;
     message strcharinfo(0), "You shouldn't be here, you cheater.";
@@ -730,6 +738,7 @@ L_Start:
     close2;
     delitem "Root", 1;
     message strcharinfo(0), "As you place the root on the energy source, earth monsters seem to emerge from the ground.";    
+    set $@battlecave10, 2;
 
 L_Summon:
     set $@cave10_loop, $@cave10_loop + 1;
@@ -812,8 +821,8 @@ L_no_root:
 025-4.gat,157,48,0	script	#CheckCaveFightBoss	45,1,1,{
     if (Rossy_Quest >= 17) goto L_Done;
     if (Rossy_Quest == 16) goto L_Julia;
-    if (Rossy_Quest < 16 && $@wave_cave10 == 0) goto L_Out;
-    if (Rossy_Quest < 16 && $@wave_cave10 != 0) goto L_Julia;
+    if (Rossy_Quest < 16 && $@battlecave10 == 1) goto L_Out;
+    if (Rossy_Quest < 16 && $@battlecave10 == 2) goto L_Julia;
     end;
 
 L_Julia:
-- 
cgit v1.2.3-70-g09d2