summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/global_event_handler.txt
blob: f05e3b6237c18a6e77bcd8a4d41b1a49eb001111 (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
017-9.gat,0,0,0|script|#GlobalHandler|-1
{
    end;

OnPCLoginEvent: // this does not work yet but as soon as it is implemented it will start working
    callfunc "ClearVariables";
    end;

OnPCKillEvent:
    set Death_Kill, Death_Kill + 1; // this counts the number of players you have killed
    end;

OnPCKilledEvent:
    goto L_Fightclub_Killed; // this is used by the 1v1 arena

OnPCDieEvent:
    callfunc "fightclub_GoBack"; // this used by the battle master
    goto L_Fightclub_Die; // this is used by the 1v1 arena

// custom handlers below

L_Fightclub_Killed:
    set @duel_killer, 0;
    if(@Duel_Fighter != 1) goto L_End;
    if(getmap() != "009-7") goto L_End;
    set $@duel_loser, getcharid(3); // grab the rid of the victim
    set $@duel_winner, @killerrid; // grab the rid of the killer
    set @killerrid, 0; // reset killerid
    callfunc "fightclub_death";
    goto L_End;

L_Fightclub_Die:
    set @duel_killer, 0;
    if(@Duel_Fighter != 1) goto L_End;
    if(getmap() != "009-7") goto L_End;
    set @killerrid, 0; // since the player was not murdered, the killerrid is 0
    set $@duel_loser, getcharid(3); // grab the rid of the victim
    callfunc "fightclub_death";
    goto L_End;

L_End:
    end;
}