// TMW2 Scripts
// Author:
// 4144
// Jesusalva
// Description:
// Arena for Duels and PVP (003-13,31,31)
003-10,26,60,0 script Arnea NPC_ELF_F,{
// FIXIT code
if (!is_staff()) goto L_Incomplete;
mesn;
mesq l("Welcome to the Arena. Select your action");
menu
l("Create new arena"), L_NewArena,
l("Join existing arena"), L_JoinArena,
l("Information"), L_Info,
l("Leave"), L_Quit;
L_NewArena:
mes "";
mesn;
if (Zeny < .price) {
mesq l("You need @@ GP to use this arena.", .price);
} else {
mesq l("Okay, which arena will you rent? Cost is @@ GP.", .price);
menu
rif(Zeny > 1000, l("Rent arena")), -,
l("Give Up"), L_Quit;
// Register to HTTable $@ARENAS (or override existing entry) your ID and a password
.@PASSWORD=getcharid(0)**1.137;
htput($@ARENAS, .@PASSWORD, getcharid(0));
// XXX - Important Note - XXX
// map name MUST be only 4 chars long (eg. "abcd") on char instances
.@ID=getcharid(0);
.@MAP$="AREN@"+str(.@ID);
// Create the arena
.@INSTID = instance_create("003-10@"+(.@ID), getcharid(3), IOT_CHAR);
.@instanceMapName$ = instance_attachmap("003-13", .@INSTID, 0, .@MAP$);
instance_set_timeout(1800, 1800, .@INSTID);
instance_init(.@INSTID);
dispbottom l("Arena created, it can be used for 10 minutes.");
dispbottom l("Room password: @@", .@PASSWORD);
goto L_Quit;
L_Info:
mes "npc name: " + .name$;
mes "npc ext name: " + .extname$;
mes "npc id: " + .id;
mes "npc parent id: " + .parent;
mes "npc src id: " + .srcId;
mes "char id 3: " + getcharid(3);
if (instance_id() >= 0)
mes "instance id: " + instance_id();
close;
L_JoinArena:
mes "";
mesn;
mesq l("Okay, to join an arena, you need the unique password. Leave blank if you don't know.");
input .@user_password;
.@m = htget($@ARENAS, .@user_password, -1);
if (.@m > 0) {
if(has_instance2("003-10@"+.@m)) {
warp "AREN@"+str(.@m), 31,31;
} else {
mes "";
mesn;
mesq l("Sorry, that arena is already closed.");
next;
mesn;
mesq l("All arenas stay open for only 30 minutes after being purchased.");
}
}
close;
L_Quit:
close;
L_Incomplete:
mesn;
mesq lg("Hello darling.");
next;
mesq l("I am @@, and I take care of the Arena.", .name$);
next;
mesq l("At the moment, we must wait authorization from Tulimshar's government to re-open doors.");
close;
OnInit:
.@npcId = getnpcid(0, .name$);
setunitdata(.@npcId, UDT_HEADTOP, 2907);
setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
setunitdata(.@npcId, UDT_WEAPON, 3509);
setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
.sex = G_FEMALE;
.distance = 5;
//.alwaysVisible = true; // This is dumb, why Jesusalva put it here?
.price=1000;
// create hashtable
$@ARENAS = htnew();
end;
OnInstanceInit:
.@npcId = getnpcid(0, instance_npcname(.name$));
setunitdata(.@npcId, UDT_HEADTOP, 2907);
setunitdata(.@npcId, UDT_HEADMIDDLE, 1305);
setunitdata(.@npcId, UDT_HEADBOTTOM, 2204);
setunitdata(.@npcId, UDT_WEAPON, 3509);
setunitdata(.@npcId, UDT_HAIRSTYLE, 14);
setunitdata(.@npcId, UDT_HAIRCOLOR, 18);
end;
}
/*
mes (@menu-1);
.@ARENA_INSTID = instance_create("003-13@arenax"+(@menu), 0, IOT_NONE);
if (.@ARENA_INSTID >= 0)
{
mes "new instance id: " + str(.@ARENA_INSTID);
.@instanceMapName$ = instance_attachmap("003-13", .@ARENA_INSTID, 0, "003-13@a" + (@menu-1));
if (.@instanceMapName$ == "")
{
mes "Error: instance attach map error";
} else {
mes "Attached instance map name: " + .@instanceMapName$;
instance_set_timeout(1000000, 1000000, .@ARENA_INSTID);
instance_init(.@ARENA_INSTID);
set Zeny, Zeny-1000;
$@ARENA_INSTANCES[@menu-1]=getcharid(3);
}
} else {
mes l("An error happened.");
}
}
menu
rif($@ARENA_INSTANCES[0] > 0, l("Arena 1")), -,
rif($@ARENA_INSTANCES[1] > 0, l("Arena 2")), -,
rif($@ARENA_INSTANCES[2] > 0, l("Arena 3")), -,
rif($@ARENA_INSTANCES[3] > 0, l("Arena 4")), -,
rif($@ARENA_INSTANCES[4] > 0, l("Arena 5")), -,
l("Give Up"), L_Quit;
warp "003-13@a"+(@menu-1), 31,31;
set Zeny, Zeny-.price;
//instance_warpall("003-13@a"+@menu, 30, 31); // Only use while in instance
*/