From 3c4f682a8edf0214fe098b76f243cc79e03c6fd2 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 4 Sep 2019 23:09:39 -0300 Subject: Simplify the logic --- npc/018-6-3/main.txt | 65 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'npc/018-6-3/main.txt') diff --git a/npc/018-6-3/main.txt b/npc/018-6-3/main.txt index 4d0553bfa..a18e1ba1b 100644 --- a/npc/018-6-3/main.txt +++ b/npc/018-6-3/main.txt @@ -82,92 +82,109 @@ function BossRoom { if (.@ad) { AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, HoodedNinja, any(0,0,1)); } + return false; } - - return; + return true; } // W - West, C - Center, E - East, N - North, S - South OnRoomNorth: - BossRoom(1, 62, 41, 121, 58, true); +L_Room1: + if (BossRoom(1, 62, 41, 121, 58, true)) { + debugmes "Here we need to enable room warps"; + //enablenpc instance_npcname("#01863_fromNorthtoNW"); + //enablenpc instance_npcname("#01863_fromNorthtoNE"); + } end; OnRoomNW: - BossRoom(2, 48, 65, 68, 85); +L_Room2: + if (BossRoom(2, 48, 65, 68, 85)) { + debugmes "Here we need to enable room warps"; + //enablenpc instance_npcname("#01863_fromNWtoNorth"); + //enablenpc instance_npcname("#01863_fromNWtoNC"); + } end; OnRoomNC: +L_Room4: BossRoom(4, 77, 65, 103, 76); end; OnRoomNE: +L_Room8: BossRoom(8, 111, 65, 131, 85); end; OnRoomSW: +L_Room16: BossRoom(16, 48, 95, 68, 115); end; OnRoomSC: +L_Room32: BossRoom(32, 77, 104, 103, 115); end; OnRoomSE: +L_Room64: BossRoom(64, 111, 95, 131, 115); end; OnRoomSouth: +L_Room128: BossRoom(128, 62, 122, 121, 139, true); end; // Kill boss will use setq3 and also erase any remaining monster +// Then it'll cast again the room event to enable the warps. OnKill1: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|1; killmonsterall(getmap()); - end; + goto L_Room1; OnKill2: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|2; killmonsterall(getmap()); - end; + goto L_Room2; OnKill4: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|4; killmonsterall(getmap()); - end; + goto L_Room4; OnKill8: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|8; killmonsterall(getmap()); - end; + goto L_Room8; OnKill16: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|16; killmonsterall(getmap()); - end; + goto L_Room16; OnKill32: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|32; killmonsterall(getmap()); - end; + goto L_Room32; OnKill64: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|64; killmonsterall(getmap()); - end; + goto L_Room64; OnKill128: .@q3=getq3(LoFQuest_Barbara); setq3 LoFQuest_Barbara, .@q3|128; killmonsterall(getmap()); - end; + goto L_Room128; OnKill256: .@q3=getq3(LoFQuest_Barbara); @@ -178,37 +195,29 @@ OnKill256: } ////////// Warp System below this file -018-6-3,0,0,0 script #01863_fromOuttoNC NPC_SUMMONING_CIRC,0,0,{ - dispbottom l("I should be prepared before walking on this"); +// Xanthem: This is a NPC. I need you to duplicate it several times. +018-6-3,0,0,0 script #01863_fromOuttoNorth NPC_SUMMONING_CIRC,0,0,{ + dispbottom l("I should be prepared before walking on this."); end; OnTouch: .@q=getq(LoFQuest_Barbara); .@q2=getq2(LoFQuest_Barbara); .@q3=getq3(LoFQuest_Barbara); - if (.@q != 3) + if (.@q < 3) Exception("ERROR, INVALID WARP", RB_DEFAULT|RB_ISFATAL); - // Compulsory call + // Disable any other active portal 01863_DisableAllWarps(); // Warp you to next room coordinates slide 0, 0; - // Check if a boss fight is needed or open the warps - // This room is 1 (rooms are 1, 2, 4, 8, 16...) - if (01863_RelevanceCheck(1)) { - // Copy here the code of OnBossNC - //doevent "#01863_InstCtrl::OnBossNC"; - BossRoom(4, 77, 65, 103, 76); - } else { - // enablenpc instance_npcname("#01863_fromNCtoNW"); - // enablenpc instance_npcname("#01863_fromNCtoNE"); - debugmes "filler"; - } + // Execute the next room code and finish + doevent instance_npcname("#01863_InstCtrl", .@q2)+"::OnBossNC"; end; - +// NPC must remain hidden. OnInit: disablenpc .name$; end; -- cgit v1.2.3-60-g2f50