summaryrefslogtreecommitdiff
path: root/world/map/npc/034-1/ambushs.txt
blob: ff01993b1751859ac904cbe172a0cc5a58e3b71c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// This file belongs to the wolvern hunting quest given by 033-1/birrod.txt
// Author: Jenalya
// TODO: add more ambushs all over the map

034-1.gat,118,59,0|script|#Ambush0Trigger|45,1,1,{
    set @Q_Barbarians_MASK, NIBBLE_0_MASK;
    set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;
    set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);
    if (@state != 4)
        end;
    if (rand(50) > wolvern_count) // TODO: eventally use different argument for rand
        end;
    set $@Ambush0VictimID, getcharid(3);
    if ($@Ambush0_Active != 0)
        end;
    set $@Ambush0_Active, 1;
    donpcevent "#Ambush0::OnAmbush";
    end;
}

034-1.gat,119,60,0|script|#Ambush0|45,{
end;

OnAmbush:
    attachrid($@Ambush0VictimID);
    set @wolvern_amount, 10;   // has to be same value as in birrod.txt
    set $@Ambush0_Spawn, 4 + rand(3);
    message strcharinfo(0), "An ambush!";
    areamonster "034-1.gat", 113, 55, 122, 63, "", 1089, $@Ambush0_Spawn, "#Ambush0::OnWolvernDeath";
    set $@Ambush0VictimID, 0;
    end;

OnWolvernDeath:
    set @MobID, 1089; // TODO: adapt

    set @Q_Barbarians_MASK, NIBBLE_0_MASK;
    set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;
    set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);
    if (@state == 4)
        set wolvern_count, wolvern_count + 1;

    set $@Ambush0_Spawn, $@Ambush0_Spawn - 1;
    if ($@Ambush0_Spawn == 0)
        set $@Ambush0_Active, 0;

    if (wolvern_count >= @wolvern_amount)
        message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?";
    end;
}

034-1.gat,94,91,0|script|#Ambush1Trigger|45,1,1,{
    set @Q_Barbarians_MASK, NIBBLE_0_MASK;
    set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;
    set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);
    if (@state != 4)
        end;
    if (rand(50) > wolvern_count)
        end;
    set $@Ambush1VictimID, getcharid(3);
    if ($@Ambush1_Active != 0)
        end;
    set $@Ambush1_Active, 1;
    donpcevent "#Ambush1::OnAmbush";
    end;
}

034-1.gat,94,92,0|script|#Ambush1|45,{
end;

OnAmbush:
    attachrid($@Ambush1VictimID);
    set @wolvern_amount, 10;   // has to be same value as in birrod.txt
    set $@Ambush1_Spawn, 4 + rand(3);
    message strcharinfo(0), "An ambush!";
    areamonster "034-1.gat", 91, 89, 98, 94, "", 1089, $@Ambush1_Spawn, "#Ambush1::OnWolvernDeath";
    set $@Ambush1VictimID, 0;
    end;

OnWolvernDeath:
    set @MobID, 1089; // TODO: adapt

    set @Q_Barbarians_MASK, NIBBLE_0_MASK;
    set @Q_Barbarians_SHIFT, NIBBLE_0_SHIFT;
    set @state, ((QUEST_Barbarians & @Q_Barbarians_MASK) >> @Q_Barbarians_SHIFT);
    if (@state == 4)
        set wolvern_count, wolvern_count + 1;

    set $@Ambush1_Spawn, $@Ambush1_Spawn - 1;
    if ($@Ambush1_Spawn == 0)
        set $@Ambush1_Active, 0;

    if (wolvern_count >= @wolvern_amount)
        message strcharinfo(0), "You've hunted down a lot of Wolverns. Maybe you should talk to Birrod?";
    end;
}