summaryrefslogblamecommitdiff
path: root/npc/003-5/arnea.txt
blob: 7797360bbc5c355836190248349e2570b94a3e59 (plain) (tree)








































































































                                                                                                         
// TMW2 Scripts
// Author:
//    4144
//    Jesusalva
// Description:
//    Arena for Duels and PVP (temporary map)

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;
            }
            mes "new instance id: " + str(.@ARENA_INSTID);
            .@instanceMapName$ = instance_attachmap("003-5", .@ARENA_INSTID, 0, "003-5@" + getcharid(3));
            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";
            }
            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;
    }
    close;

OnInit:
    .@npcId = getnpcid(0, "Arnea");
    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;
    // test instance id
    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;

}