From d7a75fccd6400efd31780cc56fa2b808c822b7a4 Mon Sep 17 00:00:00 2001 From: Jessica Tölke Date: Wed, 1 Feb 2012 20:55:08 +0100 Subject: Barbarian ambushs: - fix bug that prevents ambushs from happening again if a different player killed the last wolvern - save which ambushs has already been triggered in a temporary variable to prevent a player using only one ambush again and again --- world/map/npc/033-1/barbarianinit.txt | 16 ++ world/map/npc/034-1/ambushs.txt | 525 ++++++++++++++++++---------------- 2 files changed, 301 insertions(+), 240 deletions(-) (limited to 'world') diff --git a/world/map/npc/033-1/barbarianinit.txt b/world/map/npc/033-1/barbarianinit.txt index 25d9399c..3307ac0f 100644 --- a/world/map/npc/033-1/barbarianinit.txt +++ b/world/map/npc/033-1/barbarianinit.txt @@ -3,4 +3,20 @@ OnInit: set $@Q_Barbarians_MASK, NIBBLE_0_MASK; set $@Q_Barbarians_SHIFT, NIBBLE_0_SHIFT; set $@Q_Barbarians_wolvern_amount, 16; + set $@Q_Barbarians_Ambush_max, 0x00007FFF; + set $@Q_Barbarians_Ambush0_flag, 0x00000001; + set $@Q_Barbarians_Ambush1_flag, 0x00000002; + set $@Q_Barbarians_Ambush2_flag, 0x00000004; + set $@Q_Barbarians_Ambush3_flag, 0x00000008; + set $@Q_Barbarians_Ambush4_flag, 0x00000010; + set $@Q_Barbarians_Ambush5_flag, 0x00000020; + set $@Q_Barbarians_Ambush6_flag, 0x00000040; + set $@Q_Barbarians_Ambush7_flag, 0x00000080; + set $@Q_Barbarians_Ambush8_flag, 0x00000100; + set $@Q_Barbarians_Ambush9_flag, 0x00000200; + set $@Q_Barbarians_Ambush10_flag, 0x00000400; + set $@Q_Barbarians_Ambush11_flag, 0x00000800; + set $@Q_Barbarians_Ambush12_flag, 0x00001000; + set $@Q_Barbarians_Ambush13_flag, 0x00002000; + set $@Q_Barbarians_Ambush14_flag, 0x00004000; } diff --git a/world/map/npc/034-1/ambushs.txt b/world/map/npc/034-1/ambushs.txt index 480b62ca..a1aa8a69 100644 --- a/world/map/npc/034-1/ambushs.txt +++ b/world/map/npc/034-1/ambushs.txt @@ -1,18 +1,21 @@ // This file belongs to the wolvern hunting quest given by 033-1/birrod.txt -// Author: Jenalya +// Author: Jenalya, cody, PjotrOrial 034-1.gat,118,59,0|script|#Ambush0Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush0_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush0_Active != 0) + if ($@Ambush0_Spawn > 0) end; set $@Ambush0VictimID, getcharid(3); - set $@Ambush0_Active, 1; donpcevent "#Ambush0::OnAmbush"; end; } @@ -22,15 +25,11 @@ end; OnAmbush: if (attachrid($@Ambush0VictimID) == 0) - goto L_Abort; - set $@Ambush0_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush0_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 113, 55, 122, 63, "", 1090, $@Ambush0_Spawn, "#Ambush0::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush0_Active, 0; - set $@Ambush0VictimID, 0; + areamonster "034-1.gat", 115, 56, 121, 62, "", 1090, $@Ambush0_Spawn, "#Ambush0::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush0_flag; end; OnWolvernDeath: @@ -40,32 +39,39 @@ OnWolvernDeath: set $@Ambush0_Spawn, $@Ambush0_Spawn - 1; - if ($@Ambush0VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush0VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush0_Spawn > 0) end; +L_Clean: + set $@Ambush0VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush0_Spawn == 0) - goto L_Abort; + if ($@Ambush0_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,94,91,0|script|#Ambush1Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush1_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush1_Active != 0) + if ($@Ambush1_Spawn > 0) end; set $@Ambush1VictimID, getcharid(3); - set $@Ambush1_Active, 1; donpcevent "#Ambush1::OnAmbush"; end; } @@ -75,15 +81,11 @@ end; OnAmbush: if (attachrid($@Ambush1VictimID) == 0) - end; - set $@Ambush1_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush1_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 91, 89, 98, 94, "", 1090, $@Ambush1_Spawn, "#Ambush1::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush1_Active, 0; - set $@Ambush1VictimID, 0; + areamonster "034-1.gat", 91, 88, 97, 94, "", 1090, $@Ambush1_Spawn, "#Ambush1::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush1_flag; end; OnWolvernDeath: @@ -93,32 +95,39 @@ OnWolvernDeath: set $@Ambush1_Spawn, $@Ambush1_Spawn - 1; - if ($@Ambush1VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush1VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush1_Spawn > 0) end; +L_Clean: + set $@Ambush1VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush1_Spawn == 0) - goto L_Abort; + if ($@Ambush1_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,122,35,0|script|#Ambush2Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush2_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush2_Active != 0) + if ($@Ambush2_Spawn > 0) end; set $@Ambush2VictimID, getcharid(3); - set $@Ambush2_Active, 1; donpcevent "#Ambush2::OnAmbush"; end; } @@ -128,15 +137,11 @@ end; OnAmbush: if (attachrid($@Ambush2VictimID) == 0) - goto L_Abort; - set $@Ambush2_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush2_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 118, 32, 126, 39, "", 1090, $@Ambush2_Spawn, "#Ambush2::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush2_Active, 0; - set $@Ambush2VictimID, 0; + areamonster "034-1.gat", 119, 32, 125, 38, "", 1090, $@Ambush2_Spawn, "#Ambush2::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush2_flag; end; OnWolvernDeath: @@ -146,32 +151,39 @@ OnWolvernDeath: set $@Ambush2_Spawn, $@Ambush2_Spawn - 1; - if ($@Ambush2VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush2VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush2_Spawn > 0) end; +L_Clean: + set $@Ambush2VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush2_Spawn == 0) - goto L_Abort; + if ($@Ambush2_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,83,44,0|script|#Ambush3Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush3_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush3_Active != 0) + if ($@Ambush3_Spawn > 0) end; set $@Ambush3VictimID, getcharid(3); - set $@Ambush3_Active, 1; donpcevent "#Ambush3::OnAmbush"; end; } @@ -181,15 +193,11 @@ end; OnAmbush: if (attachrid($@Ambush3VictimID) == 0) - goto L_Abort; - set $@Ambush3_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush3_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 79, 41, 86, 47, "", 1090, $@Ambush3_Spawn, "#Ambush3::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush3_Active, 0; - set $@Ambush3VictimID, 0; + areamonster "034-1.gat", 80, 41, 86, 47, "", 1090, $@Ambush3_Spawn, "#Ambush3::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush3_flag; end; OnWolvernDeath: @@ -199,32 +207,39 @@ OnWolvernDeath: set $@Ambush3_Spawn, $@Ambush3_Spawn - 1; - if ($@Ambush3VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush3VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush3_Spawn > 0) end; +L_Clean: + set $@Ambush3VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush3_Spawn == 0) - goto L_Abort; + if ($@Ambush3_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,74,28,0|script|#Ambush4Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush4_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush4_Active != 0) + if ($@Ambush4_Spawn > 0) end; set $@Ambush4VictimID, getcharid(3); - set $@Ambush4_Active, 1; donpcevent "#Ambush4::OnAmbush"; end; } @@ -234,15 +249,11 @@ end; OnAmbush: if (attachrid($@Ambush4VictimID) == 0) - goto L_Abort; - set $@Ambush4_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush4_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 69, 25, 77, 31, "", 1090, $@Ambush4_Spawn, "#Ambush4::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush4_Active, 0; - set $@Ambush4VictimID, 0; + areamonster "034-1.gat", 71, 25, 77, 31, "", 1090, $@Ambush4_Spawn, "#Ambush4::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush4_flag; end; OnWolvernDeath: @@ -252,32 +263,39 @@ OnWolvernDeath: set $@Ambush4_Spawn, $@Ambush4_Spawn - 1; - if ($@Ambush4VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush4VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush4_Spawn > 0) end; +L_Clean: + set $@Ambush4VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush4_Spawn == 0) - goto L_Abort; + if ($@Ambush4_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,26,44,0|script|#Ambush5Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush5_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush5_Active != 0) + if ($@Ambush5_Spawn > 0) end; set $@Ambush5VictimID, getcharid(3); - set $@Ambush5_Active, 1; donpcevent "#Ambush5::OnAmbush"; end; } @@ -287,15 +305,11 @@ end; OnAmbush: if (attachrid($@Ambush5VictimID) == 0) - goto L_Abort; - set $@Ambush5_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush5_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 22, 40, 30, 48, "", 1090, $@Ambush5_Spawn, "#Ambush5::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush5_Active, 0; - set $@Ambush5VictimID, 0; + areamonster "034-1.gat", 23, 41, 29, 47, "", 1090, $@Ambush5_Spawn, "#Ambush5::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush5_flag; end; OnWolvernDeath: @@ -305,32 +319,39 @@ OnWolvernDeath: set $@Ambush5_Spawn, $@Ambush5_Spawn - 1; - if ($@Ambush5VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush5VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush5_Spawn > 0) end; +L_Clean: + set $@Ambush5VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush5_Spawn == 0) - goto L_Abort; + if ($@Ambush5_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,50,47,0|script|#Ambush6Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush6_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush6_Active != 0) + if ($@Ambush6_Spawn > 0) end; set $@Ambush6VictimID, getcharid(3); - set $@Ambush6_Active, 1; donpcevent "#Ambush6::OnAmbush"; end; } @@ -340,15 +361,11 @@ end; OnAmbush: if (attachrid($@Ambush6VictimID) == 0) - goto L_Abort; - set $@Ambush6_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush6_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 46, 45, 54, 50, "", 1090, $@Ambush6_Spawn, "#Ambush6::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush6_Active, 0; - set $@Ambush6VictimID, 0; + areamonster "034-1.gat", 47, 44, 53, 50, "", 1090, $@Ambush6_Spawn, "#Ambush6::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush6_flag; end; OnWolvernDeath: @@ -358,32 +375,39 @@ OnWolvernDeath: set $@Ambush6_Spawn, $@Ambush6_Spawn - 1; - if ($@Ambush6VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush6VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush6_Spawn > 0) end; +L_Clean: + set $@Ambush6VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush6_Spawn == 0) - goto L_Abort; + if ($@Ambush6_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,36,62,0|script|#Ambush7Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush7_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush7_Active != 0) + if ($@Ambush7_Spawn > 0) end; set $@Ambush7VictimID, getcharid(3); - set $@Ambush7_Active, 1; donpcevent "#Ambush7::OnAmbush"; end; } @@ -393,15 +417,11 @@ end; OnAmbush: if (attachrid($@Ambush7VictimID) == 0) - goto L_Abort; - set $@Ambush7_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush7_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 31, 59, 39, 65, "", 1090, $@Ambush7_Spawn, "#Ambush7::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush7_Active, 0; - set $@Ambush7VictimID, 0; + areamonster "034-1.gat", 33, 59, 39, 65, "", 1090, $@Ambush7_Spawn, "#Ambush7::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush7_flag; end; OnWolvernDeath: @@ -411,32 +431,39 @@ OnWolvernDeath: set $@Ambush7_Spawn, $@Ambush7_Spawn - 1; - if ($@Ambush7VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush7VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush7_Spawn > 0) end; +L_Clean: + set $@Ambush7VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush7_Spawn == 0) - goto L_Abort; + if ($@Ambush7_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,26,95,0|script|#Ambush8Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush8_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush8_Active != 0) + if ($@Ambush8_Spawn > 0) end; set $@Ambush8VictimID, getcharid(3); - set $@Ambush8_Active, 1; donpcevent "#Ambush8::OnAmbush"; end; } @@ -446,15 +473,11 @@ end; OnAmbush: if (attachrid($@Ambush8VictimID) == 0) - goto L_Abort; - set $@Ambush8_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush8_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 21, 90, 32, 100, "", 1090, $@Ambush8_Spawn, "#Ambush8::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush8_Active, 0; - set $@Ambush8VictimID, 0; + areamonster "034-1.gat", 23, 92, 29, 98, "", 1090, $@Ambush8_Spawn, "#Ambush8::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush8_flag; end; OnWolvernDeath: @@ -464,32 +487,39 @@ OnWolvernDeath: set $@Ambush8_Spawn, $@Ambush8_Spawn - 1; - if ($@Ambush8VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush8VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush8_Spawn > 0) end; +L_Clean: + set $@Ambush8VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush8_Spawn == 0) - goto L_Abort; + if ($@Ambush8_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,56,91,0|script|#Ambush9Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush9_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush9_Active != 0) + if ($@Ambush9_Spawn > 0) end; set $@Ambush9VictimID, getcharid(3); - set $@Ambush9_Active, 1; donpcevent "#Ambush9::OnAmbush"; end; } @@ -499,15 +529,11 @@ end; OnAmbush: if (attachrid($@Ambush9VictimID) == 0) - goto L_Abort; - set $@Ambush9_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush9_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 52, 88, 61, 96, "", 1090, $@Ambush9_Spawn, "#Ambush9::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush9_Active, 0; - set $@Ambush9VictimID, 0; + areamonster "034-1.gat", 53, 88, 59, 94, "", 1090, $@Ambush9_Spawn, "#Ambush9::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush9_flag; end; OnWolvernDeath: @@ -517,32 +543,39 @@ OnWolvernDeath: set $@Ambush9_Spawn, $@Ambush9_Spawn - 1; - if ($@Ambush9VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush9VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush9_Spawn > 0) end; +L_Clean: + set $@Ambush9VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush9_Spawn == 0) - goto L_Abort; + if ($@Ambush9_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,65,66,0|script|#Ambush10Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush10_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush10_Active != 0) + if ($@Ambush10_Spawn > 0) end; set $@Ambush10VictimID, getcharid(3); - set $@Ambush10_Active, 1; donpcevent "#Ambush10::OnAmbush"; end; } @@ -552,15 +585,11 @@ end; OnAmbush: if (attachrid($@Ambush10VictimID) == 0) - goto L_Abort; - set $@Ambush10_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush10_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 60, 63, 69, 69, "", 1090, $@Ambush10_Spawn, "#Ambush10::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush10_Active, 0; - set $@Ambush10VictimID, 0; + areamonster "034-1.gat", 62, 63, 68, 69, "", 1090, $@Ambush10_Spawn, "#Ambush10::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush10_flag; end; OnWolvernDeath: @@ -570,32 +599,39 @@ OnWolvernDeath: set $@Ambush10_Spawn, $@Ambush10_Spawn - 1; - if ($@Ambush10VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush10VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush10_Spawn > 0) end; +L_Clean: + set $@Ambush10VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush10_Spawn == 0) - goto L_Abort; + if ($@Ambush10_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,86,68,0|script|#Ambush11Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush11_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush11_Active != 0) + if ($@Ambush11_Spawn > 0) end; set $@Ambush11VictimID, getcharid(3); - set $@Ambush11_Active, 1; donpcevent "#Ambush11::OnAmbush"; end; } @@ -605,15 +641,11 @@ end; OnAmbush: if (attachrid($@Ambush11VictimID) == 0) - goto L_Abort; - set $@Ambush11_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush11_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 82, 65, 90, 72, "", 1090, $@Ambush11_Spawn, "#Ambush11::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush11_Active, 0; - set $@Ambush11VictimID, 0; + areamonster "034-1.gat", 83, 65, 89, 71, "", 1090, $@Ambush11_Spawn, "#Ambush11::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush11_flag; end; OnWolvernDeath: @@ -623,32 +655,39 @@ OnWolvernDeath: set $@Ambush11_Spawn, $@Ambush11_Spawn - 1; - if ($@Ambush11VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush11VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush11_Spawn > 0) end; +L_Clean: + set $@Ambush11VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush11_Spawn == 0) - goto L_Abort; + if ($@Ambush11_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,101,79,0|script|#Ambush12Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush12_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush12_Active != 0) + if ($@Ambush12_Spawn > 0) end; set $@Ambush12VictimID, getcharid(3); - set $@Ambush12_Active, 1; donpcevent "#Ambush12::OnAmbush"; end; } @@ -658,15 +697,11 @@ end; OnAmbush: if (attachrid($@Ambush12VictimID) == 0) - goto L_Abort; - set $@Ambush12_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush12_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 98, 76, 104, 81, "", 1090, $@Ambush12_Spawn, "#Ambush12::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush12_Active, 0; - set $@Ambush12VictimID, 0; + areamonster "034-1.gat", 98, 76, 104, 82, "", 1090, $@Ambush12_Spawn, "#Ambush12::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush12_flag; end; OnWolvernDeath: @@ -676,32 +711,39 @@ OnWolvernDeath: set $@Ambush12_Spawn, $@Ambush12_Spawn - 1; - if ($@Ambush12VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush12VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush12_Spawn > 0) end; +L_Clean: + set $@Ambush12VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush12_Spawn == 0) - goto L_Abort; + if ($@Ambush12_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,124,88,0|script|#Ambush13Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush13_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush13_Active != 0) + if ($@Ambush13_Spawn > 0) end; set $@Ambush13VictimID, getcharid(3); - set $@Ambush13_Active, 1; donpcevent "#Ambush13::OnAmbush"; end; } @@ -711,15 +753,11 @@ end; OnAmbush: if (attachrid($@Ambush13VictimID) == 0) - goto L_Abort; - set $@Ambush13_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush13_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; - areamonster "034-1.gat", 120, 86, 127, 90, "", 1090, $@Ambush13_Spawn, "#Ambush13::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush13_Active, 0; - set $@Ambush13VictimID, 0; + areamonster "034-1.gat", 121, 85, 127, 91, "", 1090, $@Ambush13_Spawn, "#Ambush13::OnWolvernDeath"; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush13_flag; end; OnWolvernDeath: @@ -729,32 +767,39 @@ OnWolvernDeath: set $@Ambush13_Spawn, $@Ambush13_Spawn - 1; - if ($@Ambush13VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush13VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush13_Spawn > 0) end; +L_Clean: + set $@Ambush13VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush13_Spawn == 0) - goto L_Abort; + if ($@Ambush13_Spawn <= 0) + goto L_Clean; end; } + 034-1.gat,117,103,0|script|#Ambush14Trigger|32767,2,2,{ set @state, ((QUEST_Barbarians & $@Q_Barbarians_MASK) >> $@Q_Barbarians_SHIFT); if (@state != 4) end; + if (@ambushs034 == $@Q_Barbarians_Ambush_max) + set @ambushs034, 0; + if (@ambushs034 & $@Q_Barbarians_Ambush14_flag) + end; if (rand(50) < wolvern_count) end; - if ($@Ambush14_Active != 0) + if ($@Ambush14_Spawn > 0) end; set $@Ambush14VictimID, getcharid(3); - set $@Ambush14_Active, 1; donpcevent "#Ambush14::OnAmbush"; end; } @@ -764,15 +809,11 @@ end; OnAmbush: if (attachrid($@Ambush14VictimID) == 0) - goto L_Abort; - set $@Ambush14_Spawn, 3 + rand(1); + L_Clean; + set $@Ambush14_Spawn, 3 + rand(2); message strcharinfo(0), "An ambush!"; areamonster "034-1.gat", 114, 100, 120, 106, "", 1090, $@Ambush14_Spawn, "#Ambush14::OnWolvernDeath"; - end; - -L_Abort: - set $@Ambush14_Active, 0; - set $@Ambush14VictimID, 0; + set @ambushs034, @ambushs034 | $@Q_Barbarians_Ambush14_flag; end; OnWolvernDeath: @@ -782,16 +823,20 @@ OnWolvernDeath: set $@Ambush14_Spawn, $@Ambush14_Spawn - 1; - if ($@Ambush14VictimID != getcharid(3)) - end; - if (@state != 4) + if (($@Ambush14VictimID == getcharid(3)) && (@state == 4)) + goto L_Count; + if ($@Ambush14_Spawn > 0) end; +L_Clean: + set $@Ambush14VictimID, 0; + end; +L_Count: set wolvern_count, wolvern_count + 1; if (wolvern_count >= $@Q_Barbarians_wolvern_amount) message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?"; - - if ($@Ambush14_Spawn == 0) - goto L_Abort; + if ($@Ambush14_Spawn <= 0) + goto L_Clean; end; } + -- cgit v1.2.3-60-g2f50