summaryrefslogtreecommitdiff
path: root/world/map/npc/functions
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2014-11-01 22:20:41 -0500
committerWushin <pasekei@gmail.com>2014-11-01 22:20:41 -0500
commite0107f44ce41a6e130030cef2f79748cdf67b250 (patch)
tree6468d496b3385097b5475fb740f226d379880062 /world/map/npc/functions
parent82ce751849a79c29d76a2b2ee5f5ec2a820ae700 (diff)
parentb2aaa61286c1e3a107df7fcd8d63086b360aa0f6 (diff)
downloadserverdata-e0107f44ce41a6e130030cef2f79748cdf67b250.tar.gz
serverdata-e0107f44ce41a6e130030cef2f79748cdf67b250.tar.bz2
serverdata-e0107f44ce41a6e130030cef2f79748cdf67b250.tar.xz
serverdata-e0107f44ce41a6e130030cef2f79748cdf67b250.zip
Merge pull request #169 from mekolat/duels
Fight Club
Diffstat (limited to 'world/map/npc/functions')
-rw-r--r--world/map/npc/functions/global_event_handler.txt43
1 files changed, 43 insertions, 0 deletions
diff --git a/world/map/npc/functions/global_event_handler.txt b/world/map/npc/functions/global_event_handler.txt
new file mode 100644
index 00000000..acb328f4
--- /dev/null
+++ b/world/map/npc/functions/global_event_handler.txt
@@ -0,0 +1,43 @@
+017-9.gat,0,0,0|script|#GlobalHandler|-1,-1,-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 @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 @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;
+}