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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
// TMW2 Script
// Author: Jesusalva
// Location Config
- script loc_config 32767,{
end;
OnInit:
// TP_FORT TP_BOSSR
setarray $@LOCMASTER_TP, TP_CANDOR,TP_TULIM,TP_HURNS,TP_NIVAL;
setarray $@LOCMASTER_LOC$, "Candor", "Tulim", "Hurns", "Nival";
setarray $@LOCMASTER_MAP$, "029-1", "001-1", "009-1", "020-1";
setarray $@LOCMASTER_X, 46, 51, 52, 75;
setarray $@LOCMASTER_Y, 97, 78, 41, 85;
//debugmes "Locmaster: Index 0: %s [%s.gat (%d, %d)]", $@LOCMASTER_LOC$[0], $@LOCMASTER_MAP$[0], $@LOCMASTER_X[0], $@LOCMASTER_Y[0];
//debugmes "Locmaster: Index 2: %s [%s.gat (%d, %d)]", $@LOCMASTER_LOC$[2], $@LOCMASTER_MAP$[2], $@LOCMASTER_X[2], $@LOCMASTER_Y[2];
//debugmes "Locmaster: Index 5: %s [%s.gat (%d, %d)]", $@LOCMASTER_LOC$[5], $@LOCMASTER_MAP$[5], $@LOCMASTER_X[5], $@LOCMASTER_Y[5];
end;
}
// Resaves your respawn point
function script ResaveRespawn {
.@i=array_find($@LOCMASTER_LOC$, LOCATION$);
savepoint $@LOCMASTER_MAP$[.@i], $@LOCMASTER_X[.@i], $@LOCMASTER_Y[.@i];
return;
}
// Warps you to last visited town
function script ReturnTown {
.@i=array_find($@LOCMASTER_LOC$, LOCATION$);
warp $@LOCMASTER_MAP$[.@i], $@LOCMASTER_X[.@i], $@LOCMASTER_Y[.@i];
return;
}
// Convert map name to location id
// LocToMap( LocName )
function script LocToMap {
// Fill variable
.@v$=getarg(0);
// Error code
if (playerattached())
.@err=RB_DEFAULT;
else
.@err=RB_DEBUGMES;
// Validade variable, see npc/config/location.txt first
.@lx=array_find($@LOCMASTER_LOC$, .@v$);
if (.@lx < 0)
return Exception("Invalid location passed to LocToMap: "+.@v$, .@err);
return $@LOCMASTER_MAP$[.@lx];
}
// Convert map name to location id
// MapToLoc( MapName )
function script MapToLoc {
// Fill variable
.@v$=getarg(0);
// Error code
if (playerattached())
.@err=RB_DEFAULT;
else
.@err=RB_DEBUGMES;
// Validade variable, see npc/config/location.txt first
.@lx=array_find($@LOCMASTER_MAP$, .@v$);
if (.@lx < 0)
return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err);
return $@LOCMASTER_LOC$[.@lx];
}
// Gets the location code for TP code
function script TPToLoc {
.@i=array_find($@LOCMASTER_TP, getarg(0));
return $@LOCMASTER_MAP$[.@i];
return;
}
// Convert LOC (uppercase) to a TP variable
// POL_LocToTP( {TOWNCODE} )
function script POL_LocToTP {
.@tw$=strtoupper(getarg(0, LOCATION$));
// TODO: Change this to use the arrays instead
if (.@tw$ == "TULIM")
return TP_TULIM;
if (.@tw$ == "HURNS")
return TP_HURNS;
if (.@tw$ == "NIVAL")
return TP_NIVAL;
if (.@tw$ == "CANDOR")
return TP_CANDOR;
return Exception("Invalid town requested / POL_LocToTP", RB_DEFAULT|RB_SPEECH, -1);
}
// Upon entering a town
// EnterTown( LocName )
function script EnterTown {
// Fill variable
.@v$=getarg(0);
// Validade variable, see npc/config/location.txt first
if (array_find($@LOCMASTER_LOC$, .@v$) < 0)
return Exception("Invalid location passed to EnterTown: "+.@v$);
LOCATION$=.@v$;
return;
}
// Warps home and updates LOCATION$
function script teleporthome {
warp "Save", 0, 0;
.@i=array_find($@LOCMASTER_MAP$, getmap());
if (.@i >= 0)
EnterTown($@LOCMASTER_LOC$[.@i]);
else
debugmes("[ERROR] Invalid Town Map for Time Flask: %s", getmap());
return;
}
|