From daa2aa38b085b51281c9d2069e5e30cd29a5ef8b Mon Sep 17 00:00:00 2001 From: jesusalva Date: Mon, 12 Feb 2018 18:31:17 -0200 Subject: This Arnea is a little broken and doesn't works as I want. But well. --- npc/003-5/arnea.txt | 144 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 62 deletions(-) diff --git a/npc/003-5/arnea.txt b/npc/003-5/arnea.txt index 7797360bb..bec00ba4d 100644 --- a/npc/003-5/arnea.txt +++ b/npc/003-5/arnea.txt @@ -3,78 +3,95 @@ // 4144 // Jesusalva // Description: -// Arena for Duels and PVP (temporary map) +// Arena for Duels and PVP (003-13,31,31) 003-5,33,37,0 script Arnea NPC_ELF_F,{ - .@ARENA_INSTID=has_instance2("003-5@" + getcharid(3)); mesn; mesq l("Welcome to the Arena. Select your action"); - switch (select("create", "warp", "info", "warp back", "delete", "back")) - { - case 1: - if (.@ARENA_INSTID >= 0) - { - mes "Error: either already in instance, or not authorized."; - break; - } - .@ARENA_INSTID = instance_create("003-5@instance", getcharid(3), IOT_CHAR); - if (.@ARENA_INSTID < 0) - { - mes "Error: creating instance"; - break; - } + 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($@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; + + 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-5", .@ARENA_INSTID, 0, "003-5@" + getcharid(3)); + .@instanceMapName$ = instance_attachmap("003-13", .@ARENA_INSTID, 0, "003-13@a" + (@menu-1)); if (.@instanceMapName$ == "") { mes "Error: instance attach map error"; - break; - } - mes "Attached instance map name: " + .@instanceMapName$; - instance_set_timeout(1000000, 1000000, .@ARENA_INSTID); - instance_init(.@ARENA_INSTID); - break; - case 2: - warp "003-5@" + getcharid(3), 30, 31; - break; - case 3: - 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); - mes "instance id: " + .@ARENA_INSTID; - if (instance_id() >= 0) - { - mes "npc1 in instance named: " + instance_npcname("npc1"); - .@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); - } - else - { - mes "npc1 not in instance"; + } 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); } - break; - case 4: - warp "003-5", 30, 31; - break; - case 5: - if (.@ARENA_INSTID < 0) - { - mes "Error: 003-5 instance was not created"; - break; - } - instance_destroy(.@ARENA_INSTID); - break; - case 6: - break; + } else { + mes l("An error happened."); + } } + 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; + if (Zeny < .price) { + mesq l("You need @@ GP to use this arena.", .price); + } else { + mesq l("Okay, which arena will you join? Cost is @@ GP.", .price); + //menu + // rif(has_instance2("003-5@0") >= 0, l("Arena 1")), -, + // rif(has_instance2("003-5@1") >= 0, l("Arena 2")), -, + // rif(has_instance2("003-5@2") >= 0, l("Arena 3")), -, + // rif(has_instance2("003-5@3") >= 0, l("Arena 4")), -, + // rif(has_instance2("003-5@4") >= 0, l("Arena 5")), -, + // l("Give Up"), L_Quit; + 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 + } + close; + + +L_Quit: close; OnInit: @@ -89,7 +106,10 @@ OnInit: .sex = G_FEMALE; .distance = 5; .alwaysVisible = true; + .price=1000; // test instance id + setarray $@ARENA_INSTANCES, -1,-1,-1,-1,-1; // Controls Owners + setarray $@ARENA_INFOS$, "","","","",""; // Controls Owners end; OnInstanceInit: -- cgit v1.2.3-60-g2f50