summaryrefslogtreecommitdiff
path: root/npc/functions/timer.txt
blob: e79070f3ba3d7f144dbf3e2b67256a7027103662 (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
// areatimer("<map>", <x1>, <y1>, <x2>, <y2>, <tick>, "<npc>::<event>")
function	script	areatimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));
    for (.@i = 0; .@i < .@c; .@i++) {
        addtimer(getarg(5), getarg(6), .@players[.@i]);
    }
    return .@i;
}

// areadeltimer("<map>", <x1>, <y1>, <x2>, <y2>, "<npc>::<event>")
function	script	areadeltimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));
    for (.@i = 0; .@i < .@c; .@i++) {
        deltimer(getarg(5), .@players[.@i]);
    }
    return .@i;
}

// areatimer2("<map>", <x1>, <y1>, <x2>, <y2>, <tick>, "<npc>::<event>")
function	script	areatimer2	{
    .@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));
    for (.@i = 0; .@i < .@c; .@i++) {
        deltimer(getarg(6), .@players[.@i]);
        addtimer(getarg(5), getarg(6), .@players[.@i]);
    }
    return .@i;
}


// maptimer("<map>", <tick>, "<npc>::<event>")
function	script	maptimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0));
    for (.@i = 0; .@i < .@c; .@i++) {
        addtimer(getarg(1), getarg(2), .@players[.@i]);
    }
    return .@i;
}

// maptimer2("<map>", <tick>, "<npc>::<event>")
function	script	maptimer2	{
    .@c = getunits(BL_PC, .@players, false, getarg(0));
    for (.@i = 0; .@i < .@c; .@i++) {
        deltimer(getarg(2), .@players[.@i]);
        addtimer(getarg(1), getarg(2), .@players[.@i]);
    }
    return .@i;
}

// mapdeltimer("<map>", "<npc>::<event>")
function	script	mapdeltimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0));
    for (.@i = 0; .@i < .@c; .@i++) {
        deltimer(getarg(1), .@players[.@i]);
    }
    return .@i;
}