summaryrefslogtreecommitdiff
path: root/npc/003-5/arnea.txt
blob: 7797360bbc5c355836190248349e2570b94a3e59 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// 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;

}