1 | //===== Athena Doc ======================================== |
---|
2 | //= eAthena Script Commands |
---|
3 | //===== Description ======================================= |
---|
4 | //= A reference manual for the eAthena scripting language. |
---|
5 | //= Commands are sorted depending on their functionality. |
---|
6 | //===== Version =========================================== |
---|
7 | //= 3.22.20080622 |
---|
8 | //========================================================= |
---|
9 | //= 1.0 - First release, filled will as much info as I could |
---|
10 | //= remember or figure out, most likely there are errors, |
---|
11 | //= and things I have missed out [Fredzilla] |
---|
12 | //= 1.1 - Added better discription for "getmapxy" (by Terminal Vertex & Z3R0) |
---|
13 | //= 1.2b- Added a description for getpartymember (by HappyDenn) |
---|
14 | //= (+few spelling mistakes corrected) |
---|
15 | //= 2.0 - +79kb extra stuff and numerous corrections by |
---|
16 | //= Maeki Rika. |
---|
17 | //= 2.1 - Small but important corrections, more proofreading. |
---|
18 | //= Some important discoveries in item functions, the |
---|
19 | //= secret of making VVS weapons with 'getitem2' and |
---|
20 | //= other news. (Rika again) +10kb :) |
---|
21 | //= 2.2 - added getItemInfo description [Lupus] |
---|
22 | //= 2.3 - added plenty of info for recent (and not so) script commands I added |
---|
23 | //= [Skotlex] |
---|
24 | //= 2.4 - Explained the upper parameter of jobchange. [Skotlex] |
---|
25 | //= 2.5 - Added pow, sqrt and distance. [Lance] |
---|
26 | //= 2.6 - Added setd and getd. [Lance] |
---|
27 | //= 2.7 - petstat command. [Lance] |
---|
28 | //= 2.7a- delitem2, countitems2 commands [Lupus] |
---|
29 | //= 2.7b- clone command [Skotlex] |
---|
30 | //= 2.7c- disguise / undisguise, query_sql commands [Lupus] |
---|
31 | //= 2.8 - Deleted a copy of the nude command. Added axtoi command (needing a |
---|
32 | //= clearer explanation of atoi.Gave a better explanation of OnLabels |
---|
33 | //= and modified monster explanation due that L_Label isn't working with |
---|
34 | //= monster. |
---|
35 | //= 2.9.20061230 - Updated getitem and guardian. [FlavioJS] |
---|
36 | //= 2.10.20070101 - added sleep,sleep2,awake and updated the variables section. |
---|
37 | //= [FlavioJS] |
---|
38 | //= 2.11.20070109 - removed the unused flag argument in guildskill, added an |
---|
39 | //= optional argument to setcart,setfalcon,setriding and other cleanups |
---|
40 | //= [FlavioJS] |
---|
41 | //= 2.12.20070201 - Added npcshopitem, npcshopadditem, npcshopdelitem and |
---|
42 | //= npcshopattach [Skotlex] |
---|
43 | //= 3.00.20070208 |
---|
44 | //= - Explained Logical Bitwise Operators. |
---|
45 | //= Dj-Yhn contributed to AND (&) operator, rest by myself. [erKURITA] |
---|
46 | //= - Added a resume of allowed variable and arrays scopes. [erKURITA] |
---|
47 | //= - Re-organized the script commands, and grouped them depending |
---|
48 | //= on what they do. [erKURITA] |
---|
49 | //= - Added a packload of commands that were missing, |
---|
50 | //= and corrected some of the wrong ones [Dj-Yhn, erKURITA & Trancid] |
---|
51 | //= 3.01.20070209 |
---|
52 | //= Updated 'cutin' (removed lies, removed outdated bmp list) [ultramage] |
---|
53 | //= Removed 'cutincard' since eA no longer implements it |
---|
54 | //= 3.02.20070209 |
---|
55 | //= Corrected/updated info on Xor/setd/getd/callfunc/callsub/return and |
---|
56 | //= updated some examples to use "better" code. [FlavioJS] |
---|
57 | //= 3.03.20070216 |
---|
58 | //= Expanded/clarified information on npc timers, added info about the |
---|
59 | //= new attach flag for script commands startnpctimer/ stopnpctimer/ |
---|
60 | //= initnpctimer [Skotlex] |
---|
61 | //= 3.03.20070226 |
---|
62 | //= Updated makeitem and how to include " in strings [Lupus] |
---|
63 | //= 3.03.20070228 |
---|
64 | //= Added info on OnTimerQuit label to npctimer section. [Skotlex] |
---|
65 | //= 3.04.20070317 |
---|
66 | //= Removed all .gat refferences from the examples [Lupus] |
---|
67 | //= 3.04.20070330 |
---|
68 | //= Adjusted the 'itemskill' description due to recent change [ultramage] |
---|
69 | //= 3.04.20070409 |
---|
70 | //= Fixed the incorrect order of parameters in 'makeitem' [ultramage] |
---|
71 | //= 3.05.20070423 |
---|
72 | //= menu/select/prompt produce consistent results for grouped and empty |
---|
73 | //= options [FlavioJS] |
---|
74 | //= 3.05.20070819 |
---|
75 | //= Removed the messy 'unitdeadsit' command reference [ultramage] |
---|
76 | //= 3.05.20070823 |
---|
77 | //= Fixed typo in 'areamonster' description (missing argument) [ultramage] |
---|
78 | //= 3.06 20070909 |
---|
79 | //= Added 'gethominfo' description [Skotlex] |
---|
80 | //= 3.06.20070910 |
---|
81 | //= Added info about the new behavior of 'getexp' [ultramage] |
---|
82 | //= 3.07.20070915 |
---|
83 | //= Fixed 'duplicate' missing the target 'name' parameter! [ultramage] |
---|
84 | //= 3.08.20071018 |
---|
85 | //= Clarified how npc names work. [FlavioJS] |
---|
86 | //= 3.09.20071103 |
---|
87 | //= Added script function 'strnpcinfo' [ultramage] |
---|
88 | //= 3.10.20071122 |
---|
89 | //= Added setnpcdisplay. [FlavioJS] |
---|
90 | //= 3.10.20071211 |
---|
91 | //= Added query_logsql. [Skotlex] |
---|
92 | //= 3.11.20071215 |
---|
93 | //= Updated guardianinfo and get-/setcastledata [ultramage] |
---|
94 | //= 3.12.20071218 |
---|
95 | //= Corrected various mistakes mentioned in bugreport:373 [ultramage] |
---|
96 | //= 3.12.20071227 |
---|
97 | //= Corrected description of scope and npc variables. [FlavioJS] |
---|
98 | //= 3.13.20080104 |
---|
99 | //= Updated 'setcell' desc to match latest code changes [ultramage] |
---|
100 | //= 3.14.20080211 |
---|
101 | //= Updated 'input' (new arguments and return value). [FlavioJS] |
---|
102 | //= 3.15.20080227 |
---|
103 | //= Updated 'checkweight' description slightly. [L0ne_W0lf] |
---|
104 | //= 3.16.20080229 |
---|
105 | //= Updated 'Shop' NPC type description to include cashshop. [L0ne_W0lf] |
---|
106 | //= Woopth. Fixed spelling. ;P Should be a bit clearer now. [L0ne_W0lf] |
---|
107 | //= 3.17.20080312 |
---|
108 | //= Corrected cashshop description. (#FREEPOINTS->#KAFRAPOINTS) [L0ne_W0lf] |
---|
109 | //= 3.18.20080327 |
---|
110 | //= Added documentation for the 'checkcell' command [ultramage] |
---|
111 | //= 3.19.20080407 |
---|
112 | //= Extended the behaviour of 'guardian'. [FlavioJS] |
---|
113 | //= 3.20.20080425 |
---|
114 | //= Corrected 'getitem', 'getitem2' & 'delitem2' (charid instead of accountid) [Toms] |
---|
115 | //= Modified 'delitem' (added optional accountid parameter) [Toms] |
---|
116 | //= 3.21.20080612 |
---|
117 | //= Script commands extended to support skill names: [FlavioJS] |
---|
118 | //= skill, addtoskill, guildskill, getskilllv, getgdskilllv, itemskill, |
---|
119 | //= petskillattack, petskillattack2, petskillsupport, skilleffect, npcskilleffect, |
---|
120 | //= unitskilluseid, unitskillusepos, bonus/bonus2/bonus3/bonus4/bonus5 |
---|
121 | //= 3.22.20080622 |
---|
122 | //= Extended 'set' to return the variable reference. [FlavioJS] |
---|
123 | //========================================================= |
---|
124 | |
---|
125 | This document is a reference manual for all the scripting commands and functions |
---|
126 | available in current eAthena SVN. It is not a simple tutorial. When people tell |
---|
127 | you to "Read The F***ing Manual", they mean this. |
---|
128 | |
---|
129 | The information was mostly acquired through looking up how things actually work |
---|
130 | in the source code of the server, which was written by many people over time, |
---|
131 | and lots of them don't speak English and never left any notes - or are otherwise |
---|
132 | not available for comments. As such, anything written in here might not be |
---|
133 | correct, it is only correct to the best of our knowledge, which is limited. |
---|
134 | |
---|
135 | This is not a place to teach you basic programming. This document will not teach |
---|
136 | you basic programming by itself. It's more of a reference for those who have at |
---|
137 | least a vague idea of what they want to do and want to know what tools they have |
---|
138 | available to do it. We've tried to keep it as simple as feasible, but if you |
---|
139 | don't understand it, getting a clear book on programming in general will help |
---|
140 | better than yelling around the forum for help. |
---|
141 | |
---|
142 | A little learning never caused anyone's head to explode. |
---|
143 | |
---|
144 | Structure |
---|
145 | --------- |
---|
146 | |
---|
147 | The commands and functions are listed in no particular order: |
---|
148 | |
---|
149 | *Name of the command and how to call it. |
---|
150 | |
---|
151 | Descriptive text |
---|
152 | |
---|
153 | Small example if possible. Will usually be incomplete, it's there just to |
---|
154 | give you an idea of how it works in practice. |
---|
155 | |
---|
156 | To find a specific command, use Ctrl+F, (or whatever keys call up a search |
---|
157 | function in whatever you're reading this with) put an * followed by the command |
---|
158 | name, and it should find the command description for you. |
---|
159 | |
---|
160 | If you find anything omitted, please respond. :) |
---|
161 | |
---|
162 | Syntax |
---|
163 | ------ |
---|
164 | |
---|
165 | Throughout this document, wherever a command wants an argument, it is given in |
---|
166 | <angle brackets>. This doesn't mean you should type the angle brackets. :) If an |
---|
167 | argument of a command is optional, it is given in {curly brackets}. You've |
---|
168 | doubtlessly seen this convention somewhere, if you didn't, get used to it, |
---|
169 | that's how big boys do it. If a command can optionally take an unspecified |
---|
170 | number of arguments, you'll see a list like this: |
---|
171 | |
---|
172 | command <argument>{,<argument>...<argument>} |
---|
173 | |
---|
174 | This still means they will want to be separated by commas. |
---|
175 | |
---|
176 | Where a command wants a string, it will be given in "quotes", if it's a number, |
---|
177 | it will be given without them. Normally, you can put an expression, like a bunch |
---|
178 | of functions or operators returning a value, in (round brackets) instead of most |
---|
179 | numbers. Round brackets will not always be required, but they're often a good |
---|
180 | idea. |
---|
181 | |
---|
182 | Wherever you refer to a map name, it's always 'mapname' or 'mapname.gat' |
---|
183 | (Please, don't use .gat suffix anymore. It's useless.) |
---|
184 | |
---|
185 | |
---|
186 | Script loading structure |
---|
187 | ------------------------ |
---|
188 | |
---|
189 | Scripts are loaded by the map server as referenced in the 'conf/map_athena.conf' |
---|
190 | configuration file, but in the default configuration, it doesn't load any script |
---|
191 | files itself. Instead, it loads the file 'npc/scripts_main.conf' which itself |
---|
192 | contains references to other files. The actual scripts are loaded from txt |
---|
193 | files, which are linked up like this: |
---|
194 | |
---|
195 | npc: <path to a filename> |
---|
196 | |
---|
197 | Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the |
---|
198 | script contained in this file, which will make the script available. No file |
---|
199 | will get loaded twice, to prevent possible errors. |
---|
200 | |
---|
201 | Another configuration file option of relevance is: |
---|
202 | |
---|
203 | delnpc: <path to a filename> |
---|
204 | |
---|
205 | This will unload a specifiled script filename from memory, which, while |
---|
206 | seemingly useless, may sometimes be required. |
---|
207 | |
---|
208 | Whenever '//' is encountered in a line upon reading, everything beyond this on |
---|
209 | that line is considered to be a comment and is ignored. This works wherever you |
---|
210 | place it. |
---|
211 | |
---|
212 | Upon loading all the files, the server will execute all the top-level commands |
---|
213 | in them. No variables exist yet at this point, no commands can be called other |
---|
214 | than those given in this section. These commands set up the basic server script |
---|
215 | structure - create NPC objects, spawn monster objects, set map flags, etc. No |
---|
216 | code is actually executed at this point except them. The top-level commands the |
---|
217 | scripting are pretty confusing, since they aren't structured like you would |
---|
218 | expect commands, command name first, but rather, normally start with a map name. |
---|
219 | |
---|
220 | What's more confusing about the top-level commands is that most of them use a |
---|
221 | tab symbol to divide their arguments. |
---|
222 | |
---|
223 | To prevent problems and confusion, the tab symbols are written as '%TAB%' |
---|
224 | throughout this document, even though this makes the text a bit less readable. |
---|
225 | Using an invisible symbol to denote arguments is one of the bad things about |
---|
226 | this language, but we're stuck with it for now. :) |
---|
227 | |
---|
228 | Here is a list of valid top-level commands: |
---|
229 | |
---|
230 | ** Set a map flag: |
---|
231 | |
---|
232 | <map name>%TAB%mapflag%TAB%<flag> |
---|
233 | |
---|
234 | This will, upon loading, set a specified map flag on a map you like. These are |
---|
235 | normally in files inside 'conf/mapflag' and are loaded first, so by the time the |
---|
236 | server's up, all the maps have the flags they should have. Map flags determine |
---|
237 | the behavior of the map regarding various common problems, for a better |
---|
238 | explanation, see 'setmapflag'. |
---|
239 | |
---|
240 | ** Create a permanent monster spawn: |
---|
241 | |
---|
242 | <map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event> |
---|
243 | |
---|
244 | Map name is the name of the map the monsters will spawn on. x,y are the |
---|
245 | coordinates where the mob should spawn. If xs and ys are non-zero, they |
---|
246 | specify the diameters of a spawn-rectangle area who's center is x,y. |
---|
247 | Putting zeros instead of these coordinates will spawn the monsters randomly. |
---|
248 | Note this is only the initial spawn zone, as mobs random-walk, they are free |
---|
249 | to move away from their specified spawn region. |
---|
250 | |
---|
251 | Monster name is the name the monsters will have on screen, and has no relation |
---|
252 | whatsoever to their names anywhere else. It's the mob id that counts, which |
---|
253 | identifies monster record in 'mob_db.txt' database of monsters. If the mob name |
---|
254 | is given as "--ja--", the 'japanese name' field from the monster database is |
---|
255 | used, (which, in eAthena, actually contains an english name) if it's "--en--", |
---|
256 | it's the 'english name' from the monster database (which contains an uppercase |
---|
257 | name used to summon the monster with a GM command). |
---|
258 | |
---|
259 | If you add 20000 to the monster ID, the monster will be spawned in a 'big |
---|
260 | version', (monster size class will increase) and if you add 10000, the 'tiny |
---|
261 | version' of the monster will be created. However, this method is deprecated |
---|
262 | and not recommended, as the values to add can change at a later time (20000 |
---|
263 | and 10000 actually stand for 2*MAX_MOB_DB and MAX_MOB_DB respectively, which |
---|
264 | is defined on mob.h, and can change in the future as more mobs are created). |
---|
265 | The recommended way to change a mob's size is to use the event-field (see |
---|
266 | below). |
---|
267 | |
---|
268 | Amount is the amount of monsters that will be spawned when this command is |
---|
269 | executed, it is affected by spawn rates in 'battle_athena.conf'. |
---|
270 | |
---|
271 | Delay1 and delay2 are the monster respawn delays - the first one counts the time |
---|
272 | since a monster defined in this spawn was last respawned and the second one |
---|
273 | counts the time since the monster of this spawn was last killed. Whichever turns |
---|
274 | out to be higher will be used. If the resulting number is smaller than a random |
---|
275 | value between 5 and 10 seconds, this value will be used instead. (Which is |
---|
276 | normally the case if both delay values are zero.) The times are given in |
---|
277 | 1/1000ths of a second. |
---|
278 | |
---|
279 | You can specify a custom level to use for the mob different from the one of |
---|
280 | the database by adjoining the level after the name with a comma. eg: |
---|
281 | "Poring,50" for a name will spawn a monster with name Poring and level 50. |
---|
282 | |
---|
283 | Event is a script event to be executed when the mob is killed. The event must |
---|
284 | be in the form "NPCName::OnEventName" to execute, and the event name label |
---|
285 | should start with "On". As with all events, if the NPC is an on-touch npc, the |
---|
286 | player who triggers the script must be within 'trigger' range for the event to |
---|
287 | work. |
---|
288 | |
---|
289 | The Event field can be used alternatively to specify other mob properties. Use |
---|
290 | 2 to specify that the mob should be small, 4 for big monsters, and 8 for |
---|
291 | special ai mobs (which by default attack other monsters instead of players). |
---|
292 | You can add these, so using 10 will spawn small monsters that attack other |
---|
293 | mobs (if you specify both 2 and 4, the small version takes priority). |
---|
294 | |
---|
295 | ** Npc names |
---|
296 | |
---|
297 | /!\ WARNING: this applies to warps, npcs, duplicates and shops /!\ |
---|
298 | |
---|
299 | Npc names are kinda special and are formatted this way: |
---|
300 | |
---|
301 | <Display name>{::<Unique name>} |
---|
302 | |
---|
303 | All npcs need to have a unique name that is used for identification purposes. |
---|
304 | When you have to identify a npc by it's name, you should use <Unique name>. |
---|
305 | If <Unique name> is not provided, use <Display name> instead. |
---|
306 | |
---|
307 | The client has a special feature when displaying names: |
---|
308 | if the display name contains a '#' character, it hides that part of the name. |
---|
309 | ex: if your npc is named 'Hunter#hunter1', it will be displayed as 'Hunter' |
---|
310 | |
---|
311 | <Display name> must be at most 24 characters in length. |
---|
312 | <Unique name> must be at most 24 characters in length. |
---|
313 | |
---|
314 | ** Define a warp point |
---|
315 | |
---|
316 | <from map name>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY> |
---|
317 | |
---|
318 | This will define a warp NPC that will warp a player between maps, and while most |
---|
319 | arguments of that are obvious, some deserve special mention. |
---|
320 | |
---|
321 | SpanX and SpanY will make the warp sensitive to a character who didn't step |
---|
322 | directly on it, but walked into a zone which is centered on the warp from |
---|
323 | coordinates and is SpanX in each direction across the X axis and SpanY in each |
---|
324 | direction across the Y axis. |
---|
325 | |
---|
326 | Warp NPC objects also have a name, because you can use it to refer to them later |
---|
327 | with 'enablenpc'/'disablenpc' |
---|
328 | |
---|
329 | Facing of a warp object is irrelevant, it is not used in the code and all |
---|
330 | current scripts have a zero in there. |
---|
331 | |
---|
332 | ** Define an NPC object. |
---|
333 | |
---|
334 | <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>} |
---|
335 | <map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>} |
---|
336 | |
---|
337 | This will place an NPC object on a specified map at the specified location, and |
---|
338 | is a top-level command you will use the most in your custom scripting. The NPCs |
---|
339 | are triggered by clicking on them, and/or by walking in their trigger area, if |
---|
340 | defined, see that below. |
---|
341 | |
---|
342 | Facing is a direction the NPC sprite will face in. Not all NPC sprites have |
---|
343 | different images depending on the direction you look from, so for some facing |
---|
344 | will be meaningless. Facings are counted counterclockwise in increments of 45 |
---|
345 | degrees, where 0 means facing towards the top of the map. (So to turn the sprite |
---|
346 | towards the bottom of the map, you use facing 4, and to make it look southeast |
---|
347 | it's facing 5.) |
---|
348 | |
---|
349 | Sprite id is the sprite number used to display this particular NPC. For a full |
---|
350 | list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml You may |
---|
351 | also use a monster's ID number instead to display a monster sprite for this NPC. |
---|
352 | It is possible to use a job sprite as well, but you must first define it as a |
---|
353 | monster sprite in 'mob_avail.txt', a full description on how to do this is not |
---|
354 | in the scope of this manual. |
---|
355 | A '-1' sprite id will make the NPC invisible (and unclickable). |
---|
356 | A '111' sprite id will make an NPC which does not have a sprite, but is still |
---|
357 | clickable, which is useful if you want to make a clickable object of the 3D |
---|
358 | terrain. |
---|
359 | |
---|
360 | TriggerX and triggerY, if given, will define an area, centered on NPC and |
---|
361 | spanning triggerX cells in every direction across X and triggerY in every |
---|
362 | direction across Y. Walking into that area will trigger the NPC. If no |
---|
363 | 'OnTouch:' special label is present in the NPC code, the execution will start |
---|
364 | from the beginning of the script, otherwise, it will start from the 'OnTouch:' |
---|
365 | label. |
---|
366 | |
---|
367 | The code part is the script code that will execute whenever the NPC is |
---|
368 | triggered. It may contain commands and function calls, descriptions of which |
---|
369 | compose most of this document. It has to be in curly brackets, unlike elsewhere |
---|
370 | where we use curly brackets, these do NOT signify an optional parameter. |
---|
371 | |
---|
372 | ** Define an NPC duplicate. |
---|
373 | |
---|
374 | <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<name>%TAB%<sprite id> |
---|
375 | <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<name>%TAB%<sprite id>,<triggerX>,<triggerY> |
---|
376 | |
---|
377 | This will duplicate an NPC referred to by 'label'. The duplicate runs the same |
---|
378 | code as the source NPC, but has its own name, location, facing, sprite ID and |
---|
379 | trigger area (in other words, the duplicate does not 'inherit' any of these). |
---|
380 | |
---|
381 | ** Define a 'floating' NPC object. |
---|
382 | |
---|
383 | -%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>} |
---|
384 | |
---|
385 | This will define an NPC object not triggerable by normal means. This would |
---|
386 | normally mean it's pointless since it can't do anything, but there are |
---|
387 | exceptions, mostly related to running scripts at specified time, which is what |
---|
388 | these floating NPC objects are for. More on that below. |
---|
389 | |
---|
390 | ** Define a shop NPC. |
---|
391 | |
---|
392 | <map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...} |
---|
393 | |
---|
394 | This will define a shop NPC, which, when triggered (which can only be done by |
---|
395 | clicking) will cause a shop window to come up. No code whatsoever runs in shop |
---|
396 | NPCs and you can't change the prices otherwise than by editing the script |
---|
397 | itself. (No variables even exist at this point of scripting, so don't even |
---|
398 | bother trying to use them.) |
---|
399 | |
---|
400 | The item id is the number of item in the 'item_db.txt' database. If Price is set |
---|
401 | to -1, the 'buy price' given in the item database will be used. Otherwise, the |
---|
402 | price you gave will be used for this item, which is how you create differing |
---|
403 | prices for items in different shops. |
---|
404 | |
---|
405 | Since trunk r12264 you can alternatively use "cashshop" in place of "shop" |
---|
406 | to use the Cash Shop interface, allowing you to buy items with special points |
---|
407 | (Currently stored as account vars in global_reg #CASHPOINTS and #KAFRAPOINTS.) |
---|
408 | This type of shop will not allow you to sell items at it, you may only |
---|
409 | purchase items here. The layout used to define sale items still count, and |
---|
410 | "<price>" refers to how many points will be spent purchasing the them. |
---|
411 | |
---|
412 | ** Define a function object |
---|
413 | |
---|
414 | function%TAB%script%TAB%<function name>%TAB%{<code>} |
---|
415 | |
---|
416 | This will define a function object, callable with the 'callfunc' command (see |
---|
417 | below). This object will load on every map server separately, so you can get at |
---|
418 | it from anywhere. It's not possible to call the code in this object by |
---|
419 | anything other than the 'callfunc' script command. |
---|
420 | |
---|
421 | The code part is the script code that will execute whenever the function is |
---|
422 | called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where |
---|
423 | we use curly brackets, these do NOT signify an optional parameter. |
---|
424 | |
---|
425 | |
---|
426 | Once an object is defined which has a 'code' field to it's definition, it |
---|
427 | contains script commands which can actually be triggered and executed. |
---|
428 | |
---|
429 | ~ RID? GID? ~ |
---|
430 | |
---|
431 | What a RID is and why do you need to know |
---|
432 | ----------------------------------------- |
---|
433 | |
---|
434 | Most scripting commands and functions will want to request data about a |
---|
435 | character, store variables referenced to that character, send stuff to the |
---|
436 | client connected to that specific character. Whenever a script is invoked by a |
---|
437 | character, it is passed a so-called RID - this is the character ID number of a |
---|
438 | character that caused the code to execute by clicking on it, walking into it's |
---|
439 | OnTouch zone, or otherwise. |
---|
440 | |
---|
441 | If you are only writing common NPCs, you don't need to bother with it. However, |
---|
442 | if you use functions, if you use timers, if you use clock-based script |
---|
443 | activation, you need to be aware of all cases when a script execution can be |
---|
444 | triggered without a RID attached. This will make a lot of commands and functions |
---|
445 | unusable, since they want data from a specific character, want to send stuff to |
---|
446 | a specific client, want to store variables specific to that character, and they |
---|
447 | would not know what character to work on if there's no RID. |
---|
448 | |
---|
449 | Unless you use 'attachrid' to explicitly attach a character to the script first. |
---|
450 | |
---|
451 | Whenever we say 'invoking character', we mean 'the character who's RID is |
---|
452 | attached to the running script. The script function "playerattached" can be |
---|
453 | used to check which is the currently attached player to the script (it will |
---|
454 | return 0 if the there is no player attached or the attached player no longer |
---|
455 | is logged on to the map-server). |
---|
456 | |
---|
457 | But what about GID? |
---|
458 | --- ---- ----- ---- |
---|
459 | |
---|
460 | GID stands for the Game ID of something, this can either be the GID obtained |
---|
461 | through mobspawn (mob control commands) or the account ID of a character. |
---|
462 | Another way would be to right click on a mob, |
---|
463 | NPC or char as GM sprited char to view the GID. |
---|
464 | |
---|
465 | This is mostly used for the new version of skill and the mob control commmands |
---|
466 | implemented (but NEVER documented by Lance. Shame on you...). |
---|
467 | |
---|
468 | Item and pet scripts |
---|
469 | -------------------- |
---|
470 | |
---|
471 | Each item in the item database has two special fields - EquipScript and |
---|
472 | UseScript. The first is script code run every time a character equips the item, |
---|
473 | with the RID of the equipping character. Every time they unequip an item, all |
---|
474 | temporary bonuses given by the script commands are cleared, and all the scripts |
---|
475 | are executed once again to rebuild them. This also happens in several other |
---|
476 | situations (like upon login) but the full list is currently unknown. |
---|
477 | |
---|
478 | UseScript is a piece of script code run whenever the item is used by a character |
---|
479 | by doubleclicking on it. |
---|
480 | |
---|
481 | Not all script commands work properly in the item scripts. Where commands and |
---|
482 | functions are known to be meant specifically for use in item scripts, they are |
---|
483 | described as such. |
---|
484 | |
---|
485 | Every pet in the pet database has a PetScript field, which determines pet |
---|
486 | behavior. It is invoked wherever a pet of the specified type is spawned. |
---|
487 | (hatched from an egg, or loaded from the char server when a character who had |
---|
488 | that pet following them connects) This may occur in some other situations as |
---|
489 | well. Don't expect anything other than commands definitely marked as usable in |
---|
490 | pet scripts to work in there reliably. |
---|
491 | |
---|
492 | Numbers |
---|
493 | ------- |
---|
494 | |
---|
495 | Beside the common decimal numbers, which are nothing special whatsoever (though |
---|
496 | do not expect to use fractions, since ALL numbers are integer in this language), |
---|
497 | the script engine also handles hexadecimal numbers, which are otherwise |
---|
498 | identical. Writing a number like '0x<hex digits>' will make it recognised as a |
---|
499 | hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try |
---|
500 | to 'mes 0x10' it will print '16'. |
---|
501 | |
---|
502 | This is not used much, but it pays to know about it. |
---|
503 | |
---|
504 | Variables |
---|
505 | --------- |
---|
506 | |
---|
507 | The meat of every programming language is variables - places where you store |
---|
508 | data. |
---|
509 | |
---|
510 | Variables are divided into and uniquely identified by the combination of: |
---|
511 | prefix - determines the scope and extent (or lifetime) of the variable |
---|
512 | name - an identifier consisting of '_' and alfanumeric characters |
---|
513 | postfix - determines the type of the variable: integer or string |
---|
514 | |
---|
515 | Scope can be: |
---|
516 | global - global to all servers |
---|
517 | local - local to the server |
---|
518 | account - attached to the account of the character identified by RID |
---|
519 | character - attached to the character identified by RID |
---|
520 | npc - attached to the NPC |
---|
521 | scope - attached to the scope of the instance |
---|
522 | |
---|
523 | Extent can be: |
---|
524 | permanent - They still exist when the server resets. |
---|
525 | temporary - They cease to exist when the server resets. |
---|
526 | |
---|
527 | Prefix: scope and extent |
---|
528 | nothing - A permanent variable attached to the character, the default |
---|
529 | variable type. |
---|
530 | "@" - A temporary variable attached to the character. |
---|
531 | SVN versions before 2094 revision and RC5 version will also treat |
---|
532 | 'l' as a temporary variable prefix, so beware of having variable |
---|
533 | names starting with 'l' if you want full backward compatibility. |
---|
534 | "$" - A global permanent variable. |
---|
535 | They are stored in "save\mapreg.txt" or database table `mapreg`, |
---|
536 | depending on server type and the MAPREGSQL compilation flag. |
---|
537 | "$@" - A global temporary variable. |
---|
538 | This is important for scripts which are called with no RID |
---|
539 | attached, that is, not triggered by a specific character object. |
---|
540 | "." - A NPC variable. |
---|
541 | They exist in the NPC and dissapear when the server restarts or the |
---|
542 | npc is reloaded. Can be accessed from inside the NPC or by calling |
---|
543 | 'getvariableofnpc'. |
---|
544 | ".@" - A scope variable. |
---|
545 | They are unique to the instance and scope. Each instance has it's |
---|
546 | own scope that ends when the script ends. Calling a function with |
---|
547 | callsub/callfunc starts a new scope, returning from the function |
---|
548 | ends it. When a scope ends, it's variables are converted to values |
---|
549 | ('return .@var;' returns a value, not a reference). |
---|
550 | "#" - A permanent local account variable. |
---|
551 | They are stored with all the account data in "save\accreg.txt" in |
---|
552 | TXT versions and in the SQL versions in the 'global_reg_value' |
---|
553 | table using type 2. |
---|
554 | "##" - A permanent global account variable stored by the login server. |
---|
555 | They are stored in "save\account.txt" and in the SQL versions in the |
---|
556 | 'global_reg_value' table, using type 1. The only difference you will |
---|
557 | note from normal # variables is when you have multiple char-servers |
---|
558 | connected to the same login server. The # variables are unique to |
---|
559 | each char-server, while the ## variables are shared by all these |
---|
560 | char-servers. |
---|
561 | |
---|
562 | Postfix: integer or string |
---|
563 | nothing - integer variable, can store positive and negative numbers, but only |
---|
564 | whole numbers (so don't expect to do any fractional math) |
---|
565 | '$' - string variable, can store text |
---|
566 | |
---|
567 | Examples: |
---|
568 | name - permanent character integer variable |
---|
569 | name$ - permanent character string variable |
---|
570 | @name - temporary character integer variable |
---|
571 | @name$ - temporary character string variable |
---|
572 | $name - permanent global integer variable |
---|
573 | $name$ - permanent global string variable |
---|
574 | $@name - temporary global integer variable |
---|
575 | $@name$ - temporary global string variable |
---|
576 | .name - npc integer variable |
---|
577 | .name$ - npc string variable |
---|
578 | .@name - scope integer variable |
---|
579 | .@name$ - scope string variable |
---|
580 | #name - permanent local account integer variable |
---|
581 | #name$ - permanent local account string variable |
---|
582 | ##name - permanent global account integer variable |
---|
583 | ##name$ - permanent global account string variable |
---|
584 | |
---|
585 | If a variable was never set, it is considered to equal zero for integer |
---|
586 | variables or an empty string ("", nothing between the quotes) for string |
---|
587 | variables. Once you set it to that, the variable is as good as forgotten |
---|
588 | forever, and no trace remains of it even if it was stored with character or |
---|
589 | account data. |
---|
590 | |
---|
591 | Some variables are special, that is, they are already defined for you by the |
---|
592 | scripting engine. You can see the full list somewhere in 'db/const.txt', which |
---|
593 | is a file you should read, since it also allows you to replace lots of numbered |
---|
594 | arguments for many commands with easier to read text. The special variables most |
---|
595 | commonly used are all permanent character-based variables: |
---|
596 | |
---|
597 | StatusPoint - Amount of status points remaining. |
---|
598 | BaseLevel - Current base level |
---|
599 | SkillPoint - Amount of skill points remaining |
---|
600 | Class - Current job |
---|
601 | Upper - 1 if the character is an advanced job class. |
---|
602 | Zeny - Current amount of zeny |
---|
603 | Sex - Character's gender, 0 if female, 1 if male. |
---|
604 | Weight - The weight the character currently carries. |
---|
605 | MaxWeight - The maximum weight the character can carry. |
---|
606 | JobLevel - Character's job level |
---|
607 | BaseExp - The amount of base experience points the character has. |
---|
608 | Notice that it's zero (or close) if the character just got a level. |
---|
609 | JobExp - Same for job levels |
---|
610 | NextBaseExp - Amount of experience points needed to reach the next base level. |
---|
611 | NextJobExp - Same for job levels. |
---|
612 | Hp - Current amount of hit points. |
---|
613 | MaxHp - Maximum amount of hit points. |
---|
614 | Sp - Current spell points. |
---|
615 | MaxSp - Maximum amount of spell points. |
---|
616 | BaseJob - This is sneaky, apparently meant for baby class support. |
---|
617 | This will supposedly equal Job_Acolyte regardless of whether the |
---|
618 | character is an acolyte or a baby acolyte, for example. |
---|
619 | Karma - The character's karma. Karma system is not fully functional, but |
---|
620 | this doesn't mean this doesn't work at all. Not tested. |
---|
621 | Manner - The character's manner rating. Becomes negative if the player |
---|
622 | utters words forbidden through the use of 'manner.txt' client-side |
---|
623 | file. |
---|
624 | |
---|
625 | While these behave as variables, do not always expect to just set them - it is |
---|
626 | not certain whether this will work for all of them. Whenever there is a command |
---|
627 | or a function to set something, it's usually preferable to use that instead. The |
---|
628 | notable exception is Zeny, which you can and often will address directly - |
---|
629 | setting it will make the character own this number of zeny. |
---|
630 | |
---|
631 | Strings |
---|
632 | ------- |
---|
633 | |
---|
634 | To include symbol '"' in a string you should use prefix '\"' |
---|
635 | |
---|
636 | |
---|
637 | Arrays |
---|
638 | ------ |
---|
639 | |
---|
640 | Arrays (in eAthena at least) are essentially a set of variables going under the |
---|
641 | same name. You can tell between the specific variables of an array with an |
---|
642 | 'array index', a number of a variable in that array: |
---|
643 | |
---|
644 | <variable name>[<array index>] |
---|
645 | |
---|
646 | Variables stored in this way, inside an array, are also called 'array elements'. |
---|
647 | Arrays are specifically useful for storing a set of similar data (like several |
---|
648 | item IDs for example) and then looping through it. You can address any array |
---|
649 | variable as if it was a normal variable: |
---|
650 | |
---|
651 | set @arrayofnumbers[0],1; |
---|
652 | |
---|
653 | You can also do sneaky things like using a variable (or an expression, or even a |
---|
654 | value from an another array) to get at an array value: |
---|
655 | |
---|
656 | set @x,100; |
---|
657 | set @arrayofnumbers[@x],10; |
---|
658 | |
---|
659 | This will make @arrayofnumbers[100] equal to 10. |
---|
660 | |
---|
661 | Notice that index numbering always starts with 0. Arrays cannot hold more than |
---|
662 | 128 variables. (So the last one can't have a number higher than 127) |
---|
663 | |
---|
664 | And array indices probably can't be negative. Nobody tested what happens when |
---|
665 | you try to get a negatively numbered variable from an array, but it's not going |
---|
666 | to be pretty. :) |
---|
667 | |
---|
668 | Arrays can naturaly store strings: |
---|
669 | |
---|
670 | @menulines$[0] is the 0th element of the @menulines$ array of strings. Notice |
---|
671 | the '$', normally denoting a string variable, before the square brackets that |
---|
672 | denotes an array index. |
---|
673 | |
---|
674 | Resume of the allowed variable and array scopes |
---|
675 | ------ -- --- ------- -------- --- ----- ------ |
---|
676 | |
---|
677 | +==========+======+=======+ |
---|
678 | |VarType | Norm | Array | |
---|
679 | +==========+======+=======+ |
---|
680 | |$Str$ | OK! | OK! | |
---|
681 | +----------+------+-------+ |
---|
682 | |$@Str$ | OK! | OK! | |
---|
683 | +----------+------+-------+ |
---|
684 | |@Str$ | OK! | OK! | |
---|
685 | +----------+------+-------+ |
---|
686 | |#Str$ | OK! | FAIL! | |
---|
687 | +----------+------+-------+ |
---|
688 | |Str$ | OK! | FAIL! | |
---|
689 | +----------+------+-------+ |
---|
690 | |$Int | OK! | OK! | |
---|
691 | +----------+------+-------+ |
---|
692 | |$@Int | OK! | OK! | |
---|
693 | +----------+------+-------+ |
---|
694 | |@Int | OK! | OK! | |
---|
695 | +----------+------+-------+ |
---|
696 | |#Int | OK! | FAIL! | |
---|
697 | +----------+------+-------+ |
---|
698 | |Int | OK! | FAIL! | |
---|
699 | +----------+------+-------+ |
---|
700 | |.Str$ | OK! | OK! | |
---|
701 | +----------+------+-------+ |
---|
702 | |.Int | OK! | OK! | |
---|
703 | +----------+------+-------+ |
---|
704 | |.@Str$ | OK! | OK! | |
---|
705 | +----------+------+-------+ |
---|
706 | |.@Int | OK! | OK! | |
---|
707 | +----------+------+-------+ |
---|
708 | |
---|
709 | Variable References |
---|
710 | ------------------- |
---|
711 | |
---|
712 | //##TODO |
---|
713 | |
---|
714 | |
---|
715 | |
---|
716 | Operators |
---|
717 | --------- |
---|
718 | |
---|
719 | Operators are things you can do to variables and numbers. They are either the |
---|
720 | common mathematical operations or conditional operators |
---|
721 | |
---|
722 | + - will add two numbers. If you try to add two strings, the result will be a |
---|
723 | string glued together at the +. You can add a number to a string, and the |
---|
724 | result will be a string. No other math operators work with strings. |
---|
725 | - - will subtract two numbers. |
---|
726 | * - will multiply two numbers. |
---|
727 | / - will divide two numbers. Note that this is an integer division, i.e. |
---|
728 | 7/2 is not equal 3.5, it's equal 3. |
---|
729 | % - will give you the remainder of the division. 7%2 is equal to 1. |
---|
730 | |
---|
731 | There are also conditional operators. This has to do with the conditional |
---|
732 | command 'if' and they are meant to return either 1 if the condition is satisfied |
---|
733 | and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'. |
---|
734 | Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below |
---|
735 | zero will also be True.) |
---|
736 | |
---|
737 | You can compare numbers to each other and you compare strings to each other, but |
---|
738 | you can not compare numbers to strings. |
---|
739 | |
---|
740 | == - Is true if both sides are equal. For strings, it means they are the same. |
---|
741 | >= - True if the first value is equal to, or greater than, the second value. |
---|
742 | <= - True if the first value is equal to, or less than, the second value |
---|
743 | > - True if the first value greater than the second value |
---|
744 | < - True if the first value is less than the second value |
---|
745 | != - True if the first value IS NOT equal to the second one |
---|
746 | |
---|
747 | Examples: |
---|
748 | |
---|
749 | 1==1 is True. |
---|
750 | 1<2 is True while 1>2 is False. |
---|
751 | @x>2 is True if @x is equal to 3. But it isn't true if @x is 2. |
---|
752 | |
---|
753 | Only '==' and '!=' have been tested for comparing strings. Since there's no way |
---|
754 | to code a seriously complex data structure in this language, trying to sort |
---|
755 | strings by alphabet would be pointless anyway. |
---|
756 | |
---|
757 | Comparisons can be stacked in the same condition: |
---|
758 | |
---|
759 | && - Is True if and only if BOTH sides are true. |
---|
760 | ('1==1 && 2==2' is true. '2==1 && 1==1' is false.) |
---|
761 | || - Is True if either side of this expression is True. |
---|
762 | |
---|
763 | 1==1 && 2==2 is True. |
---|
764 | 1==1 && 2==1 is False. |
---|
765 | 1==1 || 2==1 is True. |
---|
766 | |
---|
767 | Logical bitwise operators work only on numbers, and they are the following: |
---|
768 | |
---|
769 | << - Left shift. |
---|
770 | >> - Right shift. |
---|
771 | Left shift moves the binary 1(s) of a number n positions to the left, |
---|
772 | which is the same as multiplying by 2, n times. |
---|
773 | In the other hand, Right shift moves the binary 1(s) of a number n positions |
---|
774 | to the right, which is the same as dividing by 2, n times. |
---|
775 | Example: |
---|
776 | set b,2; |
---|
777 | set a, b << 3; |
---|
778 | mes a; |
---|
779 | set a, a >> 2; |
---|
780 | mes a; |
---|
781 | The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16. |
---|
782 | The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4. |
---|
783 | & - And. |
---|
784 | | - Or. |
---|
785 | The bitwise operator AND (&) is used to test two values against eachother, |
---|
786 | and results in setting bits which are active in both arguments. This can |
---|
787 | be used for a few things, but in eAthena this operator is usually used to |
---|
788 | create bitmasks in scripts. |
---|
789 | |
---|
790 | The bitwise operator OR (|)sets to 1 a binary position if the binary position |
---|
791 | of one of the numbers is 1. This way a variable can hold several values we can check, |
---|
792 | known as bitmaks. A variable currently can hold up to 32 bitmasks (from position 0 |
---|
793 | to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks |
---|
794 | that a player can have. |
---|
795 | |
---|
796 | A bitmask basically is (ab)using the variables bits to set various options in |
---|
797 | one variable. With the current limit if variables it is possible to store 32 |
---|
798 | different options in one variable (by using the bits on position 0 to 31). |
---|
799 | |
---|
800 | Example(s): |
---|
801 | - Basic example of the & operator, bit example: |
---|
802 | 10 & 2 = 2 |
---|
803 | Why? : |
---|
804 | 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010 |
---|
805 | 2 = 2^1 (2), so in bits (same size) it would be 0010 |
---|
806 | The & (AND) operator sets bits which are active (1) in both arguments, so in the |
---|
807 | example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit |
---|
808 | 0010, which is 2. |
---|
809 | - Basic example of creating and using a bit mask: |
---|
810 | set @options,2|4|16; //(note: this is the same as 2+4+16, or 22) |
---|
811 | if (@options & 1) mes "Option 1 is activated"; |
---|
812 | if (@options & 2) mes "Option 2 is activated"; |
---|
813 | if (@options & 4) mes "Option 3 is activated"; |
---|
814 | if (@options & 8) mes "Option 4 is activated"; |
---|
815 | if (@options & 16) mes "Options 5 is activated"; |
---|
816 | This would return the messages about option 2, 3 and 5 being shown (since we've set |
---|
817 | the 2,4 and 16 bit to 1). |
---|
818 | ^ - Xor. |
---|
819 | The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both |
---|
820 | numbers have the same value in the said position. On the other hand, it |
---|
821 | sets to 1 if they have different values in the said binary position. |
---|
822 | This is another way of setting and unsetting bits in bitmasks. |
---|
823 | |
---|
824 | Example: |
---|
825 | - First let's set the quests that are currently in progress: |
---|
826 | set inProgress,1|8|16; // quest 1,8 and 16 are in progress |
---|
827 | - After playing for a bit, the player starts another quest: |
---|
828 | if( inProgress&2 == 0 ){ |
---|
829 | // this will set the bit for quest 2 (inProgress has that bit set to 0) |
---|
830 | set inProgress,inProgress^2; |
---|
831 | mes "Quest 2: find a newbie and be helpful to him for an hour."; |
---|
832 | close; |
---|
833 | } |
---|
834 | - After spending some time reading info on Xor's, the player finally completes quest 1: |
---|
835 | if( inProgress&1 && isComplete ){ |
---|
836 | // this will unset the bit for quest 1 (inProgress has that bit set to 1) |
---|
837 | set inProgress,inProgress^1; |
---|
838 | mes "Quest 1 complete!! You unlocked the secrets of the Xor dinasty, use them wisely."; |
---|
839 | close; |
---|
840 | } |
---|
841 | |
---|
842 | Labels |
---|
843 | ------ |
---|
844 | |
---|
845 | Within executable script code, some lines can be labels: |
---|
846 | |
---|
847 | <label name>: |
---|
848 | |
---|
849 | Labels are points of reference in your script, which can be used to route |
---|
850 | execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent' |
---|
851 | and 'donpcevent' commands and are otherwise essential. A label's name may not be |
---|
852 | longer than 22 characters. (23rd is the ':'.) There is some confusion in the |
---|
853 | source about whether it's 22, 23 or 24 all over the place, so keeping labels |
---|
854 | under 22 characters could be wise. In addition to labels you name yourself, |
---|
855 | there are also some special labels which the script engine will start execution |
---|
856 | from if a special event happens: |
---|
857 | |
---|
858 | OnClock<hour><minute>: |
---|
859 | OnMinute<minute>: |
---|
860 | OnHour<hour>: |
---|
861 | On<weekday><hour><minute>: |
---|
862 | OnDay<month><day>: |
---|
863 | |
---|
864 | This will execute when the server clock hits the specified date or time. Hours |
---|
865 | and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays |
---|
866 | are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31. |
---|
867 | Remember the zero. :) |
---|
868 | |
---|
869 | OnInit: |
---|
870 | OnInterIfInit: |
---|
871 | OnInterIfInitOnce: |
---|
872 | |
---|
873 | OnInit will execute every time the scripts loading is complete, including when |
---|
874 | they are reloaded with @reloadscript command. OnInterIfInit will execute when |
---|
875 | the map server connects to a char server, OnInterIfInitOnce will only execute |
---|
876 | once and will not execute if the map server reconnects to the char server later. |
---|
877 | |
---|
878 | OnAgitStart: |
---|
879 | OnAgitEnd: |
---|
880 | OnAgitInit: |
---|
881 | |
---|
882 | OnAgitStart will run whenever the server shifts into WoE mode, whether it is |
---|
883 | done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd |
---|
884 | will do likewise for the end of WoE. OnAgitInit will run when castle data is |
---|
885 | loaded from the char-server by the map server. |
---|
886 | |
---|
887 | No RID will be attached while any of the abovementioned labels are triggered, so |
---|
888 | no character or account-based variables will be accessible, until you attach a |
---|
889 | RID with 'attachrid' (see below). |
---|
890 | |
---|
891 | OnTouch: |
---|
892 | |
---|
893 | This label will be executed if a trigger area is defined for the NPC object it's |
---|
894 | in. If it isn't present, the execution will start from the beginning of the NPC |
---|
895 | code. The RID of the triggering character object will be attached. |
---|
896 | |
---|
897 | OnPCLoginEvent: |
---|
898 | OnPCLogoutEvent: |
---|
899 | OnPCBaseLvUpEvent: |
---|
900 | OnPCJobLvUpEvent: |
---|
901 | |
---|
902 | It's pretty obvious when these four special labels will be invoked. For more |
---|
903 | information, see 'npc/sample/PCLoginEvent.txt' |
---|
904 | |
---|
905 | OnPCDieEvent: |
---|
906 | |
---|
907 | This special label triggers when a player dies. The variable 'killerrid' is |
---|
908 | set to the ID of the killer. |
---|
909 | |
---|
910 | OnPCKillEvent: |
---|
911 | |
---|
912 | This special label triggers when a player kills another player. The variable |
---|
913 | 'killedrid' is set to the ID of the player killed. |
---|
914 | |
---|
915 | OnNPCKillEvent: |
---|
916 | |
---|
917 | This special label triggers when a player kills a monster. The variable |
---|
918 | 'killedrid' is set to the Class of the monster killed. |
---|
919 | |
---|
920 | OnPCLoadMapEvent: |
---|
921 | |
---|
922 | This special label will trigger once a player steps in a map marked with the |
---|
923 | 'loadevent' mapflag and attach its RID. The fact that this label requires a |
---|
924 | mapflag for it to work is because, otherwise, it'd be server-wide and trigger |
---|
925 | everytime a player would change maps. Imagine the server load with 1,000 players |
---|
926 | (oh the pain...) |
---|
927 | |
---|
928 | Only the special labels which are not associated with any script command are |
---|
929 | listed here. There are other kinds of labels which may be triggered in a similar |
---|
930 | manner, but they are described with their associated commands. |
---|
931 | |
---|
932 | On<label name>: |
---|
933 | |
---|
934 | These special labels are used with Mob scripts mostly, and script commands |
---|
935 | that requires you to point/link a command to a mob or another npc, giving a label |
---|
936 | name to start from. The label name can be any of your liking, but must be |
---|
937 | |
---|
938 | Example: |
---|
939 | |
---|
940 | monster "prontera",123,42,"Poringz0rd",2341,23,"Master::OnThisMobDeath"; |
---|
941 | |
---|
942 | amatsu,13,152,4 script Master 767,{ |
---|
943 | mes "Hi there"; |
---|
944 | close; |
---|
945 | |
---|
946 | OnThisMobDeath: |
---|
947 | announce "Hey, "+strcharinfo(0)+" just killed a Poringz0rd!",bc_blue|bc_all; |
---|
948 | end; |
---|
949 | } |
---|
950 | |
---|
951 | Each time you kill one, that announce will appear in blue to everyone. |
---|
952 | |
---|
953 | Scripting commands and functions |
---|
954 | -------------------------------- |
---|
955 | |
---|
956 | The commands and functions are listed here in no particular order. There's a |
---|
957 | difference between commands and functions - commands leave no 'return value' |
---|
958 | which might be used in a conditional statement, as a command argument, or stored |
---|
959 | in a variable. Calling commands as if they were functions will sometimes work, |
---|
960 | but is not advised, as this can lead to some hard to track errors. Calling |
---|
961 | functions as if they were commands will mess up the stack, so 'return' command |
---|
962 | will not return correctly after this happens in a particular script. |
---|
963 | |
---|
964 | All commands must end with a ';'. Actually, you may expect to have multiple |
---|
965 | commands on one line if you properly terminate them with a ';', but it's better |
---|
966 | if you don't, since it is not certain just whether the scripting engine will |
---|
967 | behave nicely if you do. |
---|
968 | |
---|
969 | ------------------------- |
---|
970 | |
---|
971 | |
---|
972 | From here on, we will have the commands sorted as follow: |
---|
973 | |
---|
974 | 1.- Basic commands. |
---|
975 | 2.- Information-retrieving commands. |
---|
976 | 3.- Checking commands. |
---|
977 | 4.- Player-related commands. |
---|
978 | 5.- Mob / NPC -related commands. |
---|
979 | 6.- Other commands. |
---|
980 | |
---|
981 | ===================== |
---|
982 | |1.- Basic commands.| |
---|
983 | ===================== |
---|
984 | --------------------------------------- |
---|
985 | |
---|
986 | *mes "<string>"; |
---|
987 | |
---|
988 | This command will displays a box on the screen for the invoking character, if no |
---|
989 | such box is displayed already, and will print the string specified into that |
---|
990 | box. There is normally no 'close' or 'next' button on this box, unless you |
---|
991 | create one with 'close' or 'next', and while it's open the player can't do much |
---|
992 | else, so it's important to create a button later. If the string is empty, it |
---|
993 | will show up as an empty line. |
---|
994 | |
---|
995 | mes "Text that will appear in the box"; |
---|
996 | |
---|
997 | Inside the string you may put color codes, which will alter the color of the |
---|
998 | text printed after them. The color codes are all '^<R><G><B>' and contain three |
---|
999 | hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is |
---|
1000 | bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black. |
---|
1001 | ^FF00FF is a pure magenta, but it's also a color that is considered transparent |
---|
1002 | whenever the client is drawing windows on screen, so printing text in that color |
---|
1003 | will have kind of a weird effect. Once you've set a text's color to something, |
---|
1004 | you have to set it back to black unless you want all the rest of the text be in |
---|
1005 | that color: |
---|
1006 | |
---|
1007 | mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so."; |
---|
1008 | |
---|
1009 | Notice that the text coloring is handled purely by the client. If you use non- |
---|
1010 | english characters, the color codes might get screwed if they stick to letters |
---|
1011 | with no intervening space. Separating them with spaces from the letters on |
---|
1012 | either side solves the problem. |
---|
1013 | |
---|
1014 | --------------------------------------- |
---|
1015 | |
---|
1016 | *next; |
---|
1017 | |
---|
1018 | This command will create a 'next' button in the message window for the invoking |
---|
1019 | character. If no window is currently on screen, it will be created. Used to |
---|
1020 | segment NPC talking, this command is used A LOT. See 'mes'. |
---|
1021 | |
---|
1022 | mes "[Woman]"; |
---|
1023 | mes "This would appear on the page"; |
---|
1024 | next; |
---|
1025 | // This is needed cause it is a new page and the top will now be blank |
---|
1026 | mes "[Woman]"; |
---|
1027 | mes "This would appear on the 2nd page"; |
---|
1028 | |
---|
1029 | --------------------------------------- |
---|
1030 | |
---|
1031 | *close; |
---|
1032 | |
---|
1033 | This command will create a 'close' button in the message window for the invoking |
---|
1034 | character. If no window is currently on screen, it will be created. This is one |
---|
1035 | of the ways to end a speech from an NPC. Once the button is clicked, the NPC |
---|
1036 | script execution will end, and the message box will disappear. |
---|
1037 | |
---|
1038 | mes "[Woman]"; |
---|
1039 | mes "I am finished talking to you, click the close button"; |
---|
1040 | close; |
---|
1041 | mes "This command will not run at all, cause the script has ended."; |
---|
1042 | |
---|
1043 | --------------------------------------- |
---|
1044 | |
---|
1045 | *close2; |
---|
1046 | |
---|
1047 | This command will create a 'close' button in the message window for the invoking |
---|
1048 | character. If no window is currently on screen, it will be created. See 'close'. |
---|
1049 | There is one important difference, though - even though the message box will |
---|
1050 | have closed, the script execution will not stop, and commands after 'close2' |
---|
1051 | will still run, meaning an 'end' has to be used to stop the script, unless you |
---|
1052 | make it stop in some other manner. |
---|
1053 | |
---|
1054 | mes "[Woman]"; |
---|
1055 | mes "I will warp you now"; |
---|
1056 | close2; |
---|
1057 | warp "place",50,50; |
---|
1058 | end; |
---|
1059 | |
---|
1060 | Don't expect things to run smoothly if you don't make your scripts 'end'. |
---|
1061 | |
---|
1062 | --------------------------------------- |
---|
1063 | |
---|
1064 | *end; |
---|
1065 | |
---|
1066 | This command will stop the execution for this particular script. The two |
---|
1067 | versions are prefectly equivalent. It is the normal way to end a script which |
---|
1068 | does not use 'mes'. |
---|
1069 | |
---|
1070 | if (BaseLevel<=10) goto L_Lvl10; |
---|
1071 | if (BaseLevel<=20) goto L_Lvl20; |
---|
1072 | if (BaseLevel<=30) goto L_Lvl30; |
---|
1073 | if (BaseLevel<=40) goto L_Lvl40; |
---|
1074 | if (BaseLevel<=50) goto L_Lvl50; |
---|
1075 | if (BaseLevel<=60) goto L_Lvl60; |
---|
1076 | if (BaseLevel<=70) goto L_Lvl70; |
---|
1077 | L_Lvl10: |
---|
1078 | npctalk "Look at that you are still a n00b"; |
---|
1079 | end; |
---|
1080 | L_Lvl20: |
---|
1081 | npctalk "Look at that you are getting better, but still a n00b"; |
---|
1082 | end; |
---|
1083 | L_Lvl30: |
---|
1084 | npctalk "Look at that you are getting there, you are almost 2nd profession now right???"; |
---|
1085 | end; |
---|
1086 | L_Lvl40: |
---|
1087 | npctalk "Look at that you are almost 2nd profession"; |
---|
1088 | end; |
---|
1089 | |
---|
1090 | Without the use if 'end' it would travel through the labels until the end of the |
---|
1091 | script. If you were lvl 10 or less, you would see all the speech lines, the use |
---|
1092 | of 'end' stops this, and ends the script. |
---|
1093 | |
---|
1094 | --------------------------------------- |
---|
1095 | |
---|
1096 | *set <variable>,<expression>; |
---|
1097 | |
---|
1098 | This command will set a variable to the value that the expression results in. |
---|
1099 | This is the only way to set a variable directly. |
---|
1100 | |
---|
1101 | This is the most basic script command and is used a lot whenever you try to do |
---|
1102 | anything more advanced than just printing text into a messagebox. |
---|
1103 | |
---|
1104 | set @x,100; |
---|
1105 | |
---|
1106 | will make @x equal 100. |
---|
1107 | |
---|
1108 | set @x,1+5/8+9; |
---|
1109 | |
---|
1110 | will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are |
---|
1111 | integer in this language) and make @x equal it. |
---|
1112 | |
---|
1113 | Returns the variable reference (since trunk r12870). |
---|
1114 | |
---|
1115 | --------------------------------------- |
---|
1116 | |
---|
1117 | *setd "<variable name>",<value>; |
---|
1118 | |
---|
1119 | Works almost identical as set, just that the variable name is identified as a string, |
---|
1120 | thus can be constructed dynamically. |
---|
1121 | This command is equivalent to: |
---|
1122 | set getd("variable name"),<value>; |
---|
1123 | |
---|
1124 | Example: |
---|
1125 | set $var$, "Poring"; |
---|
1126 | |
---|
1127 | setd "$var$", "Poporing"; |
---|
1128 | mes $var$; // Will return Poporing |
---|
1129 | |
---|
1130 | setd "$" + $var$ + "123$", "Poporing is cool"; |
---|
1131 | mes $Poporing123$; // Will return Poporing is cool. |
---|
1132 | |
---|
1133 | --------------------------------------- |
---|
1134 | |
---|
1135 | *getd("<variable name>") |
---|
1136 | |
---|
1137 | Returns a reference to a variable, the name can be constructed dynamically. |
---|
1138 | Refer to setd for usage. |
---|
1139 | |
---|
1140 | Example: |
---|
1141 | set getd("$varRefence"), 1; |
---|
1142 | set @i, getd("$pikachu"); |
---|
1143 | |
---|
1144 | --------------------------------------- |
---|
1145 | |
---|
1146 | *getvariableofnpc(<variable>,"<npc name>") |
---|
1147 | |
---|
1148 | Returns a reference to a NPC variable (. prefix) from the target NPC. |
---|
1149 | This can only be used to get . variables. |
---|
1150 | Example(s): |
---|
1151 | |
---|
1152 | //This will return the value of .var, note that this can't be used, since the value isn't catched. |
---|
1153 | getvariableofnpc(.var,"TargetNPC"); |
---|
1154 | |
---|
1155 | //This will set the .v variable to the value of the TargetNPC's .var variable. |
---|
1156 | set .v,getvariableofnpc(.var,"TargetNPC"); |
---|
1157 | |
---|
1158 | //This will set the .var variable of TargetNPC to 1. |
---|
1159 | set getvariableofnpc(.var,"TargetNPC"),1; |
---|
1160 | |
---|
1161 | --------------------------------------- |
---|
1162 | |
---|
1163 | *goto <label>; |
---|
1164 | |
---|
1165 | This command will make the script jump to a label, usually used in conjunction |
---|
1166 | with other command, such as "if", but often used on it's own. |
---|
1167 | |
---|
1168 | ... |
---|
1169 | goto Label; |
---|
1170 | mes "This will not be seen"; |
---|
1171 | Label: |
---|
1172 | mes "This will be seen"; |
---|
1173 | |
---|
1174 | Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó) |
---|
1175 | |
---|
1176 | --------------------------------------- |
---|
1177 | |
---|
1178 | *menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...}; |
---|
1179 | |
---|
1180 | This command will create a selectable menu for the invoking character. Only one |
---|
1181 | menu can be on screen at the same time. |
---|
1182 | |
---|
1183 | Depending on what the player picks from the menu, the script execution will |
---|
1184 | continue from the corresponding label. (it's string-label pairs, not label- |
---|
1185 | string) |
---|
1186 | |
---|
1187 | Options can be grouped together, separated by the character ':'. |
---|
1188 | |
---|
1189 | menu "A:B",L_Wrong,"C",L_Right; |
---|
1190 | |
---|
1191 | It also sets a special temporary character variable @menu, which contains the |
---|
1192 | number of option the player picked. (Numbering of options starts at 1.) |
---|
1193 | This number is consistent with empty options and grouped options. |
---|
1194 | |
---|
1195 | menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right; |
---|
1196 | L_Wrong: |
---|
1197 | // If they click "A" or "B" they will end up here |
---|
1198 | // @menu == 1 if "A" |
---|
1199 | // @menu == 2 will never happen because the option is empty |
---|
1200 | // @menu == 3 if "B" |
---|
1201 | L_Impossible: |
---|
1202 | // Empty options are not displayed and therefore can't be selected |
---|
1203 | // this label will never be reached from the menu command |
---|
1204 | L_Right: |
---|
1205 | // If they click "C" they will end up here |
---|
1206 | // @menu == 5 |
---|
1207 | |
---|
1208 | If a label is '-', the script execution will continue right after the menu |
---|
1209 | command if that option is selected, this can be used to save you time, and |
---|
1210 | optimize big scripts. |
---|
1211 | |
---|
1212 | menu "A::B:",-,"C",L_Right; |
---|
1213 | // If they click "A" or "B" they will end up here |
---|
1214 | // @menu == 1 if "A" |
---|
1215 | // @menu == 3 if "B" |
---|
1216 | L_Right: |
---|
1217 | // If they click "C" they will end up here |
---|
1218 | // @menu == 5 |
---|
1219 | |
---|
1220 | Both these examples will perform the exact same task. |
---|
1221 | |
---|
1222 | If you give an empty string as a menu item, the item will not display. This |
---|
1223 | can effectively be used to script dynamic menus by using empty string for |
---|
1224 | entries that should be unavailable at that time. |
---|
1225 | |
---|
1226 | You can do it by using arrays, but watch carefully - this trick isn't high |
---|
1227 | wizardry, but minor magic at least. You can't expect to easily duplicate it |
---|
1228 | until you understand how it works. |
---|
1229 | |
---|
1230 | Create a temporary array of strings to contain your menu items, and populate it |
---|
1231 | with the strings that should go into the menu at this execution, making sure not |
---|
1232 | to leave any gaps. Normally, you do it with a loop and an extra counter, like |
---|
1233 | this: |
---|
1234 | |
---|
1235 | setarray @possiblemenuitems$[0],<list of potential menu items>; |
---|
1236 | set @j,0; // That's the menu lines counter. |
---|
1237 | |
---|
1238 | // We loop through the list of possible menu items. |
---|
1239 | // @i is our loop counter. |
---|
1240 | for( set @i,0; @i<getarraysize(@possiblemenuitems$) ; set @i,@i+1 ) |
---|
1241 | { |
---|
1242 | // That 'condition' is whatever condition that determines whether |
---|
1243 | // a menu item number @i actually goes into the menu or not. |
---|
1244 | |
---|
1245 | if (<condition>) |
---|
1246 | { |
---|
1247 | // We record the option into the list of options actually available. |
---|
1248 | |
---|
1249 | set @menulist$[@j],@possiblemenuitems$[@i]; |
---|
1250 | |
---|
1251 | // We just copied the string, we do need it's number for later |
---|
1252 | // though, so we record it as well. |
---|
1253 | |
---|
1254 | set @menureference[@j],@i; |
---|
1255 | |
---|
1256 | // Since we've just added a menu item into the list, we increment |
---|
1257 | // the menu lines counter. |
---|
1258 | |
---|
1259 | set @j,@j+1; |
---|
1260 | } |
---|
1261 | |
---|
1262 | // We go on to the next possible menu item. |
---|
1263 | } |
---|
1264 | |
---|
1265 | This will create you an array @menulist$ which contains the text of all items |
---|
1266 | that should actually go into the menu based on your condition, and an array |
---|
1267 | @menureference, which contains their numbers in the list of possible menu items. |
---|
1268 | (Remember, arrays start with 0.) There's less of them than the possible menu |
---|
1269 | items you've defined, but the menu command can handle the empty lines - only if |
---|
1270 | they are last in the list, and if it's made this way, they are. Now comes a |
---|
1271 | dirty trick: |
---|
1272 | |
---|
1273 | // X is whatever the most menu items you expect to handle. |
---|
1274 | menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-; |
---|
1275 | |
---|
1276 | This calls up a menu of all your items. Since you didn't copy some of the |
---|
1277 | possible menu items into the list, it's end is empty and so no menu items will |
---|
1278 | show up past the end. But this menu call doesn't jump anywhere, it just |
---|
1279 | continues execution right after the menu command. (And it's a good thing it |
---|
1280 | doesn't, cause you can only explicitly define labels to jump to, and how do you |
---|
1281 | know which ones to define if you don't know beforehand which options will end up |
---|
1282 | where in your menu?) |
---|
1283 | But how do you figure out which option the user picked? Enter the @menu. |
---|
1284 | |
---|
1285 | @menu contains the number of option that the user selected from the list, |
---|
1286 | starting with 1 for the first option. You know now which option the user picked |
---|
1287 | and which number in your real list of possible menu items it translated to: |
---|
1288 | |
---|
1289 | mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!"; |
---|
1290 | |
---|
1291 | @menu is the number of option the user picked. |
---|
1292 | @menu-1 is the array index for the list of actually used menu items that we |
---|
1293 | made. |
---|
1294 | @menureference[@menu-1] is the number of the item in the array of possible menu |
---|
1295 | items that we've saved just for this purpose. |
---|
1296 | |
---|
1297 | And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to |
---|
1298 | display the menu line the user picked. (Yes, it's a handful, but it works.) |
---|
1299 | |
---|
1300 | You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to |
---|
1301 | route your execution based on the line selected and still generate a different |
---|
1302 | menu every time, which is handy when you want to, for example, make users select |
---|
1303 | items in any specific order before proceeding, or make a randomly shuffled menu. |
---|
1304 | |
---|
1305 | Kafra code bundled with the standard distribution uses a similar array-based |
---|
1306 | menu technique for teleport lists, but it's much simpler and doesn't use @menu, |
---|
1307 | probably since that wasn't documented anywhere. |
---|
1308 | |
---|
1309 | See also 'select', which is probably better in this particular case. Instead of |
---|
1310 | menu, you could use 'select' like this: |
---|
1311 | |
---|
1312 | set @dummy,select(@menulist$[0],@menulist$[1],....@menulist$[<X>]); |
---|
1313 | |
---|
1314 | For the purposes of the technique described above these two statements are |
---|
1315 | perfectly equivalent. |
---|
1316 | |
---|
1317 | --------------------------------------- |
---|
1318 | |
---|
1319 | *select("<option>"{,"<option>",...}) |
---|
1320 | *prompt("<option>"{,"<option>",...}) |
---|
1321 | |
---|
1322 | This function is a handy replacement for 'menu' for some specific cases where |
---|
1323 | you don't want a complex label structure - like, for example, asking simple yes- |
---|
1324 | no questions. It will return the number of menu option picked, starting with 1. |
---|
1325 | Like 'menu', it will also set the variable @menu to contain the option the user |
---|
1326 | picked. |
---|
1327 | |
---|
1328 | if (select("Yes:No")==1) mes "You said yes, I know."; |
---|
1329 | |
---|
1330 | And like 'menu', the selected option is consistent with grouped options |
---|
1331 | and empty options. |
---|
1332 | |
---|
1333 | prompt works almost the same as select, except that when a character clicks |
---|
1334 | the Cancel button, this function will return 255 instead. |
---|
1335 | |
---|
1336 | --------------------------------------- |
---|
1337 | |
---|
1338 | *input(<variable>{,<min>{,<max>}}) |
---|
1339 | |
---|
1340 | This command will make an input box pop up on the client connected to the |
---|
1341 | invoking character, to allow entering of a number or a string. This has many |
---|
1342 | uses, one example would be a guessing game, also making use of the 'rand' |
---|
1343 | function: |
---|
1344 | |
---|
1345 | mes "[Woman]"; |
---|
1346 | mes "Try and guess the number I am thinking of."; |
---|
1347 | mes "The number will be between 1 and 10."; |
---|
1348 | next; |
---|
1349 | set @number, rand(1,10); |
---|
1350 | input @guess; |
---|
1351 | if(@guess==@number) |
---|
1352 | { |
---|
1353 | mes "[Woman]"; |
---|
1354 | mes "Well done that was the number I was thinking of"; |
---|
1355 | close; |
---|
1356 | } |
---|
1357 | else |
---|
1358 | { |
---|
1359 | mes "[Woman]"; |
---|
1360 | mes "Sorry, that wasn't the number I was thinking of."; |
---|
1361 | close; |
---|
1362 | } |
---|
1363 | |
---|
1364 | If you give the input command a string variable to put the input in, it will |
---|
1365 | allow the player to enter text. Otherwise, only numbers will be allowed. |
---|
1366 | |
---|
1367 | mes "[Woman]"; |
---|
1368 | mes "Please say HELLO"; |
---|
1369 | next; |
---|
1370 | input @var$; |
---|
1371 | if(@var$=="HELLO") |
---|
1372 | { |
---|
1373 | mes "[Woman]"; |
---|
1374 | mes "Well done you typed it correctly"; |
---|
1375 | close; |
---|
1376 | } |
---|
1377 | else |
---|
1378 | { |
---|
1379 | mes "[Woman]"; |
---|
1380 | mes "Sorry you got it wrong"; |
---|
1381 | close; |
---|
1382 | } |
---|
1383 | |
---|
1384 | Normally you may not input a negative number with this command. |
---|
1385 | This is done to prevent exploits in badly written scripts, which would |
---|
1386 | let people, for example, put negative amounts of zeny into a bank script and |
---|
1387 | receive free zeny as a result. |
---|
1388 | |
---|
1389 | Since trunk r12192 the command has two optional arguments and a return value. |
---|
1390 | The default value of 'min' and 'max' can be set with 'input_min_value' and |
---|
1391 | 'input_max_value' in script_athena.conf. |
---|
1392 | For numeric inputs the value is capped to the range [min,max]. Returns 1 if |
---|
1393 | the value was higher than 'max', -1 if lower than 'min' and 0 otherwise. |
---|
1394 | For string inputs it returns 1 if the string was longer than 'max', -1 is |
---|
1395 | shorter than 'min' and 0 otherwise. |
---|
1396 | |
---|
1397 | --------------------------------------- |
---|
1398 | |
---|
1399 | *callfunc "<function>"{,<argument>,...<argument>}; |
---|
1400 | *callfunc("<function>"{,<argument>,...<argument>}) |
---|
1401 | |
---|
1402 | This command lets you call up a function NPC. A function NPC can be called from |
---|
1403 | any script on any map server. Using the 'return' command it will come back to |
---|
1404 | the place that called it. |
---|
1405 | |
---|
1406 | place,50,50,6%TAB%script%TAB%Woman%TAB%115,{ |
---|
1407 | mes "[Woman]" |
---|
1408 | mes "Lets see if you win"; |
---|
1409 | callfunc "funcNPC"; |
---|
1410 | mes "Well done you have won"; |
---|
1411 | close; |
---|
1412 | } |
---|
1413 | function%TAB%script%TAB%funcNPC%TAB%{ |
---|
1414 | set @win, rand(2); |
---|
1415 | if(@win==0) return; |
---|
1416 | mes "Sorry you lost"; |
---|
1417 | end; |
---|
1418 | } |
---|
1419 | |
---|
1420 | You can pass arguments to your function - values telling it what exactly to do - |
---|
1421 | which will be available there with getarg() (see 'getarg') |
---|
1422 | Notice that returning is not mandatory, you can end execution right there. |
---|
1423 | |
---|
1424 | If you want to return a real value from inside your function NPC, it is better |
---|
1425 | to write it in the function form, which will also work and will make the script |
---|
1426 | generally cleaner: |
---|
1427 | |
---|
1428 | place,50,50,6%TAB%script%TAB%Man%TAB%115,{ |
---|
1429 | mes "[Man]" |
---|
1430 | mes "Gimme a number!"; |
---|
1431 | next; |
---|
1432 | input @number; |
---|
1433 | if (callfunc("OddFunc",@number)) mes "It's Odd!"; |
---|
1434 | close; |
---|
1435 | } |
---|
1436 | function%TAB%script%TAB%OddFunc%TAB%{ |
---|
1437 | if (getarg(0)%2==0) return 0;// it's even |
---|
1438 | return 1;// it's odd |
---|
1439 | } |
---|
1440 | |
---|
1441 | --------------------------------------- |
---|
1442 | |
---|
1443 | *callsub <label>{,<argument>,...<argument>}; |
---|
1444 | |
---|
1445 | This command will go to a specified label within the current script (do NOT use |
---|
1446 | quotes around it) coming in as if it were a 'callfunc' call, and pass it |
---|
1447 | arguments given, if any, which can be recovered there with 'getarg'. When done |
---|
1448 | there, you should use the 'return' command to go back to the point from where |
---|
1449 | this label was called. This is used when there is a specific thing the script |
---|
1450 | will do over and over, this lets you use the same bit of code as many times as |
---|
1451 | you like, to save space and time, without creating extra NPC objects which are |
---|
1452 | needed with 'callfunc'. A label is not callable in this manner from another |
---|
1453 | script. |
---|
1454 | |
---|
1455 | mes "[Woman]" |
---|
1456 | mes "Lets see if you win"; |
---|
1457 | callsub Check; |
---|
1458 | mes "Well done you have won"; |
---|
1459 | close; |
---|
1460 | Check: |
---|
1461 | set @win, rand(2); |
---|
1462 | if(@win==0) return; |
---|
1463 | mes "Sorry you lost"; |
---|
1464 | close; |
---|
1465 | |
---|
1466 | --------------------------------------- |
---|
1467 | |
---|
1468 | *getarg(<index>{,<default_value>}) |
---|
1469 | |
---|
1470 | This function is used when you use the 'callsub' or 'callfunc' commands. In the |
---|
1471 | call you can specify variables that will make that call different from another |
---|
1472 | one. This function will return an argument the function or subroutine was |
---|
1473 | called with, and is the normal way to get them. |
---|
1474 | This is another thing that can let you use the same code more than once. |
---|
1475 | |
---|
1476 | Argument numbering starts with 0, i.e. the first argument you gave is number 0. |
---|
1477 | If no such argument was given, a zero is returned. |
---|
1478 | |
---|
1479 | place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{ |
---|
1480 | mes "[Woman]"; |
---|
1481 | mes "Lets see if you win"; |
---|
1482 | callfunc "funcNPC",2; |
---|
1483 | mes "Well done you have won"; |
---|
1484 | |
---|
1485 | ... |
---|
1486 | |
---|
1487 | place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{ |
---|
1488 | mes "[Woman]"; |
---|
1489 | mes "Lets see if you win"; |
---|
1490 | callfunc "funcNPC",5; |
---|
1491 | mes "Well done you have won"; |
---|
1492 | |
---|
1493 | ... |
---|
1494 | |
---|
1495 | function%TAB%script%TAB%funcNPC%TAB%{ |
---|
1496 | set @win, rand(getarg(0)); |
---|
1497 | if(@win==0) return; |
---|
1498 | mes "Sorry you lost"; |
---|
1499 | |
---|
1500 | "woman1" NPC object calls the funcNPC. The argument it gives in this call is |
---|
1501 | stated as 2, so when the random number is generated by the 'rand' function, it |
---|
1502 | can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when |
---|
1503 | calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes |
---|
1504 | "woman2" less likely to say the player won. |
---|
1505 | |
---|
1506 | You can pass multiple arguments in a function call: |
---|
1507 | |
---|
1508 | callfunc "funcNPC",5,4,3; |
---|
1509 | |
---|
1510 | getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3. |
---|
1511 | |
---|
1512 | Getarg has an optional argument since trunk r10773 and stable r10958. |
---|
1513 | If the target argument exists, it is returned. |
---|
1514 | Otherwise, if <default_value> is present it is returned instead, |
---|
1515 | if not the script terminates immediately. |
---|
1516 | |
---|
1517 | in the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1 |
---|
1518 | |
---|
1519 | --------------------------------------- |
---|
1520 | |
---|
1521 | *return {<value>}; |
---|
1522 | |
---|
1523 | When you use callsub or callfunc, this command allows you to go back to the |
---|
1524 | calling script. You can optionally return with a value telling the calling |
---|
1525 | program what exactly happened. |
---|
1526 | |
---|
1527 | callfunc "<your function>";// when nothing is returned |
---|
1528 | set <variable>,callfunc("<your function>");// when a value is being returned |
---|
1529 | |
---|
1530 | --------------------------------------- |
---|
1531 | |
---|
1532 | *function <function name>; |
---|
1533 | *<function name>; |
---|
1534 | *function <function name> { |
---|
1535 | <code> |
---|
1536 | } |
---|
1537 | |
---|
1538 | (Skotlex stop being so selfish and give us all the commands T~T! J/k lol :P) |
---|
1539 | |
---|
1540 | This works like callfunc, but doesn't support arguments like callfunc. It's used for cleaner |
---|
1541 | and fast script that doesn't require arguments for it to work. Also they must be inside a script. |
---|
1542 | They're not separated scripts and they work more like labels. |
---|
1543 | |
---|
1544 | Note it looks like the normal declaration |
---|
1545 | |
---|
1546 | Usage: |
---|
1547 | |
---|
1548 | You first Declare the function with function <function name>;. |
---|
1549 | |
---|
1550 | Put the rest of your code. You can use then <function name>; to call the function. If it returns a value is unsure, |
---|
1551 | test it if you want and give us some comments ;3 |
---|
1552 | |
---|
1553 | And at least, but inside the script itself, put the function <function name> {<code>}. |
---|
1554 | |
---|
1555 | Example: |
---|
1556 | |
---|
1557 | prontera,154,189,4 script Item seller 767,{ |
---|
1558 | |
---|
1559 | function SF_Selling; |
---|
1560 | |
---|
1561 | mes "I'll open this now if you have more than 50z and you are level 50 or bigger"; |
---|
1562 | next; |
---|
1563 | |
---|
1564 | if (Zeny > 50) && (BaseLevel > 50) { |
---|
1565 | mes "Welcome"; |
---|
1566 | next; |
---|
1567 | SF_Selling; |
---|
1568 | close; |
---|
1569 | } else |
---|
1570 | |
---|
1571 | set @needed,50-BaseLevel; |
---|
1572 | mes "You either are Level "+BaseLevel+", thus you need "+@needed+" more levels"; |
---|
1573 | mes "to be able to use this npc; or you don't have enough zeny, so get some please"; |
---|
1574 | close; |
---|
1575 | |
---|
1576 | function SF_Selling { |
---|
1577 | |
---|
1578 | mes "Would you like to buy a phracon for 50z?"; |
---|
1579 | switch(select("Yes","No, thanks")) { |
---|
1580 | |
---|
1581 | case 1: |
---|
1582 | mes "Ok, how many?"; |
---|
1583 | input @quantity; |
---|
1584 | set @check,Zeny/50; |
---|
1585 | if (@quantity > @check) { |
---|
1586 | mes "Sorry but you can only have "+@check+" Phracons with "+Zeny; |
---|
1587 | close; |
---|
1588 | } else |
---|
1589 | next; |
---|
1590 | mes "here you have"; |
---|
1591 | set Zeny,Zeny-@quantity*50; |
---|
1592 | getitem 1010,@quantity; |
---|
1593 | close; |
---|
1594 | case 2: |
---|
1595 | mes "Good bye then"; |
---|
1596 | close; |
---|
1597 | } |
---|
1598 | } |
---|
1599 | return; |
---|
1600 | } |
---|
1601 | |
---|
1602 | |
---|
1603 | --------------------------------------- |
---|
1604 | |
---|
1605 | *if (<condition>) <statement>; |
---|
1606 | |
---|
1607 | This is the basic conditional statement command, and just about the only one |
---|
1608 | available in this scripting language. |
---|
1609 | |
---|
1610 | The condition can be any expression. All expressions resulting in a non-zero |
---|
1611 | value will be considered True, including negative values. All expressions |
---|
1612 | resulting in a zero are false. |
---|
1613 | |
---|
1614 | If the expression results in True, the statement will be executed. If it isn't |
---|
1615 | true, nothing happens and we move on to the next line of the script. |
---|
1616 | |
---|
1617 | if (1) mes "This will always print."; |
---|
1618 | if (0) mes "And this will never print."; |
---|
1619 | if (5) mes "This will also always print."; |
---|
1620 | if (-1) mes "Funny as it is, this will also print just fine."; |
---|
1621 | |
---|
1622 | For more information on conditional operators see the operators section above. |
---|
1623 | Anything that is returned by a function can be used in a condition check without |
---|
1624 | bothering to store it in a specific variable: |
---|
1625 | |
---|
1626 | if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!"; |
---|
1627 | |
---|
1628 | More examples of using the 'if' command in the real world: |
---|
1629 | |
---|
1630 | Example 1: |
---|
1631 | |
---|
1632 | set @var1,1; |
---|
1633 | input @var2; |
---|
1634 | if(@var1==@var2) goto L_Same; |
---|
1635 | mes "Sorry that is wrong"; |
---|
1636 | close; |
---|
1637 | L_Same: |
---|
1638 | close; |
---|
1639 | |
---|
1640 | Example 2: |
---|
1641 | |
---|
1642 | set @var1,1; |
---|
1643 | input @var2; |
---|
1644 | if(@var1!=@var2) mes "Sorry that is wrong"; |
---|
1645 | close; |
---|
1646 | |
---|
1647 | (Notice examples 1 and 2 have the same effect.) |
---|
1648 | |
---|
1649 | Example 3: |
---|
1650 | |
---|
1651 | set @var1,@var1+1; |
---|
1652 | mes "[Forgetfull Man]"; |
---|
1653 | if (@var==1) mes "This is the first time you have talked to me"; |
---|
1654 | if (@var==2) mes "This is the second time you have talked to me"; |
---|
1655 | if (@var==3) mes "This is the third time you have talked to me"; |
---|
1656 | if (@var==4) mes "This is the forth time you have talked to me, but I think I am getting amnesia, I have forgoten about you"; |
---|
1657 | if (@var==4) set @var,0; |
---|
1658 | close; |
---|
1659 | |
---|
1660 | Example 4: |
---|
1661 | |
---|
1662 | mes "[Quest Person]"; |
---|
1663 | if(countitem(512)>=1) goto L_GiveApple; |
---|
1664 | // The number 512 was found from item_db, it is the item number for the Apple. |
---|
1665 | mes "Can you please bring me an apple?"; |
---|
1666 | close; |
---|
1667 | L_GiveApple: |
---|
1668 | mes "Oh an apple, I didnt want it, I just wanted to see one"; |
---|
1669 | close; |
---|
1670 | |
---|
1671 | Example 5: |
---|
1672 | |
---|
1673 | mes "[Person Checker]"; |
---|
1674 | if($name$!=null) goto L_Check; |
---|
1675 | mes "Please tell me someones name"; |
---|
1676 | next; |
---|
1677 | input $name$; |
---|
1678 | set $name2$,strcharinfo(0); |
---|
1679 | mes "[Person Checker]"; |
---|
1680 | mes "Thank you"; |
---|
1681 | L_Check: |
---|
1682 | if($name$==strcharinfo(0) ) goto L_SameName; |
---|
1683 | mes "[Person Checker]"; |
---|
1684 | mes "You are not the person that " +$name2$+ " mentioned"; |
---|
1685 | L_End: |
---|
1686 | set $name$,null; |
---|
1687 | set $name2$,null; |
---|
1688 | close; |
---|
1689 | L_SameName: |
---|
1690 | mes "[Person Checker]"; |
---|
1691 | mes "You are the person that " +$name2$+ " just mentioned"; |
---|
1692 | mes "nice to meet you"; |
---|
1693 | goto L_End; |
---|
1694 | |
---|
1695 | See 'strcharinfo' for explanation of what this function does. |
---|
1696 | |
---|
1697 | Example 6: Using complex conditions. |
---|
1698 | |
---|
1699 | mes "[Multi Checker]"; |
---|
1700 | if( (@queststarted==1) && (countitem(512)>=5) ) goto L_MultiCheck; |
---|
1701 | // Only if the quest has been started AND You have 5 apples will it goto "L_MultiCheck" |
---|
1702 | mes "Please get me 5 apples"; |
---|
1703 | set @queststarted,1; |
---|
1704 | close; |
---|
1705 | L_MultiCheck: |
---|
1706 | mes "[Multi Checker]"; |
---|
1707 | mes "Well done you have started the quest of got me 5 apples"; |
---|
1708 | mes "Thank you"; |
---|
1709 | set @queststarted,0; |
---|
1710 | delitem 512,5; |
---|
1711 | close; |
---|
1712 | |
---|
1713 | With the Advanced scripting engine, we got nested if's. That is: |
---|
1714 | |
---|
1715 | if (<condition>) |
---|
1716 | dothis; |
---|
1717 | else |
---|
1718 | dothat; |
---|
1719 | |
---|
1720 | If the condition doesn't meet, it'll do the action following the else. |
---|
1721 | We can also group several actions depending on a condition, the following way: |
---|
1722 | |
---|
1723 | if (<condition) |
---|
1724 | { |
---|
1725 | dothis1; |
---|
1726 | dothis2; |
---|
1727 | dothis3; |
---|
1728 | } else { |
---|
1729 | dothat1; |
---|
1730 | dothat2; |
---|
1731 | dothat3; |
---|
1732 | dothat4; |
---|
1733 | } |
---|
1734 | |
---|
1735 | Remember that if you plan to do several actions upon the condition being false, and |
---|
1736 | you forget to use the curlies (the { } ), the second action will be executed regardless |
---|
1737 | the output of the condition, unless of course, you stop the execution of the script if the |
---|
1738 | condition is true (that is, in the first grouping using a return; , and end; or a close; ) |
---|
1739 | |
---|
1740 | Also, you can have multiple conditions nested or chained, and don't worry about limits as to |
---|
1741 | how many nested if you can have, there is no spoon ;) |
---|
1742 | |
---|
1743 | ... |
---|
1744 | if (<condition 1>) |
---|
1745 | dothis; |
---|
1746 | else if (<condition 2>) |
---|
1747 | { |
---|
1748 | dotheother; |
---|
1749 | do that; |
---|
1750 | end; |
---|
1751 | } else |
---|
1752 | do this; |
---|
1753 | ... |
---|
1754 | |
---|
1755 | --------------------------------------- |
---|
1756 | |
---|
1757 | *jump_zero (<condition>),<label>; |
---|
1758 | |
---|
1759 | This command works kinda like an 'if'+'goto' combination in one go. (See 'if'). |
---|
1760 | If the condition is false (equal to zero) this command will immediately jump to |
---|
1761 | the specified label like in 'goto'. |
---|
1762 | |
---|
1763 | While 'if' is more generally useful, for some cases this could be an |
---|
1764 | optimisation. |
---|
1765 | |
---|
1766 | --------------------------------------- |
---|
1767 | |
---|
1768 | *setarray <array name>[<first value>],<value>{,<value>...<value>}; |
---|
1769 | |
---|
1770 | This command will allow you to quickly fill up an array in one go. Check the |
---|
1771 | Kafra scripts in the distribution to see this used a lot. |
---|
1772 | |
---|
1773 | setarray @array[0], 100, 200, 300, 400, 500, 600; |
---|
1774 | |
---|
1775 | First value is the index of the first element of the array to alter. For |
---|
1776 | example: |
---|
1777 | |
---|
1778 | setarray @array[0],200,200,200; |
---|
1779 | setarray @array[1],300,150; |
---|
1780 | |
---|
1781 | will produce: |
---|
1782 | |
---|
1783 | @array[0]=200 |
---|
1784 | @array[1]=300 |
---|
1785 | @array[2]=150 |
---|
1786 | |
---|
1787 | --------------------------------------- |
---|
1788 | |
---|
1789 | *cleararray <array name>[<first value to alter>],<value>,<number of values to set>; |
---|
1790 | |
---|
1791 | This command will change many array values at the same time to the same value. |
---|
1792 | |
---|
1793 | setarray @array[0], 100, 200, 300, 400, 500, 600; |
---|
1794 | // This will make all 6 values 0 |
---|
1795 | cleararray @array[0],0,6; |
---|
1796 | // This will make array element 0 change to 245 |
---|
1797 | cleararray @array[0],245,1; |
---|
1798 | // This will make elements 1 and 2 change to 345 |
---|
1799 | cleararray @array[1],345,2; |
---|
1800 | |
---|
1801 | See 'setarray'. |
---|
1802 | |
---|
1803 | --------------------------------------- |
---|
1804 | |
---|
1805 | *copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>; |
---|
1806 | |
---|
1807 | This command lets you quickly shuffle a lot of data between arrays, which is in |
---|
1808 | some cases invaluable. |
---|
1809 | |
---|
1810 | setarray @array[0], 100, 200, 300, 400, 500, 600; |
---|
1811 | // So we have made @array[] |
---|
1812 | copyarray @array2[0],@array[2],2; |
---|
1813 | |
---|
1814 | // Now, @array2[0] will be equal to @array[2] (300) and |
---|
1815 | // @array2[1] will be equal to @array[3]. |
---|
1816 | |
---|
1817 | So using the examples above: |
---|
1818 | @array[0] = 100 |
---|
1819 | @array[1] = 200 |
---|
1820 | @array[2] = 300 |
---|
1821 | @array[3] = 400 |
---|
1822 | @array[4] = 500 |
---|
1823 | @array[5] = 600 |
---|
1824 | |
---|
1825 | New Array: |
---|
1826 | @array2[0] = 300 |
---|
1827 | @array2[1] = 400 |
---|
1828 | @array2[2] = 0 |
---|
1829 | @array2[3] = 0 |
---|
1830 | |
---|
1831 | Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a |
---|
1832 | 0. |
---|
1833 | |
---|
1834 | --------------------------------------- |
---|
1835 | |
---|
1836 | *deletearray <array name>[<first value>],<how much to delete> |
---|
1837 | |
---|
1838 | This command will delete a specified number of array elements totally from an |
---|
1839 | array, shifting all the elements beyond this towards the beginning. |
---|
1840 | |
---|
1841 | // This will delete array element 0, and move all the other array elements |
---|
1842 | // up one place. |
---|
1843 | deletearray @array[0],1 |
---|
1844 | |
---|
1845 | // This would delete array elements numbered 1, 2 and 3, leave element 0 in its |
---|
1846 | // place, and move the other elements ups, so there are no gaps. |
---|
1847 | |
---|
1848 | deletearray @array[1],3 |
---|
1849 | |
---|
1850 | IMPORTANT: deletarray is horribly broken since the earliest days of jAthena. It |
---|
1851 | tends to merrily remove much more variables than it's told to remove, which |
---|
1852 | makes it pretty much useless for anything other than removing an array from |
---|
1853 | memory entirely. This would be very handy, if it always worked. |
---|
1854 | |
---|
1855 | --------------------------------------- |
---|
1856 | |
---|
1857 | ====================================== |
---|
1858 | |2.- Information-retrieving commands.| |
---|
1859 | ====================================== |
---|
1860 | --------------------------------------- |
---|
1861 | |
---|
1862 | *strcharinfo(<type>) |
---|
1863 | |
---|
1864 | This function will return either the name, party name or guild name for the |
---|
1865 | invoking character. Whatever it returns is determined by type. |
---|
1866 | |
---|
1867 | 0 - Character's name. |
---|
1868 | 1 - The name of the party they're in if any. |
---|
1869 | 2 - The name of the guild they're in if any. |
---|
1870 | |
---|
1871 | If a character is not a member of any party or guild, an empty string will be |
---|
1872 | returned when requesting that information. |
---|
1873 | |
---|
1874 | --------------------------------------- |
---|
1875 | |
---|
1876 | *strnpcinfo(<type>) |
---|
1877 | |
---|
1878 | This function will return the various parts of the name of the calling npc. |
---|
1879 | Whatever it returns is determined by type. |
---|
1880 | |
---|
1881 | 0 - The NPC's display name (visible#hidden) |
---|
1882 | 1 - The visible part of the NPC's display name |
---|
1883 | 2 - The hidden part of the NPC's display name |
---|
1884 | 3 - The NPC's unique name (::name) |
---|
1885 | |
---|
1886 | --------------------------------------- |
---|
1887 | |
---|
1888 | *getarraysize(<array name>) |
---|
1889 | |
---|
1890 | This function returns the number of values that are contained inside the |
---|
1891 | specified array. Notice that zeros and empty strings at the end of this array |
---|
1892 | are not counted towards this number. |
---|
1893 | |
---|
1894 | For example: |
---|
1895 | |
---|
1896 | setarray @array[0], 100, 200, 300, 400, 500, 600; |
---|
1897 | set @arraysize,getarraysize(@array); |
---|
1898 | |
---|
1899 | This will make @arraysize == 6. But if you try this: |
---|
1900 | |
---|
1901 | setarray @array[0], 100, 200, 300, 400, 500, 600, 0; |
---|
1902 | set @arraysize,getarraysize(@array); |
---|
1903 | |
---|
1904 | @arraysize will still equal 6, even though you've set 7 values. |
---|
1905 | |
---|
1906 | --------------------------------------- |
---|
1907 | |
---|
1908 | *getelementofarray(<array name>,<index>) |
---|
1909 | |
---|
1910 | This function will return an array's element when given an index. |
---|
1911 | |
---|
1912 | // This will find the 2nd array value |
---|
1913 | getelementofarray(@array,1) |
---|
1914 | |
---|
1915 | Pretty pointless now when we have |
---|
1916 | |
---|
1917 | @array[1] |
---|
1918 | |
---|
1919 | which has the same effect. |
---|
1920 | |
---|
1921 | --------------------------------------- |
---|
1922 | |
---|
1923 | *readparam(<parameter number>) |
---|
1924 | |
---|
1925 | This function will return the basic stats of an invoking character, referred to |
---|
1926 | by the parameter number. Instead of a number, you can use a parameter name if it |
---|
1927 | is defined in "db/const.txt". |
---|
1928 | |
---|
1929 | For reference, in there these things are defined: |
---|
1930 | |
---|
1931 | StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight, |
---|
1932 | JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp, |
---|
1933 | BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk |
---|
1934 | |
---|
1935 | All of these also behave as variables, but don't expect to be able to just 'set' |
---|
1936 | all of them - some will not work for various internal reasons. |
---|
1937 | |
---|
1938 | // This would return how many status points you haven't spent yet |
---|
1939 | readparam(9) |
---|
1940 | |
---|
1941 | Using this particular information as a function call is not required. Just |
---|
1942 | putting |
---|
1943 | |
---|
1944 | StatusPoint |
---|
1945 | |
---|
1946 | will give you the same result, and some of these parameters work just like |
---|
1947 | variables (i.e. you can 'set Zeny,100' to make the character have 100 zeny, |
---|
1948 | destroying whatever zeny they had before, or 'set Zeny,Zeny+100' to give them |
---|
1949 | 100 zeny) |
---|
1950 | |
---|
1951 | You can also use this command to get stat values: |
---|
1952 | |
---|
1953 | readparam(bVit) |
---|
1954 | if(readparam(bVit)<=77) goto L_End; |
---|
1955 | mes "Only people with over 77 Vit are reading this"; |
---|
1956 | L_End: |
---|
1957 | close; |
---|
1958 | |
---|
1959 | --------------------------------------- |
---|
1960 | |
---|
1961 | *getcharid(<type>{,"<character name>"}) |
---|
1962 | |
---|
1963 | This function will return a unique ID number of the invoking character, or, if a |
---|
1964 | character name is specified, of that character. |
---|
1965 | |
---|
1966 | Type is the kind of associated ID number required: |
---|
1967 | |
---|
1968 | 0 - Character ID number. |
---|
1969 | 1 - Party ID number. |
---|
1970 | 2 - Guild ID number. |
---|
1971 | 3 - Account ID number. |
---|
1972 | |
---|
1973 | For most purposes other than printing it, a number is better to have than a name |
---|
1974 | (people do horrifying things to their character names). |
---|
1975 | |
---|
1976 | If the character is not in a party or not in a guild, the function will return 0 |
---|
1977 | if guild or party number is requested. If a name is specified and the character |
---|
1978 | is not found, 0 is returned. |
---|
1979 | |
---|
1980 | If getcharid(0) returns a zero, the script got called not by a character and |
---|
1981 | doesn't have an attached RID. Note that this will cause the map server to |
---|
1982 | print "player not attached!" error messages, so it is preferred to use |
---|
1983 | "playerattached" to check for the character attached to the script. |
---|
1984 | |
---|
1985 | if( getcharid(2) == 0 ) mes "Only members of a guild are allowed here!"; |
---|
1986 | |
---|
1987 | --------------------------------------- |
---|
1988 | |
---|
1989 | *getchildid() |
---|
1990 | *getmotherid() |
---|
1991 | *getfatherid() |
---|
1992 | |
---|
1993 | These functions return the characters (shild/mother/father) ID |
---|
1994 | |
---|
1995 | if (getmotherid()) mes "Oh... I know your mother's ID:"+getmotherid(); |
---|
1996 | |
---|
1997 | --------------------------------------- |
---|
1998 | |
---|
1999 | *ispartneron() |
---|
2000 | |
---|
2001 | This function returns 1 if the invoking character's marriage partner is |
---|
2002 | currently online and 0 if they are not or if the character has no partner. |
---|
2003 | |
---|
2004 | --------------------------------------- |
---|
2005 | |
---|
2006 | *getpartnerid() |
---|
2007 | |
---|
2008 | This function returns the character ID of the invoking character's marriage |
---|
2009 | partner, if any. If the invoking character is not married, it will return 0, |
---|
2010 | which is a quick way to see if they are married: |
---|
2011 | |
---|
2012 | if (getpartnerid()) mes "I'm not going to be your girlfriend!"; |
---|
2013 | if (getpartnerid()) mes "You're married already!"; |
---|
2014 | |
---|
2015 | --------------------------------------- |
---|
2016 | |
---|
2017 | *getpartyname(<party id>) |
---|
2018 | |
---|
2019 | This function will return the name of a party that has the specified ID number. |
---|
2020 | If there is no such party ID, "null" will be returned. |
---|
2021 | |
---|
2022 | Lets say the ID of a party was saved as a global variable: |
---|
2023 | |
---|
2024 | // This would return the name of the party from the ID stored in a variable |
---|
2025 | mes "You're in the '"+getpartyname($@var)"' party, I know!"; |
---|
2026 | |
---|
2027 | --------------------------------------- |
---|
2028 | |
---|
2029 | *getpartymember <party id>,{<type>}; |
---|
2030 | |
---|
2031 | Thank you to HappyDenn for all this information. |
---|
2032 | |
---|
2033 | This command will find all members of a specified party and returns their names |
---|
2034 | (or character id or account id depending on the value of "type") into an array |
---|
2035 | of temporary global variables. There's actually quite a few commands like this |
---|
2036 | which will fill a special variable with data upon execution and not do anything |
---|
2037 | else. |
---|
2038 | |
---|
2039 | Upon executing this, |
---|
2040 | |
---|
2041 | $@partymembername$[] is a global temporary stringarray which contains all the |
---|
2042 | names of these party members |
---|
2043 | (only set when type is 0 or not specified) |
---|
2044 | |
---|
2045 | $@partymembercid[] is a global temporary number array which contains the |
---|
2046 | character id of these party members. |
---|
2047 | (only set when type is 1) |
---|
2048 | |
---|
2049 | $@partymemberaid[] is a global temporary number array which contains the |
---|
2050 | account id of these party members. |
---|
2051 | (only set when type is 2) |
---|
2052 | |
---|
2053 | $@partymembercount is the number of party members that were found. |
---|
2054 | |
---|
2055 | The party members will (apparently) be found regardless of whether they are |
---|
2056 | online or offline. Note that the names come in no particular order. |
---|
2057 | |
---|
2058 | Be sure to use $@partymembercount to go through this array, and not |
---|
2059 | 'getarraysize', because it is not cleared between runs of 'getpartymember'. If |
---|
2060 | someone with 7 party members invokes this script, the array would have 7 |
---|
2061 | elements. But if another person calls up the NPC, and he has a party of 5, the |
---|
2062 | server will not clear the array for you, overwriting the values instead. So in |
---|
2063 | addition to returning the 5 member names, the 6th and 7th elements from the last |
---|
2064 | call remain, and you will get 5+2 members, of which the last 2 don't belong to |
---|
2065 | the new guy's party. $@partymembercount will always contain the correct number, |
---|
2066 | (5) unlike 'getarraysize()' which will return 7 in this case. |
---|
2067 | |
---|
2068 | Example: |
---|
2069 | |
---|
2070 | // get the character's party ID |
---|
2071 | getpartymember(getcharid(1)); |
---|
2072 | |
---|
2073 | // immediately copy $@partymembercount value to a new variable, since |
---|
2074 | // you don't know when 'getpartymember' will get called again for someone |
---|
2075 | // else's party, overwriting your global array. |
---|
2076 | set @partymembercount,$@partymembercount; |
---|
2077 | |
---|
2078 | // copy $@partymembername array to a new array |
---|
2079 | copyarray @partymembername$[0],$@partymembername$[0],@partymembercount; |
---|
2080 | |
---|
2081 | //list the party members in NPC dialog |
---|
2082 | set @count,0; |
---|
2083 | L_DisplayMember: |
---|
2084 | if(@count == @partymembercount) goto L_DisplayMemberEnd; |
---|
2085 | mes (@count + 1) + ". ^0000FF" + @partymembername$[@count] + "^000000"; |
---|
2086 | set @count,@count+1; |
---|
2087 | goto L_DisplayMember; |
---|
2088 | L_DisplayMemberEnd: |
---|
2089 | close; |
---|
2090 | |
---|
2091 | --------------------------------------- |
---|
2092 | |
---|
2093 | *getpartyleader(<party id>,{<type>}); |
---|
2094 | |
---|
2095 | This function returns some information about the given party-id's leader. |
---|
2096 | When type is ommitted, the default information retrieved is the leader's name. |
---|
2097 | Possible types are: |
---|
2098 | |
---|
2099 | 1: Leader account id |
---|
2100 | 2: Leader character id |
---|
2101 | 3: Leader's class |
---|
2102 | 4: Leader's current map name |
---|
2103 | 5: Leader's current level as stored on the party structure (may not be |
---|
2104 | current level if leader leveled up recently). |
---|
2105 | |
---|
2106 | If retrieval fails (leader not found or party does not exist), this function |
---|
2107 | returns "null" instead of the character name, and -1 for the other types. |
---|
2108 | |
---|
2109 | --------------------------------------- |
---|
2110 | |
---|
2111 | *getlook(<type>) |
---|
2112 | |
---|
2113 | This function will return the number for the currentcharacter look value |
---|
2114 | specified by type. See 'setlook' for valid look types. |
---|
2115 | |
---|
2116 | This can be used to make a certain script behave differently for characters |
---|
2117 | dressed in black. :) |
---|
2118 | |
---|
2119 | --------------------------------------- |
---|
2120 | |
---|
2121 | *getsavepoint(<information type>) |
---|
2122 | |
---|
2123 | This function will return information about the invoking character's save point. |
---|
2124 | You can use it to let a character swap between several recorded savepoints. |
---|
2125 | Available information types are: |
---|
2126 | |
---|
2127 | 0 - Map name (a string) |
---|
2128 | 1 - X coordinate |
---|
2129 | 2 - Y coordinate |
---|
2130 | |
---|
2131 | --------------------------------------- |
---|
2132 | \\ |
---|
2133 | 2,2 Item-related commands |
---|
2134 | \\ |
---|
2135 | --------------------------------------- |
---|
2136 | |
---|
2137 | *getequipid(<equipment slot>) |
---|
2138 | |
---|
2139 | This function returns the item ID of the item equipped in the equipment slot |
---|
2140 | specified on the invoking character. If nothing is equpped there, it returns -1. |
---|
2141 | Valid equipment slots are: |
---|
2142 | |
---|
2143 | EQI_HEAD_TOP (1) - Upper head gear |
---|
2144 | EQI_ARMOR (2) - Armor (Where you keep your Jackets and Robes) |
---|
2145 | EQI_HAND_L (3) - What is in your Left hand. |
---|
2146 | EQI_HAND_R (4) - What is in your Right hand. |
---|
2147 | EQI_GARMENT (5) - The garment slot (Mufflers, Hoods, Manteaus) |
---|
2148 | EQI_SHOES (6) - What foot gear the player has on. |
---|
2149 | EQI_ACC_L (7) - Accessory 1. |
---|
2150 | EQI_ACC_R (8) - Accessory 2. |
---|
2151 | EQI_HEAD_MID (9) - Middle Headgear (masks and glasses) |
---|
2152 | EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks) |
---|
2153 | |
---|
2154 | Notice that a few items occupy several equipment slots, and if the character is |
---|
2155 | wearing such an item, 'getequipid' will return it's ID number for either slot. |
---|
2156 | |
---|
2157 | Can be used to check if you have something equiped, or if you haven't got |
---|
2158 | something equiped: |
---|
2159 | |
---|
2160 | if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara; |
---|
2161 | mes "Come back when you have a Tiara on"; |
---|
2162 | close; |
---|
2163 | L_WearingTiara: |
---|
2164 | mes "What a lovely Tiara you have on"; |
---|
2165 | close; |
---|
2166 | |
---|
2167 | You can also use it to make sure people don't pass a point before removing an |
---|
2168 | item totally from them. Let's say you don't want people to wear Legion Plate |
---|
2169 | armor, but also don't want them to equip if after the check, you would do this: |
---|
2170 | |
---|
2171 | if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate; |
---|
2172 | // the || is used as an or argument, there is 2341 and 2342 cause there are |
---|
2173 | // two different legion plate armors, one with a slot one without. |
---|
2174 | if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate; |
---|
2175 | mes "I will lets you pass"; |
---|
2176 | close2; |
---|
2177 | warp "place",50,50; |
---|
2178 | end; |
---|
2179 | L_EquipedLegionPlate: |
---|
2180 | mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing"; |
---|
2181 | close; |
---|
2182 | L_InventoryLegionPlate: |
---|
2183 | mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing"; |
---|
2184 | close; |
---|
2185 | |
---|
2186 | --------------------------------------- |
---|
2187 | |
---|
2188 | *getequipname(<equpment slot>) |
---|
2189 | |
---|
2190 | This function will return the name of the item equipped in the specified |
---|
2191 | equipment slot on the invoking character. Almost identical to 'getequipid', good |
---|
2192 | for an NPC to state what your are wearing, or maybe saving as a string variable. |
---|
2193 | See 'getequipid' for a full list of valid equipment slots. |
---|
2194 | |
---|
2195 | if (getequipname(EQI_HEAD_TOP)==0) goto L_No_HeadGear; |
---|
2196 | mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head"; |
---|
2197 | close; |
---|
2198 | L_No_HeadGear: |
---|
2199 | mes "You are not wearing any head gear"; |
---|
2200 | close; |
---|
2201 | |
---|
2202 | --------------------------------------- |
---|
2203 | |
---|
2204 | *getitemname(<item id>) |
---|
2205 | |
---|
2206 | Given the database ID number of an item, this function will return the text |
---|
2207 | stored in the 'japanese name' field (which, in eAthena, stores an english name |
---|
2208 | the players would normally see on screen.) |
---|
2209 | |
---|
2210 | --------------------------------------- |
---|
2211 | |
---|
2212 | *getbrokenid(<number>) |
---|
2213 | |
---|
2214 | This function will search the invoking character's inventory for any broken |
---|
2215 | items, and will return their item ID numbers. Since the character may have |
---|
2216 | several broken items, 0 given as an argument will return the first one found, 1 |
---|
2217 | will return the second one, etc. Will return 0 if no such item is found. |
---|
2218 | |
---|
2219 | // Let's see if they have anything broken: |
---|
2220 | if (getbrokenid(0)==0) goto Skip; |
---|
2221 | // They do, so let's print the name of the first broken item: |
---|
2222 | mes "Oh, I see you have a broken "+getitemname(getbrokenid(0))+" here!"; |
---|
2223 | Skip: |
---|
2224 | mes "You don't have anything broken, quit bothering me."; |
---|
2225 | |
---|
2226 | --------------------------------------- |
---|
2227 | |
---|
2228 | *getequipisequiped(<equipment slot>) |
---|
2229 | |
---|
2230 | This functions will return 1 if there is an equipment placed on the specified |
---|
2231 | equipment slot and 0 otherwise. For a list of equipment slots |
---|
2232 | see 'getequipid'. Function originally used by the refining NPCs: |
---|
2233 | |
---|
2234 | if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped; |
---|
2235 | mes "[Refiner]"; |
---|
2236 | mes "Do you want me to refine your dumb head?"; |
---|
2237 | close; |
---|
2238 | L_equipped: |
---|
2239 | mes "[Refiner]"; |
---|
2240 | mes "That's a fine hat you are wearing there..."; |
---|
2241 | close; |
---|
2242 | |
---|
2243 | |
---|
2244 | --------------------------------------- |
---|
2245 | |
---|
2246 | *getequipisenableref(<equipment slot>) |
---|
2247 | |
---|
2248 | Will return 1 if the item equipped on the invoking character in the specified |
---|
2249 | equipment slot is refinable, and 0 if it isn't. For a list of equipment slots |
---|
2250 | see 'getequipid'. |
---|
2251 | |
---|
2252 | if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine; |
---|
2253 | mes "[Refiner]"; |
---|
2254 | mes "I can't refine this hat!..."; |
---|
2255 | close; |
---|
2256 | L_Refine: |
---|
2257 | mes "[Refiner]"; |
---|
2258 | mes "Ok I can refine this"; |
---|
2259 | close; |
---|
2260 | |
---|
2261 | --------------------------------------- |
---|
2262 | |
---|
2263 | *getequiprefinerycnt(<equipment slot>) |
---|
2264 | |
---|
2265 | Returns the current number of plusses for the item in the specified equipment |
---|
2266 | slot. For a list of equipment slots see 'getequipid'. |
---|
2267 | |
---|
2268 | Can be used to check if you have reached a maximum refine value, default for |
---|
2269 | this is +10: |
---|
2270 | |
---|
2271 | if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear; |
---|
2272 | mes "Sorry, it's not possible to refine hats better than +10"; |
---|
2273 | close; |
---|
2274 | L_Refine_HeadGear: |
---|
2275 | mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP); |
---|
2276 | |
---|
2277 | --------------------------------------- |
---|
2278 | |
---|
2279 | *getequipweaponlv(<equipment slot>) |
---|
2280 | |
---|
2281 | This function returns the weapon level for the weapon equipped in the specified |
---|
2282 | equipment slot on the invoking character. For a list of equipment slots see |
---|
2283 | 'getequipid'. |
---|
2284 | |
---|
2285 | Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons |
---|
2286 | have a weapon level. You can, however, probably, use this field for other |
---|
2287 | equippable custom items as a flag or something. |
---|
2288 | If no item is equipped in this slot, or if it doesn't have a weapon level |
---|
2289 | according to the database, 0 will be returned. |
---|
2290 | |
---|
2291 | switch (getequipweaponlv(EQI_HAND_R)) { |
---|
2292 | case 1: mes "You are holding a lvl 1 weapon"; break; |
---|
2293 | case 2: mes "You are holding a lvl 2 weapon"; break; |
---|
2294 | case 3: mes "You are holding a lvl 3 weapon"; break; |
---|
2295 | case 4: mes "You are holding a lvl 4 weapon"; break; |
---|
2296 | case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design"; break; |
---|
2297 | default: mes "Seems you don't have a weapon on"; break; |
---|
2298 | } |
---|
2299 | |
---|
2300 | Or for the left hand, cause it can hold a weapon or a shield: |
---|
2301 | |
---|
2302 | if(getequipid(EQI_HAND_R)==0) goto L_NothingEquiped; |
---|
2303 | switch (getequipweaponlv(EQI_HAND_L)) { |
---|
2304 | case 0: mes "You are holding a shield, so it doesnt have a level"; break; |
---|
2305 | case 1: mes "You are holding a lvl 1 weapon"; break; |
---|
2306 | case 2: mes "You are holding a lvl 2 weapon"; break; |
---|
2307 | case 3: mes "You are holding a lvl 3 weapon"; break; |
---|
2308 | case 4: mes "You are holding a lvl 4 weapon"; break; |
---|
2309 | case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design"; break; |
---|
2310 | } |
---|
2311 | close; |
---|
2312 | L_NothingEquiped: |
---|
2313 | mes "Seems you have nothing equiped"; |
---|
2314 | close; |
---|
2315 | |
---|
2316 | --------------------------------------- |
---|
2317 | |
---|
2318 | *getequippercentrefinery(<equipment slot>) |
---|
2319 | |
---|
2320 | This function calculates and returns the percent value chance to successfully |
---|
2321 | refine the item found in the specified equipment slot of the invoking character |
---|
2322 | by +1. There is no actual formula, the sucess rate for a given weapon level of |
---|
2323 | a certain refine level is found in the db/refine_db.txt file. For a list of |
---|
2324 | equipment slots see 'getequipid'. |
---|
2325 | |
---|
2326 | These values can be displayed for the player to see, or used to calculate the |
---|
2327 | random change of a refine succeeding or failing and then going through with it |
---|
2328 | (which is what the official NPC refinery scripts use it for) |
---|
2329 | |
---|
2330 | // This will find a random number from 0 - 99 and if that is equal to or more |
---|
2331 | // than the value recoverd by this command it will go to L_Fail |
---|
2332 | if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail; |
---|
2333 | |
---|
2334 | --------------------------------------- |
---|
2335 | |
---|
2336 | *getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>) |
---|
2337 | |
---|
2338 | This function will count all the items with the specified ID number lying on the |
---|
2339 | ground on the specified map within the x1/y1-x2/y2 square on it and return that |
---|
2340 | number. |
---|
2341 | |
---|
2342 | This is the only function around where a parameter may be either a string or a |
---|
2343 | number! If it's a number, it means that only the items with that item ID number |
---|
2344 | will be counted. If it is a string, it is assumed to mean the 'english name' |
---|
2345 | field from the item database. If you give it an empty string, or something that |
---|
2346 | isn't found from the item database, it will count items number '512' (apples). |
---|
2347 | |
---|
2348 | --------------------------------------- |
---|
2349 | |
---|
2350 | *getequipcardcnt(<equipment slot>) |
---|
2351 | |
---|
2352 | This function will return the number of cards that have been compounded onto a |
---|
2353 | specific equipped item for the invoking character. See 'getequipid' for a list |
---|
2354 | of possible equipment slots. |
---|
2355 | |
---|
2356 | --------------------------------------- |
---|
2357 | |
---|
2358 | *getinventorylist; |
---|
2359 | |
---|
2360 | This command sets a bunch of arrays with a complete list of whatever the |
---|
2361 | invoking character has in their inventory, including all the data needed to |
---|
2362 | recreate these items perfectly if they are destroyed. Here's what you get: |
---|
2363 | |
---|
2364 | @inventorylist_id[] - array of item ids. |
---|
2365 | @inventorylist_amount[] - their corresponding item amounts. |
---|
2366 | @inventorylist_equip[] - whether the item is equipped or not. |
---|
2367 | @inventorylist_refine[] - for how much it is refined. |
---|
2368 | @inventorylist_identify[] - whether it is identified. |
---|
2369 | @inventorylist_attribute[] - whether it is broken. |
---|
2370 | @inventorylist_card1[] - These four arrays contain card data for the items. |
---|
2371 | @inventorylist_card2[] These data slots are also used to store names |
---|
2372 | @inventorylist_card3[] inscribed on the items, so you can explicitly check |
---|
2373 | @inventorylist_card4[] if the character owns an item made by a specific |
---|
2374 | craftsman. |
---|
2375 | @inventorylist_count - the number of items in these lists. |
---|
2376 | |
---|
2377 | This could be handy to save/restore a character's inventory, since no other |
---|
2378 | command returns such a complete set of data, and could also be the only way to |
---|
2379 | correctly handle an NPC trader for carded and named items who could resell them |
---|
2380 | - since NPC objects cannot own items, so they have to store item data in |
---|
2381 | variables and recreate the items. |
---|
2382 | |
---|
2383 | Notice that the variables this command generates are all local and numeric. |
---|
2384 | |
---|
2385 | --------------------------------------- |
---|
2386 | |
---|
2387 | *cardscnt() |
---|
2388 | |
---|
2389 | This function will return the number of cards inserted into the weapon currently |
---|
2390 | equipped on the invoking character. |
---|
2391 | While this function was meant for item scripts, it will work outside them: |
---|
2392 | |
---|
2393 | if (cardscnt()==4) mes "So you've stuck four cards into that weapon, think you're cool now?"; |
---|
2394 | |
---|
2395 | --------------------------------------- |
---|
2396 | |
---|
2397 | *getrefine() |
---|
2398 | |
---|
2399 | This function will return the number of plusses the weapon currently equipped on |
---|
2400 | the invoking character has been refined for. |
---|
2401 | While this function was meant for item scripts, it will work outside them: |
---|
2402 | |
---|
2403 | if (getrefine()==10) mes "Wow. That's a murder weapon."; |
---|
2404 | |
---|
2405 | --------------------------------------- |
---|
2406 | |
---|
2407 | *getnameditem(<item id>,"<name to inscribe>"); |
---|
2408 | *getnameditem("<item name>","<name to inscribe>"); |
---|
2409 | |
---|
2410 | This function is equivalent to using 'getitem', however, it will not just give |
---|
2411 | the character an item object, but will also inscribe it with a specified |
---|
2412 | character's name. You may not inscribe items with arbitrary strings, only with |
---|
2413 | names of characters that actually exist. While this isn't said anywhere |
---|
2414 | specifically, apparently, named items may not have cards in them, slots or no - |
---|
2415 | these data slots are taken by the character ID who's name is inscribed. Only one |
---|
2416 | remains free and it's not quite clear if a card may be there. |
---|
2417 | |
---|
2418 | This function will return 1 if an item was successfully created and 0 if it |
---|
2419 | wasn't for whatever reason. Like 'getitem', this function will also accept an |
---|
2420 | 'english name' from the item database as an item name and will return 0 if no |
---|
2421 | such item exists. |
---|
2422 | |
---|
2423 | --------------------------------------- |
---|
2424 | |
---|
2425 | *getitemslots(<item ID>) |
---|
2426 | |
---|
2427 | This function will look up the item with the specified ID number in the database |
---|
2428 | and return the number of slots this kind of items has - 0 if they are not |
---|
2429 | slotted. It will also be 0 for all non-equippable items, naturally, unless |
---|
2430 | someone messed up the item database. It will return -1 if there is no such item. |
---|
2431 | |
---|
2432 | --------------------------------------- |
---|
2433 | |
---|
2434 | *getiteminfo(<item ID>,<type>) |
---|
2435 | |
---|
2436 | This function will look up the item with the specified ID number in the database |
---|
2437 | and return the info set by TYPE argument. |
---|
2438 | It will return -1 if there is no such item. |
---|
2439 | |
---|
2440 | Valid types are: |
---|
2441 | 0 - Buy Price; 1 - Sell Price; 2 - Item Type; |
---|
2442 | 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc.. |
---|
2443 | if = 0, then monsters don't drop it at all (rare or a quest item) |
---|
2444 | if = 10000, then this item is sold in NPC shops only |
---|
2445 | 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range; |
---|
2446 | 10 - slot; 11 - look; 12 - elv; 13 - wlv; |
---|
2447 | |
---|
2448 | Check sample in nps\sample\getiteminfo.txt |
---|
2449 | |
---|
2450 | --------------------------------------- |
---|
2451 | |
---|
2452 | *getequipcardid (<equipment slot>,<card slot>); |
---|
2453 | |
---|
2454 | Returns value from equipped item slot in the indicated slot: |
---|
2455 | |
---|
2456 | getequipcardid(num,slot) |
---|
2457 | |
---|
2458 | where: |
---|
2459 | num = equip position slot |
---|
2460 | slot = 0,1,2,3 (Card Slot N) |
---|
2461 | |
---|
2462 | This func returns CARD ID, 255,254,-255 (for card 0, if the item is produced) it's useful |
---|
2463 | when you want to check item cards or if it's signed. Useful for such quests as |
---|
2464 | "Sign this refined item with players name" etc; |
---|
2465 | Hat[0] +4 -> Player's Hat[0] +4 |
---|
2466 | |
---|
2467 | -------------------------------------- |
---|
2468 | |
---|
2469 | *getitemslots (<item id>); |
---|
2470 | |
---|
2471 | Returns the amount of slots the item has. |
---|
2472 | |
---|
2473 | Example(s): |
---|
2474 | |
---|
2475 | //@slots now has the amount of slots of the item with ID 1205. |
---|
2476 | set @slots, getItemSlots(1205); |
---|
2477 | |
---|
2478 | -------------------------------------- |
---|
2479 | // |
---|
2480 | 2,1.- End of item-related commands. |
---|
2481 | // |
---|
2482 | --------------------------------------- |
---|
2483 | |
---|
2484 | *getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"}) |
---|
2485 | |
---|
2486 | This function will locate a character object, NPC object or pet's coordinates |
---|
2487 | and place their coordinates into the variables specified when calling it. It |
---|
2488 | will return 0 if the search was successful, and -1 if the parameters given were |
---|
2489 | not variables or the search was not successful. |
---|
2490 | |
---|
2491 | Type is the type of object to search for: |
---|
2492 | |
---|
2493 | 0 - Character object |
---|
2494 | 1 - NPC object |
---|
2495 | 2 - Pet object |
---|
2496 | 3 - Monster object. |
---|
2497 | |
---|
2498 | While 3 is meant to look for a monster object, no searching will be done if you |
---|
2499 | specify type 3, and the function will always return -1. |
---|
2500 | |
---|
2501 | The search string is optional. If it is not specified, the location of the |
---|
2502 | invoking character will always be returned for types 0 and 2, the location of |
---|
2503 | the NPC running this function for type 1. |
---|
2504 | If a search string is specified, for types 0 and 1, the character or NPC with |
---|
2505 | the specified name will be located. If type is 3, the search will locate the |
---|
2506 | current pet of the character who's name is given in the search string, it will |
---|
2507 | NOT locate a pet by name. |
---|
2508 | |
---|
2509 | What a mess. Example, a working and tested one now: |
---|
2510 | |
---|
2511 | prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{ |
---|
2512 | mes "My name is Meh. I'm here so that Nyah can find me."; |
---|
2513 | close; |
---|
2514 | } |
---|
2515 | |
---|
2516 | prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{ |
---|
2517 | mes "My name is Nyah."; |
---|
2518 | mes "I will now search for Meh all across the world!"; |
---|
2519 | if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) goto Notfound; |
---|
2520 | mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !"; |
---|
2521 | close; |
---|
2522 | Notfound: |
---|
2523 | mes "I can't seem to find Meh anywhere!"; |
---|
2524 | close; |
---|
2525 | } |
---|
2526 | |
---|
2527 | Notice that NPC objects disabled with 'disablenpc' will still be located. |
---|
2528 | |
---|
2529 | --------------------------------------- |
---|
2530 | |
---|
2531 | *getgmlevel() |
---|
2532 | |
---|
2533 | This function will return the GM level of the account to which the invoking |
---|
2534 | character belongs. If this is somehow executed from a console command, 99 will |
---|
2535 | be returned, and 0 will be returned if the account has no GM level. |
---|
2536 | |
---|
2537 | This allows you to make NPC's only accessable for certain GM levels, or behave |
---|
2538 | specially when talked to by GMs. |
---|
2539 | |
---|
2540 | if (getgmlevel()) mes "What is your command, your godhood?"; |
---|
2541 | if (getgmlevel()) goto Wherever; |
---|
2542 | |
---|
2543 | --------------------------------------- |
---|
2544 | |
---|
2545 | *gettimetick(<tick type>) |
---|
2546 | |
---|
2547 | This function will return the system time in UNIX epoch time (if tick type is 2) |
---|
2548 | or the time since the start of the current day in seconds if tick type is 1. |
---|
2549 | Passing 0 will make it return the server's tick, which is a measurement in |
---|
2550 | milliseconds used by the server's timer system. The server's tick is an |
---|
2551 | unsigned int which loops every ~50 days. |
---|
2552 | |
---|
2553 | Just in case you don't know, UNIX epoch time is the number of seconds elapsed |
---|
2554 | since 1st of January 1970, and is useful to see, for example, for how long the |
---|
2555 | character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow |
---|
2556 | you to make an 'online time counted for conviction only' jail script. |
---|
2557 | |
---|
2558 | --------------------------------------- |
---|
2559 | |
---|
2560 | *gettime(<type>) |
---|
2561 | |
---|
2562 | This function will return specified information about the current system time. |
---|
2563 | |
---|
2564 | 1 - Seconds (of a minute) |
---|
2565 | 2 - Minutes (of an hour) |
---|
2566 | 3 - Hour (of a day) |
---|
2567 | 4 - Week day (0 for Sunday, 6 is Saturday) |
---|
2568 | 5 - Day of the month. |
---|
2569 | 6 - Number of the month. |
---|
2570 | 7 - Year. |
---|
2571 | 8 - Day of the year. |
---|
2572 | |
---|
2573 | It will only return numbers. |
---|
2574 | |
---|
2575 | if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays."; |
---|
2576 | |
---|
2577 | --------------------------------------- |
---|
2578 | |
---|
2579 | *gettimestr(<format string>,<max length>) |
---|
2580 | |
---|
2581 | This function will return a string containing time data as specified by the |
---|
2582 | format string. |
---|
2583 | |
---|
2584 | This uses the C function 'strfmtime', which obeys special format characters. For |
---|
2585 | a full description see, for example, the description of 'strfmtime' at |
---|
2586 | http://www.delorie.com/gnu/docs/glibc/libc_437.html |
---|
2587 | All the format characters given in there should properly work. |
---|
2588 | Max length is the maximum length of a time string to generate. |
---|
2589 | |
---|
2590 | The example given in eAthena sample scripts works like this: |
---|
2591 | |
---|
2592 | mes gettimestr("%Y-%m/%d %H:%M:%S",21); |
---|
2593 | |
---|
2594 | This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'. |
---|
2595 | |
---|
2596 | --------------------------------------- |
---|
2597 | |
---|
2598 | *getusers(<type>) |
---|
2599 | |
---|
2600 | This function will return a number of users on a map or the whole server. What |
---|
2601 | it returns is specified by Type. |
---|
2602 | |
---|
2603 | Type is a bitmask, add up to get the effects you want: |
---|
2604 | |
---|
2605 | 8 - This will count all characters on the same map as the current NPC. |
---|
2606 | (By default, it will count people on the same map as the character) |
---|
2607 | 7 - Return the amount of players for the entire server. |
---|
2608 | (By default, only the players on the map will be counted.) |
---|
2609 | |
---|
2610 | So 'getusers(0)' will return the number of characters on the same map as the |
---|
2611 | invoking character, while 'getusers(7)' will give the count for entire server. |
---|
2612 | |
---|
2613 | --------------------------------------- |
---|
2614 | |
---|
2615 | *getmapusers("<map name>") |
---|
2616 | |
---|
2617 | This function will return the number of users currently located on the specified |
---|
2618 | map. |
---|
2619 | |
---|
2620 | Currently being used in the PVP scripts to check if a PVP room is full of not, |
---|
2621 | if the number returned it equal to the maximum allowed it will not let you |
---|
2622 | enter. |
---|
2623 | |
---|
2624 | --------------------------------------- |
---|
2625 | |
---|
2626 | *getareausers("<map name>",<x1>,<y1>,<x2>,<y2>) |
---|
2627 | |
---|
2628 | This function will return the count of connected characters which are located |
---|
2629 | within the specified area - an x1/y1-x2/y2 square on the specified map. |
---|
2630 | |
---|
2631 | This is useful for maps that are split into many buildings, such as all the |
---|
2632 | "*_in" maps, due to all the shops and houses. |
---|
2633 | |
---|
2634 | --------------------------------------- |
---|
2635 | |
---|
2636 | *getusersname; |
---|
2637 | |
---|
2638 | This command will give the invoking character a list of names of the connected |
---|
2639 | characters (including themselves) into an NPC script message window (see 'mes') |
---|
2640 | paging it by 10 names as if with the 'next' command. |
---|
2641 | |
---|
2642 | You need to put a 'close' after that yourself. |
---|
2643 | |
---|
2644 | --------------------------------------- |
---|
2645 | \\ |
---|
2646 | 2,2.- Guild-related commands |
---|
2647 | \\ |
---|
2648 | --------------------------------------- |
---|
2649 | *getguildname(<guild id>) |
---|
2650 | |
---|
2651 | This function returns a guild's name given an ID number. If there is no such |
---|
2652 | guild, "null" will be returned; |
---|
2653 | |
---|
2654 | // Would print what ever guild 10007 is, in my case this would return "AlcoROhics" |
---|
2655 | mes "The guild "+GetGuildName(10007)+" are all nice people."; |
---|
2656 | |
---|
2657 | // This will do the same as above: |
---|
2658 | set @var,10007; |
---|
2659 | mes "We have some friends in "+GetGuildName(@var)+", you know."; |
---|
2660 | |
---|
2661 | This is used all over the WoE controlling scripts. You could also use it for a |
---|
2662 | guild-based event. |
---|
2663 | |
---|
2664 | --------------------------------------- |
---|
2665 | |
---|
2666 | *getguildmaster(<guild id>) |
---|
2667 | |
---|
2668 | This function return the name of the master of the guild which has the specified |
---|
2669 | ID number. If there is no such guild, "null" will be returned. |
---|
2670 | |
---|
2671 | // Would return the guild master of guild 10007, whatever that might be. |
---|
2672 | // In this example it would return "MissDjax" cause she owns "AlcoROhics" (10007) |
---|
2673 | mes getguildmaster(10007)+" runs "+getguildname(10007); |
---|
2674 | |
---|
2675 | Can be used to check if the character is the guildmaster of the specified guild. |
---|
2676 | |
---|
2677 | Maybe you want to make a room only guildmasters can enter: |
---|
2678 | |
---|
2679 | set @GID,getcharid(2); |
---|
2680 | if(@GID==0) goto L_NoGuild; |
---|
2681 | if(strcharinfo(0)==getguildmaster(@GID)) goto L_GuildMaster; |
---|
2682 | mes "Sorry you don't own the guild you are in"; |
---|
2683 | close; |
---|
2684 | L_NoGuild: |
---|
2685 | mes "Sorry you are not in a guild"; |
---|
2686 | close; |
---|
2687 | L_GuildMaster: |
---|
2688 | mes "Welcome guild master of "+GetGuildName(@GID); |
---|
2689 | close; |
---|
2690 | |
---|
2691 | |
---|
2692 | --------------------------------------- |
---|
2693 | |
---|
2694 | *getguildmasterid(<guild id>) |
---|
2695 | |
---|
2696 | This function will return the character ID number of the guildmaster of the |
---|
2697 | guild specified by the ID. 0 if the character is not a guildmaster of any guild. |
---|
2698 | |
---|
2699 | --------------------------------------- |
---|
2700 | |
---|
2701 | *getcastlename("<map name>") |
---|
2702 | |
---|
2703 | This function returns the name of the castle when given the map name for that |
---|
2704 | castle. The data is read from 'db/castle_db.txt'. |
---|
2705 | |
---|
2706 | --------------------------------------- |
---|
2707 | |
---|
2708 | *getcastledata("<map name>",<type of data>) |
---|
2709 | *setcastledata "<map name>",<type of data>,<value>; |
---|
2710 | |
---|
2711 | This function returns the castle ownership information for the castle referred |
---|
2712 | to by it's map name. Castle information stored in 'save\castle.txt' for the TXT |
---|
2713 | version of the server and in 'guild_castle' table for the SQL version. |
---|
2714 | |
---|
2715 | Valid types of data are: |
---|
2716 | |
---|
2717 | 0 - Will make the map server request the castle data from the char server, and |
---|
2718 | always return 0. This, apparently, will also cause indirectly the execution |
---|
2719 | of an 'OnAgitInit:' event mentioned at the beginning of this document. |
---|
2720 | 1 - Guild ID |
---|
2721 | 2 - Castle Economy score. |
---|
2722 | 3 - Castle Defence score. |
---|
2723 | 4 - Number of times the economy was invested in today. |
---|
2724 | 5 - Number of times the defence was invested in today. |
---|
2725 | 9 - Will return 1 if a Kafra was hired for this castle, 0 otherwise. |
---|
2726 | 10 - Is 1 if the 1st guardian is present (Soldier Guardian) |
---|
2727 | 11 - Is 1 if the 2nd guardian is present (Soldier Guardian) |
---|
2728 | 12 - Is 1 if the 3rd guardian is present (Soldier Guardian) |
---|
2729 | 13 - Is 1 if the 4th guardian is present (Archer Guardian) |
---|
2730 | 14 - Is 1 if the 5th guardian is present (Archer Guardian) |
---|
2731 | 15 - Is 1 if the 6th guardian is present (Knight Guardian) |
---|
2732 | 16 - Is 1 if the 7th guardian is present (Knight Guardian) |
---|
2733 | 17 - Is 1 if the 8th guardian is present (Knight Guardian) |
---|
2734 | |
---|
2735 | 18-25 types of data will return current hit point values for guardians 1-8 |
---|
2736 | respectively. |
---|
2737 | |
---|
2738 | The 'setcastledata' command will behave identically, but instead of returning |
---|
2739 | values for the specified types of accessible data, it will alter them and cause |
---|
2740 | them to be sent to the char server for storage. Data type of 0 won't do |
---|
2741 | anything, obviously. |
---|
2742 | |
---|
2743 | --------------------------------------- |
---|
2744 | |
---|
2745 | *getgdskilllv(<guild id>,<skill id>) |
---|
2746 | *getgdskilllv(<guild id>,"<skill name>") |
---|
2747 | |
---|
2748 | This function returns the level of the skill <skill id> of the guild <guild id>. |
---|
2749 | If the guild does not have that skill, 0 is returned. |
---|
2750 | If the guild does not exist, -1 is returned. |
---|
2751 | Refer to 'db/skill_db.txt' for the full list of skills. (GD_* are guild skills) |
---|
2752 | |
---|
2753 | --------------------------------------- |
---|
2754 | |
---|
2755 | *requestguildinfo <guild id>,"<event label>"; |
---|
2756 | |
---|
2757 | This command requests the guild data from the char server and merrily continues |
---|
2758 | with the execution. Whenever the guild information becomes available (which |
---|
2759 | happens instantly if the guild information is already in memory, or later, if it |
---|
2760 | isn't and the map server has to wait for the char server to reply) it will run |
---|
2761 | the specified event as in a 'doevent' call. |
---|
2762 | |
---|
2763 | --------------------------------------- |
---|
2764 | |
---|
2765 | *getmapguildusers <mapname>,<guild id>; |
---|
2766 | |
---|
2767 | Returns the amount of persons from the given guild that are on the given map. |
---|
2768 | Example(s): |
---|
2769 | |
---|
2770 | //Will set the @persons variable to the amount of persons from the guild |
---|
2771 | //which ID's = 10 and are at prontera. |
---|
2772 | |
---|
2773 | set @persons,getMapGuildUsers "prontera",10; |
---|
2774 | |
---|
2775 | --------------------------------------- |
---|
2776 | // |
---|
2777 | 2,2.- End of guild-related commands |
---|
2778 | // |
---|
2779 | --------------------------------------- |
---|
2780 | |
---|
2781 | *getskilllv(<skill id>) |
---|
2782 | *getskilllv("<skill name>") |
---|
2783 | |
---|
2784 | This function returns the level of the specified skill that the invoking |
---|
2785 | character has. If they don't have the skill, 0 will be returned. The full list |
---|
2786 | of character skills is available in 'db/skill_db.txt'. |
---|
2787 | |
---|
2788 | There are two main uses for this function, it can check whether the character |
---|
2789 | has a skill or not, and it can tell you if the level is high enough. |
---|
2790 | |
---|
2791 | Example 1: |
---|
2792 | |
---|
2793 | f (getskilllv(152)) goto L_HasSkillThrowStone; |
---|
2794 | mes "You don't have Throw Stone"; |
---|
2795 | close; |
---|
2796 | L_HasSkillThrowStone: |
---|
2797 | mes "You have got the skill Throw Stone"; |
---|
2798 | close; |
---|
2799 | |
---|
2800 | Example 2: |
---|
2801 | |
---|
2802 | if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore; |
---|
2803 | if (getskilllv(28) == 10) goto L_HasSkillHealMaxed; |
---|
2804 | mes "You heal skill is below lvl 5"; |
---|
2805 | close; |
---|
2806 | L_HasSkillHeallvl6orMore: |
---|
2807 | mes "Your heal lvl is 5 or more"; |
---|
2808 | close; |
---|
2809 | L_HasSkillHealMaxed: |
---|
2810 | mes "Your heal lvl has been maxed"; |
---|
2811 | close; |
---|
2812 | |
---|
2813 | --------------------------------------- |
---|
2814 | |
---|
2815 | *getskilllist; |
---|
2816 | |
---|
2817 | This command sets a bunch of arrays with a complete list of skills the |
---|
2818 | invoking character has. Here's what you get: |
---|
2819 | |
---|
2820 | @skilllist_id[] - skill ids. |
---|
2821 | @skilllist_lv[] - skill levels. |
---|
2822 | @skilllist_flag[] - see 'skill' for the meaning of skill flags. |
---|
2823 | @skilllist_count - number of skills in the above arrays. |
---|
2824 | |
---|
2825 | While 'getskillv' is probably more useful for most situations, this is the |
---|
2826 | easiest way to store all the skills and make the character something else for a |
---|
2827 | while. Advanced job for a day? :) This could also be useful to see how many |
---|
2828 | skills a character has. |
---|
2829 | |
---|
2830 | --------------------------------------- |
---|
2831 | |
---|
2832 | *getpetinfo(<type>) |
---|
2833 | |
---|
2834 | This function will return pet information for the pet the invoking character |
---|
2835 | currently has active. Valid types are: |
---|
2836 | |
---|
2837 | 0 - Unique pet ID number as stored by the char server and distinguishing it |
---|
2838 | from all other pets the characters actually have. This value is currently |
---|
2839 | useless, at most you can use it to tell pets apart reliably. |
---|
2840 | 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it |
---|
2841 | is. |
---|
2842 | 2 - Pet name. Will return "null" if there's no pet. |
---|
2843 | 3 - Pet friendly level (intimacy score). 1000 is full loyalty. |
---|
2844 | 4 - Pet hungry level. 100 is completely full. |
---|
2845 | 5 - Pet rename flag. 0 means this pet has not been named yet. |
---|
2846 | --------------------------------------- |
---|
2847 | |
---|
2848 | *gethominfo(<type>) |
---|
2849 | |
---|
2850 | This function works as a direct counterpart of 'getpetinfo': |
---|
2851 | 0 - Homunculus unique ID |
---|
2852 | 1 - Homunculus Class |
---|
2853 | 2 - Name |
---|
2854 | 3 - Friendly level (intimacy score). 100000 is full loyalty. |
---|
2855 | 4 - Hungry level. 100 is completely full. |
---|
2856 | 5 - Rename flag. 0 means this homunculus has not been named yet. |
---|
2857 | 6 - Homunculus level |
---|
2858 | --------------------------------------- |
---|
2859 | |
---|
2860 | |
---|
2861 | *petstat(<flag>) |
---|
2862 | |
---|
2863 | Returns current pet status, all are integers except name. |
---|
2864 | Returns 0 or "" if the player doesn't have pets. |
---|
2865 | |
---|
2866 | Flags usable >> |
---|
2867 | PET_CLASS |
---|
2868 | PET_NAME |
---|
2869 | PET_LEVEL |
---|
2870 | PET_HUNGRY |
---|
2871 | PET_INTIMATE |
---|
2872 | |
---|
2873 | Example: |
---|
2874 | set @i, petstat(PET_CLASS); |
---|
2875 | |
---|
2876 | |
---|
2877 | --------------------------------------- |
---|
2878 | |
---|
2879 | *getmonsterinfo(<mob ID>,<type>) |
---|
2880 | |
---|
2881 | This function will look up the monster with the specified ID number in the |
---|
2882 | mob database and return the info set by TYPE argument. |
---|
2883 | It will return -1 if there is no such monster (or the type value is invalid), |
---|
2884 | or "null" if you requested the monster's name. |
---|
2885 | |
---|
2886 | Valid types are listed in const.txt: |
---|
2887 | MOB_NAME 0 MOB_LV 1 |
---|
2888 | MOB_MAXHP 2 MOB_BASEEXP 3 |
---|
2889 | MOB_JOBEXP 4 MOB_ATK1 5 |
---|
2890 | MOB_ATK2 6 MOB_DEF 7 |
---|
2891 | MOB_MDEF 8 MOB_STR 9 |
---|
2892 | MOB_AGI 10 MOB_VIT 11 |
---|
2893 | MOB_INT 12 JOB_DEX 13 |
---|
2894 | MOB_LUK 14 MOB_RANGE 15 |
---|
2895 | MOB_RANGE2 16 MOB_RANGE3 17 |
---|
2896 | MOB_SIZE 18 MOB_RACE 19 |
---|
2897 | MOB_ELEMENT 20 MOB_MODE 21 |
---|
2898 | |
---|
2899 | Check sample in nps\sample\getmonsterinfo.txt |
---|
2900 | |
---|
2901 | --------------------------------------- |
---|
2902 | |
---|
2903 | *getmapmobs("<map name>") |
---|
2904 | |
---|
2905 | This function will return the total count of monsters currently located on the |
---|
2906 | specified map. If the map name is given as "this", the map the invoking |
---|
2907 | character is on will be used. If the map is not found, or the invoker is not a |
---|
2908 | character while the map is "this", it will return -1. |
---|
2909 | |
---|
2910 | --------------------------------------- |
---|
2911 | |
---|
2912 | *getstrlen("<string>") |
---|
2913 | |
---|
2914 | This function will return the length of the string given as an argument. It is |
---|
2915 | useful to check if anything input by the player exceeds name length limits and |
---|
2916 | other length limits and asking them to try to input something else. |
---|
2917 | |
---|
2918 | --------------------------------------- |
---|
2919 | |
---|
2920 | *skillpointcount; |
---|
2921 | |
---|
2922 | Returns the total amount of skill points a character posesses (SkillPoint+SP's used in skills) |
---|
2923 | This command can be used to check the currently attached characters total amount of skillpoints. |
---|
2924 | This means the skillpoints used in skill are counted, and added to SkillPoints (number of skill points not used). |
---|
2925 | |
---|
2926 | Example: |
---|
2927 | |
---|
2928 | //This will set the temp character variable @skillPoints to the amount of skillpoints, |
---|
2929 | //and then tell the player the value. |
---|
2930 | set @skillPoints, skillPointCount(); |
---|
2931 | mes "You have "+@skillPoints+" skillpoints in total!"; |
---|
2932 | |
---|
2933 | //Self-explanatory... :P |
---|
2934 | if (skillPointCount() > 20) |
---|
2935 | mes "Wow, you have more then 20 Skill Points in total!"; |
---|
2936 | |
---|
2937 | --------------------------------------- |
---|
2938 | |
---|
2939 | *getscrate(<effect type>,<base rate>{,<target ID number>}) |
---|
2940 | |
---|
2941 | This function will return the chance of a status effect affecting the invoking |
---|
2942 | character, in percent, modified by the their current defense against said |
---|
2943 | status. The 'base rate' is the base chance of the status effect being inflicted, |
---|
2944 | in percent. |
---|
2945 | |
---|
2946 | if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow; |
---|
2947 | |
---|
2948 | You can see the full list of available effect types you can possibly inflict in |
---|
2949 | 'db/const.txt' under 'Eff_'. |
---|
2950 | |
---|
2951 | It is pretty certain that addressing the target by an ID number will not |
---|
2952 | currently work due to a bug. |
---|
2953 | |
---|
2954 | --------------------------------------- |
---|
2955 | |
---|
2956 | ======================== |
---|
2957 | |3.- Checking commands.| |
---|
2958 | ======================== |
---|
2959 | ------------------------- |
---|
2960 | |
---|
2961 | *playerattached; |
---|
2962 | |
---|
2963 | Returns the ID of the player currently attached to the script. It will return |
---|
2964 | 0 if noone is attached, or if the attached player no longer exists on the map |
---|
2965 | server. It is wise to check for the attached player in script functions that |
---|
2966 | deal with timers as there's no guarantee the player will still be logged on |
---|
2967 | when the timer triggers. Note that the ID of a player is actually their |
---|
2968 | account ID. |
---|
2969 | |
---|
2970 | ------------------------- |
---|
2971 | |
---|
2972 | *isloggedin(<account id>{,<char id>}); |
---|
2973 | |
---|
2974 | This function returns 1 if the specified account is logged in and 0 if they |
---|
2975 | aren't. You can also pass the char_id to check for both account and char id. |
---|
2976 | |
---|
2977 | --------------------------------------- |
---|
2978 | |
---|
2979 | *checkweight(<item id>,<amount>) |
---|
2980 | *checkweight("<item name>",<amount>) |
---|
2981 | |
---|
2982 | This function will compute and return 1 if the total weight of a specified |
---|
2983 | number of specific items does not exceed the invoking character's carrying |
---|
2984 | capacity, and 0 otherwise. It is important to see if a player can carry the |
---|
2985 | items you expect to give them, failing to do that may open your script up to |
---|
2986 | abuse or create some very unfair errors. |
---|
2987 | |
---|
2988 | This function, in addition to checking to see if the player is capable of |
---|
2989 | holding a set amount of items, also ensures the player has room in their |
---|
2990 | inventory for the item(s) they will be receciving. |
---|
2991 | |
---|
2992 | Like 'getitem', this function will also accept an 'english name' from the |
---|
2993 | database as an argument. |
---|
2994 | |
---|
2995 | checkweight(502,10) // 10 apples |
---|
2996 | |
---|
2997 | if (checkweight(502,10) == 0 ) goto L_OverWeight; |
---|
2998 | getitem 502,10; |
---|
2999 | close; |
---|
3000 | L_OverWeight: |
---|
3001 | mes "Sorry you cannot hold this ammount of apples"; |
---|
3002 | close; |
---|
3003 | |
---|
3004 | Or to put this another way: |
---|
3005 | |
---|
3006 | if (checkweight("APPLE",10)) goto L_Getapples; |
---|
3007 | mes "Sorry you cannot hold this ammount of apples"; |
---|
3008 | close; |
---|
3009 | L_Getapples: |
---|
3010 | getitem 502,10; |
---|
3011 | close; |
---|
3012 | |
---|
3013 | Both these examples have the same effect. |
---|
3014 | |
---|
3015 | --------------------------------------- |
---|
3016 | |
---|
3017 | *basicskillcheck() |
---|
3018 | |
---|
3019 | This function will return the state of the configuration option |
---|
3020 | 'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is |
---|
3021 | enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which |
---|
3022 | it is by default, characters must have a certain number of basic skill levels to |
---|
3023 | sit, request a trade, use emoticons, etc. Making your script behave differently |
---|
3024 | depending on whether the characters must actually have the skill to do all these |
---|
3025 | things might in some cases be required. |
---|
3026 | |
---|
3027 | --------------------------------------- |
---|
3028 | |
---|
3029 | *checkoption(<option number>) |
---|
3030 | *checkoption1(<option number>) |
---|
3031 | *checkoption2(<option number>) |
---|
3032 | *setoption <option number>{,<flag>}; |
---|
3033 | |
---|
3034 | The 'setoption' series of functions check for a so-called option that is set on |
---|
3035 | the invoking character. 'Options' are used to store status conditions and a lot |
---|
3036 | of other non-permanent character data of the yes-no kind. For most common cases, |
---|
3037 | it is better to use 'checkcart','checkfalcon','checkpeco' and other similar |
---|
3038 | functions, but there are some options which you cannot get at this way. They |
---|
3039 | return 1 if the option is set and 0 if the option is not set. |
---|
3040 | |
---|
3041 | Option numbers valid for the first (option) version of this command are: |
---|
3042 | |
---|
3043 | 0x1 - Sight in effect. |
---|
3044 | 0x2 - Hide in effect. |
---|
3045 | 0x4 - Cloaking in effect. |
---|
3046 | 0x8 - Cart number 1 present. |
---|
3047 | 0x10 - Falcon present. |
---|
3048 | 0x20 - Peco Peco present. |
---|
3049 | 0x40 - GM Perfect Hide in effect. |
---|
3050 | 0x80 - Cart number 2 present. |
---|
3051 | 0x100 - Cart number 3 present. |
---|
3052 | 0x200 - Cart number 4 present. |
---|
3053 | 0x400 - Cart number 5 present. |
---|
3054 | 0x800 - Orc head present. |
---|
3055 | 0x1000 - The character is wearing a wedding sprite. |
---|
3056 | 0x2000 - Ruwach is in effect. |
---|
3057 | 0x4000 - Chasewalk in effect. |
---|
3058 | 0x8000 - Flying or Xmas suit. |
---|
3059 | 0x10000 - Sighttrasher. |
---|
3060 | |
---|
3061 | Option numbers valid for the second version (opt1) of this command are: |
---|
3062 | |
---|
3063 | 1 - Petrified. |
---|
3064 | 2 - Frozen. |
---|
3065 | 3 - Stunned. |
---|
3066 | 4 - Sleeping. |
---|
3067 | 6 - Petrifying (the state where you can still walk) |
---|
3068 | |
---|
3069 | Option numbers valid for the third version (opt2) of this command are: |
---|
3070 | |
---|
3071 | 0x1 - Poisoned. |
---|
3072 | 0x2 - Cursed. |
---|
3073 | 0x4 - Silenced. |
---|
3074 | 0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed) |
---|
3075 | 0x10 - Blinded. |
---|
3076 | 0x80 - Deadly poisoned. |
---|
3077 | |
---|
3078 | Option numbers (except for opt1) are bitmasks - you can add them up to check |
---|
3079 | for several states, but the functions will return true if at least one of them |
---|
3080 | is in effect. |
---|
3081 | |
---|
3082 | 'setoption' will set options on the invoking character. There are no second and |
---|
3083 | third versions of this command, so you can only change the values in the first |
---|
3084 | list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted), |
---|
3085 | the option will be added to what the character currently has; if 0, the option is removed. |
---|
3086 | |
---|
3087 | This is definitely not a complete list of available option flag numbers. Ask a |
---|
3088 | core developer (or read the source: src/map/status.h) for the full list. |
---|
3089 | |
---|
3090 | --------------------------------------- |
---|
3091 | |
---|
3092 | *setcart {<type>}; |
---|
3093 | *checkcart() |
---|
3094 | |
---|
3095 | If <type> is 0 this command will remove the cart from the character. |
---|
3096 | Otherwise it gives the invoking character a cart. The cart given will be |
---|
3097 | cart number <type> and will work regardless of whether the character is a |
---|
3098 | merchant class or not. |
---|
3099 | Note: the character needs to have the skill MC_PUSHCART to gain a cart |
---|
3100 | |
---|
3101 | The accompanying function will return 1 if the invoking character has a cart |
---|
3102 | (any kind of cart) and 0 if they don't. |
---|
3103 | |
---|
3104 | if (checkcart()) mes "But you already have a cart!"; |
---|
3105 | |
---|
3106 | --------------------------------------- |
---|
3107 | |
---|
3108 | *setfalcon {<flag>}; |
---|
3109 | *checkfalcon() |
---|
3110 | |
---|
3111 | If <flag> is 0 this command will remove the falcon from the character. |
---|
3112 | Otherwise it gives the invoking character a falcon. The falcon will be there |
---|
3113 | regardless of whether the character is a hunter or not. It will (probably) not |
---|
3114 | have any useful effects for non-hunters though. |
---|
3115 | Note: the character needs to have the skill HT_FALCON to gain a falcon |
---|
3116 | |
---|
3117 | The accompanying function will return 1 if the invoking character has a falcon |
---|
3118 | and 0 if they don't. |
---|
3119 | |
---|
3120 | if (checkfalcon()) mes "But you already have a falcon!"; |
---|
3121 | |
---|
3122 | --------------------------------------- |
---|
3123 | |
---|
3124 | *setriding {<flag>}; |
---|
3125 | *checkriding() |
---|
3126 | |
---|
3127 | If <flag> is 0 this command will remove the mount from the character. |
---|
3128 | Otherwise it give the invoking character a PecoPeco (if they are a Knight |
---|
3129 | series class) or a GrandPeco (if they are a Crusader seriesclass). Unlike |
---|
3130 | 'setfalcon' and 'setcart' this will not work at all if they aren't of a class |
---|
3131 | which can ride. |
---|
3132 | Note: the character needs to have the skill KN_RIDING to gain a mount |
---|
3133 | |
---|
3134 | The accompanying function will return 1 if the invoking character is riding a |
---|
3135 | bird and 0 if they don't. |
---|
3136 | |
---|
3137 | if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!"; |
---|
3138 | |
---|
3139 | --------------------------------------- |
---|
3140 | |
---|
3141 | *checkvending ({"<player name>"}) |
---|
3142 | *checkchatting ({"<Player Name>"}) |
---|
3143 | |
---|
3144 | If the player's name is given, this command checks for that player |
---|
3145 | to be online and wether he/she is chatting or vending. |
---|
3146 | When no name is given, the attached player is used for checking. |
---|
3147 | Returns true or false (1 or 0) when the player is chatting/vending or not. |
---|
3148 | |
---|
3149 | Example(s): |
---|
3150 | if (checkVending("Aaron")) mes "Aaron is currently vending!"; |
---|
3151 | //This will check if Aaron is vending, and if so, put a message in front |
---|
3152 | //of the attached player saying Aaron is vending. |
---|
3153 | |
---|
3154 | if (checkChatting()) mes "You are currently chatting!"; |
---|
3155 | //This will check if you're in a chat room or not |
---|
3156 | |
---|
3157 | --------------------------------------- |
---|
3158 | |
---|
3159 | *agitcheck() |
---|
3160 | |
---|
3161 | This function will let you check whether the server is currently in WoE mode. |
---|
3162 | It will return 1 if the War of Emperium is on and 0 if it isn't. |
---|
3163 | |
---|
3164 | --------------------------------------- |
---|
3165 | |
---|
3166 | *isnight() |
---|
3167 | *isday() |
---|
3168 | |
---|
3169 | These functions will return 1 or 0 depending on whether the server is in night |
---|
3170 | mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday' |
---|
3171 | the other way around. They can be used interchangeably, pick the one you like |
---|
3172 | more: |
---|
3173 | |
---|
3174 | // These two are equivalent: |
---|
3175 | if (isday()) mes "I only prowl in the night."; |
---|
3176 | if (isnight()!=1) mes "I only prowl in the night."; |
---|
3177 | |
---|
3178 | --------------------------------------- |
---|
3179 | \\ |
---|
3180 | 3,1.- Item-related commands |
---|
3181 | \\ |
---|
3182 | --------------------------------------- |
---|
3183 | *isequipped(<id>{,<id>{,<id>{,<id>}}}) |
---|
3184 | |
---|
3185 | This function will return 1 if the invoking character has all of the item |
---|
3186 | IDs given equipped (if card IDs are passed, then it checks if the cards are |
---|
3187 | inserted into slots in the equipment they are currently wearing). Theorically |
---|
3188 | there is no limit to the number of items that may be tested for at the same time. |
---|
3189 | If even one of the items given is not equipped, 0 will be returned. |
---|
3190 | |
---|
3191 | // (Poring,Santa Poring,Poporing,Marin) |
---|
3192 | if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!"; |
---|
3193 | // (Poring) |
---|
3194 | if (isequipped(4001)) mes "A poring card is useful, don't you think?"; |
---|
3195 | |
---|
3196 | The function was meant for item scripts to support the cards released by Gravity |
---|
3197 | in February 2005, but it will work just fine in normal NPC scripts. |
---|
3198 | |
---|
3199 | --------------------------------------- |
---|
3200 | |
---|
3201 | *isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}}) |
---|
3202 | |
---|
3203 | This function is similar to 'isequipped', but instead of 1 or 0, it will return |
---|
3204 | the number of cards in the list given that were found on the invoking character. |
---|
3205 | |
---|
3206 | if (isequippedcnt(4001,4005,4033,4196)=4) mes "Finally got all four poring cards?"; |
---|
3207 | |
---|
3208 | --------------------------------------- |
---|
3209 | |
---|
3210 | *checkequipedcard(<card id>) |
---|
3211 | |
---|
3212 | This function will return 1 if the card specified by it's item ID number is |
---|
3213 | inserted into any equipment they have in their inventory, currently equipped or |
---|
3214 | not. |
---|
3215 | |
---|
3216 | --------------------------------------- |
---|
3217 | |
---|
3218 | *getequipisidentify(<equipment slot>) |
---|
3219 | |
---|
3220 | This function will return 1 if an item in the specified equipment slot is |
---|
3221 | identified and 0 if it isn't. Since you can't even equip unidentified equipment, |
---|
3222 | there's a question of whether it can actually end up there, and it will normally |
---|
3223 | return 1 all the time if there is an item in this equipment slot. |
---|
3224 | Which is kinda pointless. |
---|
3225 | For a list of equipment slots see 'getequipid'. |
---|
3226 | |
---|
3227 | --------------------------------------- |
---|
3228 | // |
---|
3229 | 3,1.- End of item-related commands |
---|
3230 | // |
---|
3231 | --------------------------------------- |
---|
3232 | |
---|
3233 | ============================== |
---|
3234 | |4.- Player-related commands.| |
---|
3235 | ============================== |
---|
3236 | ------------------------- |
---|
3237 | |
---|
3238 | *attachrid(<account ID>) |
---|
3239 | *detachrid; |
---|
3240 | |
---|
3241 | A 'RID' is an ID of a character who caused the NPC script to run, as has been |
---|
3242 | explained above in the introduction section. Quite a bit of commands want a RID |
---|
3243 | to work, since they wouldn't know where to send information otherwise. And in |
---|
3244 | quite a few cases the script gets invoked with a RID of zero (like through |
---|
3245 | OnTime special labels). If an NPC script needs this, it can attach a specified |
---|
3246 | character's id to itself. by calling the 'attachrid' function. |
---|
3247 | |
---|
3248 | 'attachrid' returns 1 if the character was found online and 0 if it wasn't. |
---|
3249 | |
---|
3250 | This could also be used, while running in a script invoked by a character |
---|
3251 | through talking to an NPC, to mess with other characters. |
---|
3252 | Detaching the RID will make the RID of the script zero. |
---|
3253 | |
---|
3254 | --------------------------------------- |
---|
3255 | |
---|
3256 | *rid2name(<rid>) |
---|
3257 | |
---|
3258 | Converts rid to name. Note: The player/monster/NPC must be online/enabled. |
---|
3259 | Good for PCKillEvent where you can convert 'killedrid' to the name of the player. |
---|
3260 | |
---|
3261 | Note: rid2name may not produce correct character names since rid = account id. |
---|
3262 | It will return the current online character of the account only. |
---|
3263 | |
---|
3264 | --------------------------------------- |
---|
3265 | |
---|
3266 | *message "<character name>","<message>"; |
---|
3267 | |
---|
3268 | That command will send a message to the chat window of the character specified |
---|
3269 | by name. The text will also appear above the head of that character. It will not |
---|
3270 | be seen by anyone else. |
---|
3271 | |
---|
3272 | --------------------------------------- |
---|
3273 | |
---|
3274 | *dispbottom "<message>"; |
---|
3275 | |
---|
3276 | This command will send the given message into the invoking character's chat |
---|
3277 | window. |
---|
3278 | |
---|
3279 | --------------------------------------- |
---|
3280 | |
---|
3281 | *warp "<map name>",<x>,<y>; |
---|
3282 | |
---|
3283 | This command will take the invoking character to the specifed map, and if |
---|
3284 | wanted, specified coordinates too, but these can be random. |
---|
3285 | |
---|
3286 | warp "place",50,55; |
---|
3287 | |
---|
3288 | This would take them to X 50 Y 55 on the map called "place". If your X and Y |
---|
3289 | coordinates land on an unwalkable map square, it will send the warped character |
---|
3290 | to a random place. Same will happen if they are both zero: |
---|
3291 | |
---|
3292 | warp "place",0,0; |
---|
3293 | |
---|
3294 | Notice that while warping people to coordinates 0,0 will normally get them into |
---|
3295 | a random place, it's not certain to always be so. Darned if I know where this is |
---|
3296 | actually coded, it might be that this happens because square 0,0 is unwalkable |
---|
3297 | on all official maps. If you're using custom maps, beware. |
---|
3298 | |
---|
3299 | There are also three special 'map names' you can use. |
---|
3300 | |
---|
3301 | "Random" will warp the player randomly on the current map. |
---|
3302 | "Save" and "SavePoint" will warp the player back to their savepoint. |
---|
3303 | |
---|
3304 | --------------------------------------- |
---|
3305 | |
---|
3306 | *areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>; |
---|
3307 | |
---|
3308 | This command is similar to 'warp', however, it will not refer to the invoking |
---|
3309 | character, but instead, all characters within a specified area, defined by the |
---|
3310 | x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected, |
---|
3311 | including the activating character, if they are outside the area. |
---|
3312 | |
---|
3313 | areawarp "place",10,10,120,120,"place2",150,150; |
---|
3314 | |
---|
3315 | Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square |
---|
3316 | shape, on the map called "place", will be affected, and warped to "place2" X 150 |
---|
3317 | Y 150 |
---|
3318 | |
---|
3319 | areawarp "place",10,10,120,120,"place2",0,0; |
---|
3320 | |
---|
3321 | By using ,0,0; as the destination coordinates it will take all the characters in |
---|
3322 | the affected area to a random set of co-ordinates on "place2". |
---|
3323 | |
---|
3324 | Like 'warp', areawarp will also explicitly warp characters randomly into the |
---|
3325 | current map if you give the 'to map name' as "Random". |
---|
3326 | |
---|
3327 | See also 'warp'. |
---|
3328 | |
---|
3329 | --------------------------------------- |
---|
3330 | |
---|
3331 | *warpparty "<mapname>",<x>,<y>,<party_id>; |
---|
3332 | |
---|
3333 | Warps a party to specified map and coordinate given the party ID, which you can get with |
---|
3334 | getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>). |
---|
3335 | |
---|
3336 | You can use the following "map names" for special warping behaviour: |
---|
3337 | Random: All party members are randomly warped in their current map (as if they |
---|
3338 | all used a fly wing) |
---|
3339 | SavePointAll: All party members are warped to their respective save point. |
---|
3340 | SavePoint: All party members are warped to the save point of the currently |
---|
3341 | attached player (will fail if there's no player attached). |
---|
3342 | Leader: All party members are warped to the leader's position. The leader must |
---|
3343 | be online and in the current map-server for this to work. |
---|
3344 | |
---|
3345 | Example: |
---|
3346 | mes "[Party Warper]"; |
---|
3347 | mes "Here you go!"; |
---|
3348 | close2; |
---|
3349 | set @id,getcharid(1); |
---|
3350 | warpparty "prontera",150,100,@id; |
---|
3351 | close; |
---|
3352 | |
---|
3353 | --------------------------------------- |
---|
3354 | |
---|
3355 | *warpchar "<mapname>",<x>,<y>,<char_id>; |
---|
3356 | |
---|
3357 | Warps another player to specified map and coordinate given the char id, which you can get with |
---|
3358 | getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that |
---|
3359 | is executing this script, unless it's some kind of "chosen" script. |
---|
3360 | |
---|
3361 | Example: |
---|
3362 | |
---|
3363 | warpchar "prontera",150,100,20000001; |
---|
3364 | |
---|
3365 | --------------------------------------- |
---|
3366 | |
---|
3367 | *warpguild "<mapname>",<x>,<y>,<guild_id>; |
---|
3368 | |
---|
3369 | Warps a guild to specified map and coordinate given the guild id, which you can get with |
---|
3370 | getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>). |
---|
3371 | |
---|
3372 | Example: |
---|
3373 | |
---|
3374 | warpguild "prontera",x,y,Guild_ID; |
---|
3375 | |
---|
3376 | --------------------------------------- |
---|
3377 | |
---|
3378 | *warppartner("<map name>",<x>,<y>); |
---|
3379 | |
---|
3380 | This function will find the invoking character's marriage partner, if any, and |
---|
3381 | warp them to the map and coordinates given. Go kidnap that spouse. :) It will |
---|
3382 | return 1 upon success and 0 if the partner is not online, the character is not |
---|
3383 | married, or if there's no invoking character (no RID). 0,0 will, as usual, |
---|
3384 | normally translate to random coordinates. |
---|
3385 | |
---|
3386 | --------------------------------------- |
---|
3387 | |
---|
3388 | *savepoint "<map name>",<x>,<y>; |
---|
3389 | *save "<map name>",<x>,<y>; |
---|
3390 | |
---|
3391 | This command saves where the invoking character will return to upon |
---|
3392 | 'return to save point', if dead or in some other cases. The two versions are |
---|
3393 | equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious. |
---|
3394 | This ignores any and all map flags, and can make a character respawn where no |
---|
3395 | teleportation is otherwise possible. |
---|
3396 | |
---|
3397 | savepoint "place",350,75; |
---|
3398 | |
---|
3399 | --------------------------------------- |
---|
3400 | |
---|
3401 | *heal <hp>,<sp>; |
---|
3402 | |
---|
3403 | This command will heal a set amount of HP and/or SP on the invoking character. |
---|
3404 | |
---|
3405 | heal 30000,0; // This will heal 30,000 HP |
---|
3406 | heal 0,30000; // This will heal 30,000 SP |
---|
3407 | heal 300,300; // This will heal 300 HP and 300 SP |
---|
3408 | |
---|
3409 | This command just alters the hit points and spell points of the invoking |
---|
3410 | character and produces no other output whatsoever. |
---|
3411 | |
---|
3412 | --------------------------------------- |
---|
3413 | |
---|
3414 | *itemheal <hp>,<sp>; |
---|
3415 | |
---|
3416 | This command works on the invoking character like 'heal', however, it is not |
---|
3417 | normally used in NPC scripts and will not work as expected there, but is used |
---|
3418 | all over in item scripts. |
---|
3419 | |
---|
3420 | Unlike 'heal', which just alters hp/sp and doesn't do anything else at all, this |
---|
3421 | command also shows healing animations for potions and other stuff, checks |
---|
3422 | whether the potion was made by a famous alchemist and alters the amount healed, |
---|
3423 | etc, etc. Since which kind of effect is shown depends on what item was used, |
---|
3424 | using it in an NPC script will not have a desired effect. |
---|
3425 | |
---|
3426 | There is also a nice example on using this with the 'rand' function, to give you |
---|
3427 | a random ammount of healing. |
---|
3428 | |
---|
3429 | // This will heal anything thing from 100 to 150 HP and no SP |
---|
3430 | itemheal rand(100,150),0; |
---|
3431 | |
---|
3432 | --------------------------------------- |
---|
3433 | |
---|
3434 | *percentheal <hp>,<sp>; |
---|
3435 | |
---|
3436 | This command will heal the invoking character. It heals the character, but not |
---|
3437 | by a set value - it adds percent of their maximum HP/SP. |
---|
3438 | |
---|
3439 | percentheal 100,0; // This will heal 100% HP |
---|
3440 | percentheal 0,100; // This will heal 100% SP |
---|
3441 | percentheal 50,50; // This will heal 50% HP and 50% SP |
---|
3442 | |
---|
3443 | So the amount that this will heal will depend on the total ammount of HP or SP |
---|
3444 | you have maximum. Like 'heal', this will not call up any animations or effects. |
---|
3445 | |
---|
3446 | --------------------------------------- |
---|
3447 | |
---|
3448 | *recovery; |
---|
3449 | |
---|
3450 | This command will revive and restore full HP and SP to all characters currently |
---|
3451 | connected to the server. |
---|
3452 | |
---|
3453 | --------------------------------------- |
---|
3454 | |
---|
3455 | *jobchange <job number>{,<upper flag>}; |
---|
3456 | |
---|
3457 | This command will change the job class of the invoking character. |
---|
3458 | |
---|
3459 | jobchange 1; // This would change your player into a Swordman |
---|
3460 | jobchange 4002; // This would change your player into a Swordman High |
---|
3461 | |
---|
3462 | This command does work with numbers, but you can also use job names. The full |
---|
3463 | list of job names and the numbers they correspond to can be found in |
---|
3464 | 'db/const.txt'. |
---|
3465 | |
---|
3466 | // This would change your player into a Swordman |
---|
3467 | jobchange Job_Swordman; |
---|
3468 | // This would change your player into a Swordman High |
---|
3469 | jobchange Job_Swordman_High; |
---|
3470 | |
---|
3471 | 'upper flag' can alternatively be used to specify the type of job one changes |
---|
3472 | to. For example, jobchange Job_Swordman,1; will change the character to a high |
---|
3473 | swordsman. The upper values are: |
---|
3474 | -1 (or when omitted): preserves the current job type. |
---|
3475 | 0: Normal/standard classes |
---|
3476 | 1: High/Advanced classes |
---|
3477 | 2: Baby classes |
---|
3478 | |
---|
3479 | This command will also set a permanent character-based variable |
---|
3480 | 'jobchange_level' which will contain the job level at the time right before |
---|
3481 | changing jobs, which can be checked for later in scripts. |
---|
3482 | |
---|
3483 | --------------------------------------- |
---|
3484 | |
---|
3485 | *jobname (<job number>) |
---|
3486 | |
---|
3487 | This command retrieves the name of the given job using the msg_athena entries 550->650. |
---|
3488 | |
---|
3489 | mes "[Kid]"; |
---|
3490 | mes "I never thought I'd met a "+jobname(Class)+" here of all places."; |
---|
3491 | close; |
---|
3492 | |
---|
3493 | --------------------------------------- |
---|
3494 | |
---|
3495 | *eaclass ({<job number>}) |
---|
3496 | |
---|
3497 | This commands returns the "eA job-number" corresponding to the given class (if none is given, it returns uses |
---|
3498 | the invoking player's class as argument). The eA job-number is also a class number system, but it's one that |
---|
3499 | comes with constants which make it easy to convert among classes. The command will return -1 if you pass it a |
---|
3500 | job number which doesn't has a eA Job value equivalent. |
---|
3501 | |
---|
3502 | set @eac, eaclass(); |
---|
3503 | if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN) |
---|
3504 | mes "You must be a swordman, knight, crusader, paladin, high swordman, lord knight, baby swordman,"; |
---|
3505 | mes "baby knight or baby crusader."; |
---|
3506 | if (@eac&EAJL_UPPER) |
---|
3507 | mes "You are a rebirth job."; |
---|
3508 | if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN) |
---|
3509 | mes "You must be a Swordman, Baby Swordman or High Swordman."; |
---|
3510 | |
---|
3511 | For more information on the eA Job System, see the docs/ea_job_system.txt file. |
---|
3512 | |
---|
3513 | --------------------------------------- |
---|
3514 | *roclass <job number> {,<gender>} |
---|
3515 | |
---|
3516 | Does the opposite of eaclass. That is, given a eA Job class, it returns which is the corresponding RO class number. |
---|
3517 | A gender is required because both Bard and Dancers share the same eA Job value (EAJ_BARDDANCER), if it isn't given, the |
---|
3518 | gender of the executing player is taken (if there's no player running the script, male will be used by default). |
---|
3519 | The command returns -1 when there isn't a valid class to represent the required job (for example, if you try to get the |
---|
3520 | baby version of a Taekwon class). |
---|
3521 | |
---|
3522 | set @eac, eaclass(); |
---|
3523 | //Check if class is already rebirth |
---|
3524 | if (@eac&EAJL_UPPER) { |
---|
3525 | mes "You look strong."; |
---|
3526 | close; |
---|
3527 | } |
---|
3528 | set @eac, roclass(@eac|EAJL_UPPER); |
---|
3529 | //Check if class has a rebirth version |
---|
3530 | if (@eac != -1) { |
---|
3531 | mes "Bet you can't wait to become a "+jobname(@eac)+"!"; |
---|
3532 | close; |
---|
3533 | } |
---|
3534 | |
---|
3535 | --------------------------------------- |
---|
3536 | |
---|
3537 | *changebase <job ID number>; |
---|
3538 | |
---|
3539 | This will change the appearance of the invoking character to that of a specified |
---|
3540 | job class. Nothing but appearance will change. This command is used in item |
---|
3541 | scripts for "Wedding Dress" and "Tuxedo" so the character like job 22, which is |
---|
3542 | the job number of the wedding sprites. |
---|
3543 | |
---|
3544 | It would be entered in the equip bonus section of an item |
---|
3545 | |
---|
3546 | 2338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,119529470,7,0,16,,0,1,0,{ bonus bMdef,15; changebase 22; } |
---|
3547 | |
---|
3548 | This command only works when inside item scripts. |
---|
3549 | |
---|
3550 | --------------------------------------- |
---|
3551 | |
---|
3552 | *classchange <view id>,<type>; |
---|
3553 | |
---|
3554 | This command is very ancient, it's origins are clouded in mystery. |
---|
3555 | It will send a 'display id change' packet to everyone in the immediate area of |
---|
3556 | the NPC object, which will supposedly make the NPC look like a different sprite, |
---|
3557 | an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will |
---|
3558 | not persist (Which is odd, cause it would be relatively easy to make it do so) |
---|
3559 | and most importantly, will not work at all since this command was broken with |
---|
3560 | the introduction of advanced classes. The code is written with the assumption |
---|
3561 | that the lowest sprite IDs are the job sprites and the anything beyond them is |
---|
3562 | monster and NPC sprites, but since the advanced classes rolled in, they got the |
---|
3563 | ID numbers on the other end of the number pool where monster sprites float. |
---|
3564 | |
---|
3565 | As a result it is currently impossible to call this command with a valid view |
---|
3566 | id. It will do nothing whatsoever if the view ID is below 4047. Getting it to |
---|
3567 | run will actually just crash the client. |
---|
3568 | |
---|
3569 | It could be a real gem if it can be gotten to actually do what it's supposed to |
---|
3570 | do, but this will only happen in a later SVN revision. |
---|
3571 | |
---|
3572 | --------------------------------------- |
---|
3573 | |
---|
3574 | *changesex; |
---|
3575 | |
---|
3576 | This command will change the gender for the attached character's account. If it |
---|
3577 | was male, it will become female, if it was female, it will become male. The |
---|
3578 | change will be written to the character server, but there is no way to send this |
---|
3579 | information to the client, so the player will continue to see their character as |
---|
3580 | the gender it previously was. What the other players will see before the |
---|
3581 | relogin is not clear. |
---|
3582 | |
---|
3583 | If the character currently connected when this command was invoked was a |
---|
3584 | Dancer/Gypsy or Bard/Clown, they will become a Swordman upon 'changesex'. |
---|
3585 | Whatever happens to their skills is not clear. Whatever happens if another |
---|
3586 | character on the same account was a gender-specific class is not clear either, |
---|
3587 | but it's likely that the client will have serious issues with that, since no |
---|
3588 | other characters on the same account will get altered. |
---|
3589 | |
---|
3590 | There's good reasons to be very careful when using this command. |
---|
3591 | |
---|
3592 | --------------------------------------- |
---|
3593 | |
---|
3594 | *getexp <base xp>,<job xp>; |
---|
3595 | |
---|
3596 | This command will give the invoking character a specified number of base and job |
---|
3597 | experience points. Can be used as a quest reward. Negative values won't work. |
---|
3598 | |
---|
3599 | getexp 10000,5000; |
---|
3600 | |
---|
3601 | You can also use the "set" command with the constants defined in 'db/const.txt': |
---|
3602 | |
---|
3603 | // These 2 combined has the same effect as the above command |
---|
3604 | set BaseExp,BaseExp+10000; |
---|
3605 | set JobExp,JobExp+5000; |
---|
3606 | |
---|
3607 | You can also reduce the ammount of experience points: |
---|
3608 | |
---|
3609 | set BaseExp,BaseExp-10000; |
---|
3610 | |
---|
3611 | Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which |
---|
3612 | adjusts the gained value. If you want to bypass this, use the 'set' method. |
---|
3613 | |
---|
3614 | --------------------------------------- |
---|
3615 | |
---|
3616 | *setlook <look type>,<look value>; |
---|
3617 | |
---|
3618 | This command will alter the look data for the invoking character. It is used |
---|
3619 | mainly for changing the palette used on hair and clothes, you specify which look |
---|
3620 | type you want to change, then the palette you want to use. Make sure you specify |
---|
3621 | a palette number that exists/is usable by the client you use. |
---|
3622 | |
---|
3623 | // This will change your hair(6), so that it uses palette 8, what ever your |
---|
3624 | // palette 8 is your hair will use that colour |
---|
3625 | |
---|
3626 | setlook 6,8; |
---|
3627 | |
---|
3628 | // This will change your clothes(7), so they are using palette 1, whatever |
---|
3629 | // your palette 1 is, your clothes will then use that set of colours. |
---|
3630 | |
---|
3631 | setlook 7,1; |
---|
3632 | |
---|
3633 | Here are the possible look types: |
---|
3634 | |
---|
3635 | 0 - Base sprite |
---|
3636 | 1 - Hairstyle |
---|
3637 | 2 - Weapon |
---|
3638 | 3 - Head bottom |
---|
3639 | 4 - Head top |
---|
3640 | 5 - Head mid |
---|
3641 | 6 - Hair color |
---|
3642 | 7 - Clothes color |
---|
3643 | 8 - Shield |
---|
3644 | 9 - Shoes |
---|
3645 | |
---|
3646 | Whatever 'shoes' means is anybody's guess, ask Gravity - the client does nothing |
---|
3647 | with this value. It still wants it from the server though, so it is kept, but |
---|
3648 | normally doesn't do a thing. |
---|
3649 | |
---|
3650 | Only the look data for hairstyle, hair color and clothes color are saved to the |
---|
3651 | char server's database and will persist. The rest freely change as the character |
---|
3652 | puts on and removes equipment, changes maps, logs in and out and otherwise you |
---|
3653 | should not expect to set them. In fact, messing with them is generally |
---|
3654 | hazardous, do it at your own risk, it is not tested what will this actually do - |
---|
3655 | it won't cause database corruption and probably won't cause a server crash, but |
---|
3656 | it's easy to crash the client with just about anything unusual. |
---|
3657 | |
---|
3658 | However, it might be an easy way to quickly check for empty view IDs for |
---|
3659 | sprites, which is essential for making custom headgear. |
---|
3660 | |
---|
3661 | Since a lot of people have different palettes for hair and clothes, it's |
---|
3662 | impossible to tell you what all the colour numbers are. If you want a serious |
---|
3663 | example, there is a Stylist script inside the default eAthena installation that |
---|
3664 | you can look at, this may help you create a Stylist of your own: |
---|
3665 | 'custom\dye.txt' |
---|
3666 | |
---|
3667 | --------------------------------------- |
---|
3668 | \\ |
---|
3669 | 4,1.- Item-related commands |
---|
3670 | \\ |
---|
3671 | --------------------------------------- |
---|
3672 | |
---|
3673 | *getitem <item id>,<amount>{,<account ID>}; |
---|
3674 | *getitem "<item name>",<amount>{,<account ID>}; |
---|
3675 | |
---|
3676 | This command will give a specific amount of specified items to the target |
---|
3677 | character. If the character is not online, nothing will happen. |
---|
3678 | If <character ID> is not specified, items will be created in the invoking |
---|
3679 | character inventory instead. |
---|
3680 | |
---|
3681 | In the first and most commonly used version of this command, items are |
---|
3682 | referred to by their database ID number found inside 'db/item_db.txt'. |
---|
3683 | |
---|
3684 | getitem 502,10 // The person will receive 10 apples |
---|
3685 | getitem 617,1 // The person will receive 1 Old Violet Box |
---|
3686 | |
---|
3687 | Giving an item ID of -1 will give a specified number of random items from the |
---|
3688 | list of those that fall out of Old Blue Box. Unlike in all other cases, these |
---|
3689 | will be unidentified, if they turn out to be equipment. This is exactly what's |
---|
3690 | written in the Old Blue Box's item script. |
---|
3691 | |
---|
3692 | Other negative IDs also correspond to other random item generating item tables: |
---|
3693 | |
---|
3694 | Giving an item ID of -2 will produce the effects of Old Violet Box. |
---|
3695 | Giving an item ID of -3 will produce the effects of Old Card Album. |
---|
3696 | Giving an item ID of -4 will produce the effects of Gift Box. |
---|
3697 | Giving an item ID of -5 will produce the effects of Worn Out Scroll, which, in |
---|
3698 | current SVN, drops only Jellopies anyway. |
---|
3699 | |
---|
3700 | This transaction is logged if the log script generated transactions option is |
---|
3701 | enabled. |
---|
3702 | |
---|
3703 | You may also create an item by it's name in the 'english name' field in the |
---|
3704 | item database: |
---|
3705 | |
---|
3706 | getitem "RED_POTION",10; |
---|
3707 | |
---|
3708 | Which will do what you'd expect. If it can't find that name in the database, |
---|
3709 | apples will be created anyway. It is often a VERY GOOD IDEA to use it like this. |
---|
3710 | |
---|
3711 | This is used in pretty much all NPC scripts that have to do with items and |
---|
3712 | quite a few item scripts. For more examples check just about any official script. |
---|
3713 | |
---|
3714 | --------------------------------------- |
---|
3715 | |
---|
3716 | *getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; |
---|
3717 | *getitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; |
---|
3718 | |
---|
3719 | This command will give an amount of specified items to the invoking character. |
---|
3720 | If an optional character ID is specified, and that character is currently |
---|
3721 | online, items will be created in their inventory instead. If they are not |
---|
3722 | online, nothing will happen. It works essentially the same as 'getitem' (it even |
---|
3723 | works for negative ID numbers the same way, which is kinda silly) but is a lot |
---|
3724 | more flexible, since it allows you to give the player an item altered with it's |
---|
3725 | specific properties. |
---|
3726 | |
---|
3727 | Those parameters that are different from 'getitem' are: |
---|
3728 | |
---|
3729 | identify - Whether you want the item to be identified or not, 0 unidentified, |
---|
3730 | 1 identified. |
---|
3731 | refine - For how many plusses will it be refined. |
---|
3732 | It will not let you refine an item higher than +10, if you |
---|
3733 | specify more it'll still be 10. |
---|
3734 | attribute - Whether the item is broken (1) or not (0) and NOT an elemental |
---|
3735 | attribute. |
---|
3736 | card1,2,3,4 - If you want a card compound to it, place the card ID number into |
---|
3737 | the specific card slot. Card ID numbers also found in |
---|
3738 | 'db/item_db.txt' |
---|
3739 | |
---|
3740 | Card1-card4 values are also used to store name information for named items, as |
---|
3741 | well as the elemental property of weapons and armor. You can create a named item |
---|
3742 | in this manner, however, if you just need a named piece of standard equipment, |
---|
3743 | it is much easier to the 'getnameditem' function instead. |
---|
3744 | |
---|
3745 | You will need to keep these values if you want to destroy and then perfectly |
---|
3746 | recreate a named item, for this see 'getinventorylist'. |
---|
3747 | |
---|
3748 | If you still want to try creating a named item with this command because |
---|
3749 | 'getnameditem' won't do it for you cause it's too limited, you can do it like |
---|
3750 | this. Careful, minor magic ahead. |
---|
3751 | |
---|
3752 | // First, let's get an ID of a character who's name will be on the item. |
---|
3753 | // Only an existing character's name may be there. |
---|
3754 | // Let's assume our character is 'Adam' and find his ID. |
---|
3755 | |
---|
3756 | set @charid,getcharid(0,"Adam"); |
---|
3757 | |
---|
3758 | // Now we split the character ID number into two portions with a binary |
---|
3759 | // shift operation. If you don't understand what this does, just copy it. |
---|
3760 | |
---|
3761 | set @card3, @charid & 65535; |
---|
3762 | set @card4, @charid >> 16; |
---|
3763 | |
---|
3764 | // If you're inscribing non-equipment, @card1 must be 254. |
---|
3765 | // Arrows are also not equipment. :) |
---|
3766 | set @card1,254; |
---|
3767 | |
---|
3768 | // For named equipment, card2 means the Star Crumbs and elemental |
---|
3769 | // crystals used to make this equipment. For everything else, it's 0. |
---|
3770 | |
---|
3771 | set @card2,0; |
---|
3772 | |
---|
3773 | // Now, let's give the character who invoked the script some |
---|
3774 | // Adam's Apples: |
---|
3775 | |
---|
3776 | getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4; |
---|
3777 | |
---|
3778 | This wasn't tested with all possible items, so I can't give any promises, |
---|
3779 | experiment first before relying on it. |
---|
3780 | |
---|
3781 | To create equipment, continue this example it like this: |
---|
3782 | |
---|
3783 | // We've already have card3 and card4 loaded with correct |
---|
3784 | // values so we'll just set up card1 and card2 with data |
---|
3785 | // for an Ice Stiletto. |
---|
3786 | |
---|
3787 | // If you're inscribing equipment, @card1 must be 255. |
---|
3788 | set @card1,255; |
---|
3789 | |
---|
3790 | // That's the number of star crumbs in a weapon. |
---|
3791 | set @sc,2; |
---|
3792 | |
---|
3793 | // That's the number of elemental property of the weapon. |
---|
3794 | set @ele,1; |
---|
3795 | |
---|
3796 | // And that's the wacky formula that makes them into |
---|
3797 | // a single number. |
---|
3798 | set @card2,@ele+((@sc*5)<<8); |
---|
3799 | |
---|
3800 | // That will make us an Adam's +2 VVS Ice Stiletto: |
---|
3801 | |
---|
3802 | getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4; |
---|
3803 | |
---|
3804 | Experiment with the number of star crumbs - I'm not certain just how much will |
---|
3805 | work most and what it depends on. The valid element numbers are: |
---|
3806 | |
---|
3807 | 1 - Ice, 2 - Earth 3 - Fire 4 - Wind. |
---|
3808 | |
---|
3809 | You can, apparently, even create duplicates of the same pet egg with this |
---|
3810 | command, creating a pet which is the same, but simultaneously exists in two |
---|
3811 | eggs, and may hatch from either, although, I'm not sure what kind of a mess will |
---|
3812 | this really cause. |
---|
3813 | |
---|
3814 | --------------------------------------- |
---|
3815 | |
---|
3816 | * getnameditem <item name|item id>,<Character name|character ID>; |
---|
3817 | |
---|
3818 | -Note: there's a total of 4 possible combinations of this command. |
---|
3819 | E.g: item name and character name, or with character id, etc... |
---|
3820 | |
---|
3821 | Create a item signed with the given character's name. |
---|
3822 | This is the same as using the hard(ly) explained way with getitem2. |
---|
3823 | |
---|
3824 | The command returns 1 when the item is created succesfully, or 0 when failed. |
---|
3825 | Failure occurs when there is: |
---|
3826 | - no player attached |
---|
3827 | - Item name or ID is not valid |
---|
3828 | - The given character ID/name is offline. |
---|
3829 | |
---|
3830 | Example: |
---|
3831 | |
---|
3832 | //This will give the currently attached player a Aaron's Apple (if Aaron is online). |
---|
3833 | getnameditem "Apple","Aaron"; |
---|
3834 | |
---|
3835 | //Self-explanatory (I hope). |
---|
3836 | if (getnameitem("Apple,"Aaron")) { |
---|
3837 | mes "You now have a Aaron's Apple!"; |
---|
3838 | } |
---|
3839 | |
---|
3840 | --------------------------------------- |
---|
3841 | |
---|
3842 | *makeitem <item id>,<amount>,"<map name>",<X>,<Y>; |
---|
3843 | *makeitem "<item name>",<amount>,"<map name>",<X>,<Y>; |
---|
3844 | |
---|
3845 | This command will create an item lying around on a specified map in the |
---|
3846 | specified location. |
---|
3847 | |
---|
3848 | itemid - Found in 'db/item_db.txt' |
---|
3849 | amount - Amount you want produced |
---|
3850 | map name - The map name |
---|
3851 | X - The X coordinate |
---|
3852 | Y - The Y coordinate. |
---|
3853 | |
---|
3854 | This item will still disappear just like any other dropped item. Like 'getitem', |
---|
3855 | it also accepts an 'english name' field from the database and creates apples if |
---|
3856 | the name isn't found. |
---|
3857 | If the map name is given as "this", the map the invoking character is on will be used. |
---|
3858 | |
---|
3859 | --------------------------------------- |
---|
3860 | |
---|
3861 | *delitem <item id>,<amount>{,<account ID>}; |
---|
3862 | *delitem "<item name>",<amount>{,<account ID>}; |
---|
3863 | |
---|
3864 | This command will take a specified amount of items from the invoking character. |
---|
3865 | As all the item commands, this one uses the ID of the item found inside |
---|
3866 | 'db/item_db.txt'. The items are destroyed - there is no way an NPC can simply |
---|
3867 | own items and have an inventory of them, other as by destroying and recreating |
---|
3868 | them when needed. |
---|
3869 | |
---|
3870 | delitem 502,10 // The person will lose 10 apples |
---|
3871 | delitem 617,1 // The person will lose 1 Old Violet Box |
---|
3872 | |
---|
3873 | It is always a good idea to to check if the player actually has the item before |
---|
3874 | you take it from them, Otherwise, you could try to delete items which the |
---|
3875 | players don't actually have, which won't fail and won't give an error message, |
---|
3876 | but might open up ways to exploit your script. |
---|
3877 | |
---|
3878 | Like 'getitem' this command will also accept an 'english name' field from the |
---|
3879 | database. If the name is not found, nothing will be deleted. |
---|
3880 | |
---|
3881 | --------------------------------------- |
---|
3882 | |
---|
3883 | *delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; |
---|
3884 | *delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; |
---|
3885 | |
---|
3886 | This command will take a specified amount of items from the invoking character. |
---|
3887 | Check 'getitem2' to understand its expanded parameters. |
---|
3888 | |
---|
3889 | --------------------------------------- |
---|
3890 | |
---|
3891 | *countitem(<item id>) |
---|
3892 | *countitem("<item name>") |
---|
3893 | |
---|
3894 | This function will return the number of items for the specified item ID that the |
---|
3895 | invoking character has in the inventory. |
---|
3896 | |
---|
3897 | mes "[Item Checker]"; |
---|
3898 | mes "Hmmm, it seems you have "+countitem(502)+" apples"; |
---|
3899 | close; |
---|
3900 | |
---|
3901 | Like 'getitem', this function will also accept an 'english name' from the |
---|
3902 | database as an argument. |
---|
3903 | |
---|
3904 | If you want to state the number at the end of a sentence, you can do it by |
---|
3905 | adding up strings: |
---|
3906 | |
---|
3907 | mes "[Item Checker]"; |
---|
3908 | mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE"); |
---|
3909 | close; |
---|
3910 | |
---|
3911 | --------------------------------------- |
---|
3912 | |
---|
3913 | *countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>) |
---|
3914 | *countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>) |
---|
3915 | |
---|
3916 | Expanded version of 'countitem' function, used for created/carded/forged items. |
---|
3917 | |
---|
3918 | This function will return the number of items for the specified item ID and |
---|
3919 | other parameters that the invoking character has in the inventory. |
---|
3920 | Check 'getitem2' to understand the arguments of the function. |
---|
3921 | |
---|
3922 | --------------------------------------- |
---|
3923 | |
---|
3924 | *groupranditem <group id>; |
---|
3925 | |
---|
3926 | Returns the item_id of a random item picked from the group specified. The |
---|
3927 | different groups and their group number are specified in db/item_group_db.txt |
---|
3928 | |
---|
3929 | When used in conjunction with other functions, you can get a random item. For |
---|
3930 | example, for a random pet lure: |
---|
3931 | |
---|
3932 | getitem groupranditem(15),1; |
---|
3933 | |
---|
3934 | --------------------------------------- |
---|
3935 | |
---|
3936 | *enable_items; |
---|
3937 | *disable_items; |
---|
3938 | |
---|
3939 | These commands enable item usage while an npc is running. When enable_items is |
---|
3940 | run, items can be used during scripts until disable_items is called. |
---|
3941 | To avoid possible exploits, when enable_items is invoked, it will only enable |
---|
3942 | item usage while running that script in particular. Note that if a different |
---|
3943 | script also calls enable_items, it will override the last call (so you may |
---|
3944 | want to call this command at the start of your script without assuming the |
---|
3945 | effect is still in effect). |
---|
3946 | |
---|
3947 | --------------------------------------- |
---|
3948 | |
---|
3949 | *itemskill <skill id>,<skill level>; |
---|
3950 | *itemskill "<skill name>",<skill level>; |
---|
3951 | |
---|
3952 | This is a command meant for item scripts to replicate single-use skills. It will |
---|
3953 | not work properly in NPC scripts a lot of the time because casting a skill is |
---|
3954 | not allowed when there is a message window or menu on screen. If there isn't one |
---|
3955 | cause you've made sure to run this when they already closed it, it should work |
---|
3956 | just fine and even show a targeting pointer if this is a targeting skill. |
---|
3957 | |
---|
3958 | // When you use Anodyne, you will cast Endure(8) level 1, |
---|
3959 | // and "Endure" will appear above your head as you use it. |
---|
3960 | 605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{} |
---|
3961 | |
---|
3962 | |
---|
3963 | --------------------------------------- |
---|
3964 | |
---|
3965 | *produce <item level>; |
---|
3966 | |
---|
3967 | This command will open a crafting window on the client connected to the invoking |
---|
3968 | character. The 'item level' is a number which determines what kind of a crafting |
---|
3969 | window will pop-up. You can see the full list of such item levels in |
---|
3970 | 'db/produce_db.txt' which determines what can actually be produced. |
---|
3971 | The window will not be empty only if the invoking character can actually produce |
---|
3972 | the items of that type and has the appropriate raw materials in their inventory. |
---|
3973 | |
---|
3974 | Valid item levels are: |
---|
3975 | |
---|
3976 | 1 - Level 1 Weapons |
---|
3977 | 2 - Level 2 Weapons |
---|
3978 | 3 - Level 3 Weapons |
---|
3979 | 16 - Blacksmith's Stones and Metals |
---|
3980 | 32 - Alchemist's Potions |
---|
3981 | 64 - Whitesmith's Coins |
---|
3982 | 123 - Whitesmith's Nuggets |
---|
3983 | 256 - Assassin Cross's Deadly Poison |
---|
3984 | |
---|
3985 | --------------------------------------- |
---|
3986 | |
---|
3987 | *successremovecards <equipment slot>; |
---|
3988 | |
---|
3989 | This command will remove all cards from the item found in the specified |
---|
3990 | equipment slot of the invoking character, create new card items and give them to |
---|
3991 | the character. If any cards were removed in this manner, it will also show a |
---|
3992 | success effect. |
---|
3993 | |
---|
3994 | --------------------------------------- |
---|
3995 | |
---|
3996 | *failedremovecards <equipment slot>,<type>; |
---|
3997 | |
---|
3998 | This command will remove all cards from the item found in the specified |
---|
3999 | equipment slot of the invoking character. 'type' determines what happens to the |
---|
4000 | item and the cards: |
---|
4001 | |
---|
4002 | 0 - will destroy both the item and the cards. |
---|
4003 | 1 - will keep the item, but destroy the cards. |
---|
4004 | 2 - will keep the cards, but destroy the item. |
---|
4005 | |
---|
4006 | Whatever the type is, it will also show a failure effect on screen. |
---|
4007 | |
---|
4008 | --------------------------------------- |
---|
4009 | |
---|
4010 | *repair <broken item number>; |
---|
4011 | |
---|
4012 | This command repairs a broken peice of equipment, using the same list of broken |
---|
4013 | items as available through 'getbrokenid'. |
---|
4014 | |
---|
4015 | The official scripts seem to use the repair command as a function instead: |
---|
4016 | 'repair(<number>)' but it returns nothing on the stack. Probably only Valaris, |
---|
4017 | who made it, can answer why is it so. |
---|
4018 | |
---|
4019 | --------------------------------------- |
---|
4020 | |
---|
4021 | *successrefitem <equipment slot>; |
---|
4022 | |
---|
4023 | This command will refine an item in the specified equipment slot of the invoking |
---|
4024 | character by +1. For a list of equipment slots see 'getequipid'. This command |
---|
4025 | will not only add the +1, but also display a 'refine success' effect on the |
---|
4026 | character and put appropriate messages into their chat window. It will also give |
---|
4027 | the character fame points if a weapon reached +10 this way, even though these |
---|
4028 | will only take effect for blacksmith who will later forge a weapon. |
---|
4029 | |
---|
4030 | The official scripts seem to use the 'successrefitem' command as a function |
---|
4031 | instead: 'successrefitem(<number>)' but it returns nothing on the stack. |
---|
4032 | This is since jAthena, so probably nobody knows for sure why is it so. |
---|
4033 | |
---|
4034 | --------------------------------------- |
---|
4035 | |
---|
4036 | *failedrefitem <equipment slot>; |
---|
4037 | |
---|
4038 | This command will fail to refine an item in the specified equipment slot of the |
---|
4039 | invoking character. The item will be destroyed. This will also display a 'refine |
---|
4040 | failure' effect on the character and put appropriate messages into their chat |
---|
4041 | window. |
---|
4042 | |
---|
4043 | The official scripts seem to use the 'failedrefitem' command as a function |
---|
4044 | instead: 'failedrefitem(<number>)' but it returns nothing on the stack. This is |
---|
4045 | since jAthena, so probably nobody knows for sure why is it so. |
---|
4046 | |
---|
4047 | |
---|
4048 | --------------------------------------- |
---|
4049 | |
---|
4050 | *unequip <equipment slot>; |
---|
4051 | |
---|
4052 | This command will unequip whatever is currently equipped in the invoking |
---|
4053 | character's specified equipment slot. For a full list of possible equipment |
---|
4054 | slots see 'getequipid'. |
---|
4055 | |
---|
4056 | If an item occupies several equipment slots, it will get unequipped from all of |
---|
4057 | them. (Which is a good thing.) |
---|
4058 | |
---|
4059 | --------------------------------------- |
---|
4060 | |
---|
4061 | *clearitem; |
---|
4062 | |
---|
4063 | This command will destroy all items the invoking character has in their |
---|
4064 | inventory. (that includes equipped items) It will not affect anything else, like |
---|
4065 | storage or cart. |
---|
4066 | |
---|
4067 | --------------------------------------- |
---|
4068 | |
---|
4069 | *equip <item id>; |
---|
4070 | *autoEquip <item id>,<option>; |
---|
4071 | |
---|
4072 | These commands are to equip a equipment on the attached character. |
---|
4073 | The equip function will equip the item ID given when the player has |
---|
4074 | this item in his/her inventory, while the autoequip function will |
---|
4075 | equip the given item ID when this is looted. The option parameter of |
---|
4076 | the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off. |
---|
4077 | |
---|
4078 | Example(s): |
---|
4079 | |
---|
4080 | //This will equip a 1104 (falchion) on the character if this is in the inventory. |
---|
4081 | equip 1104; |
---|
4082 | |
---|
4083 | //The invoked character will now automatically equip a falchion when it's looted. |
---|
4084 | autoequip 1104,1; |
---|
4085 | |
---|
4086 | //The invoked character will no longer automatically equip a falchion. |
---|
4087 | autoequip 1104,0; |
---|
4088 | |
---|
4089 | --------------------------------------- |
---|
4090 | // |
---|
4091 | 4,1.- End of item-related commands |
---|
4092 | // |
---|
4093 | --------------------------------------- |
---|
4094 | |
---|
4095 | *openstorage; |
---|
4096 | |
---|
4097 | This will open a character's Kafra storage window on the client connected to the |
---|
4098 | invoking character. It does not check wherever it is run from, so you can allow |
---|
4099 | any feasible NPC to open a kafra storage. (It's not certain whether this works |
---|
4100 | in item scripts, but if it does, it could be interesting.) |
---|
4101 | |
---|
4102 | The storage window might not open if a message box or a trade deal is present on |
---|
4103 | screen already, so you should at least make sure the message box is closed |
---|
4104 | before you open storage. |
---|
4105 | |
---|
4106 | mes "I will now open your stash for you"; |
---|
4107 | close2; |
---|
4108 | openstorage; |
---|
4109 | end; |
---|
4110 | --------------------------------------- |
---|
4111 | \\ |
---|
4112 | 4,2.- Guild-related commands |
---|
4113 | \\ |
---|
4114 | --------------------------------------- |
---|
4115 | |
---|
4116 | *guildopenstorage() |
---|
4117 | |
---|
4118 | This function works the same as 'openstorage' but will open a guild storage |
---|
4119 | window instead for the guild storage of the guild the invoking character belongs |
---|
4120 | to. This is a function because it returns a value - 0 if the guild storage was |
---|
4121 | opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.) |
---|
4122 | Since guild storage is only accessible to one character at one time, it may fail |
---|
4123 | if another character is accessing the guild storage at the same time. |
---|
4124 | |
---|
4125 | This will also fail and return 2 if the character does not belong to any guild. |
---|
4126 | |
---|
4127 | --------------------------------------- |
---|
4128 | |
---|
4129 | *guildchangegm(<guild id>,<new master's name>) |
---|
4130 | |
---|
4131 | This function will change the Guild Master of a guild. The ID is the guild's |
---|
4132 | id, and the new guildmaster's name must be passed. |
---|
4133 | |
---|
4134 | Returns 1 on success, 0 otherwise. |
---|
4135 | |
---|
4136 | --------------------------------------- |
---|
4137 | |
---|
4138 | *guildgetexp <amount>; |
---|
4139 | |
---|
4140 | This will give the specified amount of guild experience points to the guild the |
---|
4141 | invoking character belongs to. It will silently fail if they do not belong to |
---|
4142 | any guild. |
---|
4143 | |
---|
4144 | --------------------------------------- |
---|
4145 | |
---|
4146 | *guildskill <skill id>,<level> |
---|
4147 | *guildskill "<skill name>",<level> |
---|
4148 | |
---|
4149 | This command will bump up the specified guild skill by the specified number of |
---|
4150 | levels. This refers to the invoking character and will only work if the invoking |
---|
4151 | character is a member of a guild AND it's guildmaster, otherwise no failure |
---|
4152 | message will be given and no error will occur, but nothing will happen - same |
---|
4153 | about the guild skill trying to exceed the possible maximum. The full list of |
---|
4154 | guild skills is available in 'db/skill_db.txt', these are all the GD_ skills at |
---|
4155 | the end. |
---|
4156 | |
---|
4157 | The flag parameter is currently not functional and it's a mystery of what it |
---|
4158 | would actually do. (Though probably, like for character skills, it would allow |
---|
4159 | temporary bumping.) Using this command will bump the guild skill up permanently. |
---|
4160 | |
---|
4161 | // This would give your character's guild one level of Approval (GD_APPROVAL ID |
---|
4162 | // 10000). Notice that if you try to add two levels of Approval, or add |
---|
4163 | // Approval when the guild already has it, it will only have one level of |
---|
4164 | // Approval afterwards. |
---|
4165 | guildskill 10000,1,0; |
---|
4166 | |
---|
4167 | You might want to make a quest for getting a certain guild skill, make it hard |
---|
4168 | enough that all the guild needs to help or something. Doing this for the Glory |
---|
4169 | of the Guild skill, which allows your guild to use an emblem, is a good idea for |
---|
4170 | a fun quest. (Wasting a level point on that is really annoying :D) |
---|
4171 | |
---|
4172 | --------------------------------------- |
---|
4173 | // |
---|
4174 | 4,2 End of guild-related commands. |
---|
4175 | // |
---|
4176 | --------------------------------------- |
---|
4177 | |
---|
4178 | *resetlvl <action type>; |
---|
4179 | |
---|
4180 | This is a character reset command, meant mostly for rebirth script supporting |
---|
4181 | Advanced jobs, which will reset the invoking character's stats and level |
---|
4182 | depending on the action type given. Valid action types are: |
---|
4183 | |
---|
4184 | 1 - Base level 1, Job level 1, 0 skill points, 0 base xp, 0 job xp, wipes the |
---|
4185 | status effects, sets all stats to 1. If the new job is 'Novice High', give |
---|
4186 | 100 status points, give First Aid and Play Dead skills. |
---|
4187 | 2 - Base level 1, Job level 1, 0 skill points, 0 XP/JXP. Skills and attribute |
---|
4188 | values are not altered. |
---|
4189 | 3 - Base level 1, base xp 0. Nothing else is changed. |
---|
4190 | 4 - Job level 1, job xp 0. Nothing else is changed. |
---|
4191 | |
---|
4192 | In all cases it will also unequip everything the character has on. |
---|
4193 | |
---|
4194 | Even though it doesn't return a value, it is used as a function in the official |
---|
4195 | rebirth scripts. Ask AppleGirl why. |
---|
4196 | |
---|
4197 | --------------------------------------- |
---|
4198 | |
---|
4199 | *resetstatus; |
---|
4200 | |
---|
4201 | This is a character reset command, which will reset the stats on the invoking |
---|
4202 | character and give back all the stat points used to raise them previously. |
---|
4203 | Nothing will happen to any other numbers about the character. |
---|
4204 | |
---|
4205 | Used in reset NPC's (duh!) |
---|
4206 | |
---|
4207 | --------------------------------------- |
---|
4208 | |
---|
4209 | *resetskill; |
---|
4210 | |
---|
4211 | This command takes off all the skill points on the invoking character, so they |
---|
4212 | only have Basic Skill blanked out (lvl 0) left, and returns the points for them |
---|
4213 | to spend again. Nothing else will change but the skills. Quest skills will also |
---|
4214 | reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If |
---|
4215 | the 'quest_skill_learn' option is set in there, the points in the quest skills |
---|
4216 | will also count towards the total. |
---|
4217 | |
---|
4218 | Used in reset NPC's (duh!) |
---|
4219 | |
---|
4220 | --------------------------------------- |
---|
4221 | |
---|
4222 | *sc_start <effect type>,<ticks>,<extra argument>{,<target ID number>}; |
---|
4223 | *sc_start2 <effect type>,<ticks>,<extra argument>,<percent chance>{,<target ID number>}; |
---|
4224 | *sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<target ID number>}; |
---|
4225 | *sc_end <effect type>{,<target ID number>}; |
---|
4226 | |
---|
4227 | These command bestow a status effect on the invoking character. This command is |
---|
4228 | used a lot in the item scripts. |
---|
4229 | |
---|
4230 | // This would poison them for 10 min |
---|
4231 | sc_start SC_Poison,600000,0; |
---|
4232 | |
---|
4233 | Effect type is a number of effect, 'db/const.txt' lists the common (mostly |
---|
4234 | negative) status effect types as constants, starting with 'SC_'. You can also |
---|
4235 | use this to give someone an effect of a player-cast spell: |
---|
4236 | |
---|
4237 | // This will bless someone as if with Bless 10: |
---|
4238 | sc_start 10,240000,10; |
---|
4239 | |
---|
4240 | Extra argument's meaning differs depending on the effect type, for most effects |
---|
4241 | caused by a player skill the extra argument means the level of the skill that |
---|
4242 | would have been used to create that effect, for others it might have no meaning |
---|
4243 | whatsoever. You can actually bless someone with a 0 bless spell level this way, |
---|
4244 | which is fun, but weird. |
---|
4245 | |
---|
4246 | The target ID number, if given, will cause the status effect to appear on a |
---|
4247 | specified character, instead of the one attached to the running script. This has |
---|
4248 | not been properly tested. |
---|
4249 | |
---|
4250 | 'sc_start2' is perfectly equivalent, but unlike 'sc_start', a status change |
---|
4251 | effect will only occur with a specified percentage chance. 10000 given as the |
---|
4252 | chance is equivalent to a 100% chance, 0 is a zero. |
---|
4253 | |
---|
4254 | 'sc_start4' is just like sc_start, however it takes four parameters for the |
---|
4255 | status change instead of one. What these values are depends on the status |
---|
4256 | change in question. For example, elemental armor defense takes the following |
---|
4257 | four values: |
---|
4258 | - val1 is the first element, val2 is the resistance to the element val1. |
---|
4259 | - val3 is the second element, val4 is the resistance to said element. |
---|
4260 | eg: sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15; |
---|
4261 | |
---|
4262 | 'sc_end' will remove a specified status effect. If SC_All is used (-1), it will |
---|
4263 | do a complete removal of all statuses (although permanent ones will re-apply). |
---|
4264 | |
---|
4265 | You can see the full list of status effects caused by skills in |
---|
4266 | 'src/map/status.h' - they are currently not fully documented, but most of that |
---|
4267 | should be rather obvious. |
---|
4268 | |
---|
4269 | --------------------------------------- |
---|
4270 | |
---|
4271 | *skilleffect <skill id>,<number>; |
---|
4272 | *skilleffect "<skill name>",<number>; |
---|
4273 | |
---|
4274 | This command will display the visual and sound effects of a specified skill (see |
---|
4275 | 'db/skill_db.txt' for a full list of skills) on the invoking character's sprite. |
---|
4276 | Nothing but the special effects and animation will happen. If the skill's normal |
---|
4277 | effect displays a floating number, the number given will float up. |
---|
4278 | |
---|
4279 | // This will heal the character with 2000 hp, buff with |
---|
4280 | // Bless 10 and Increase AGI 5, and display appropriate |
---|
4281 | // effects. |
---|
4282 | mes "Blessed be!"; |
---|
4283 | skilleffect 28,2000; |
---|
4284 | heal 2000,0; |
---|
4285 | skilleffect 34,0; |
---|
4286 | // That's bless 10. |
---|
4287 | sc_start 10,240000,10; |
---|
4288 | skilleffect 29,0; |
---|
4289 | // That's agi 5 |
---|
4290 | sc_start 12,140000,5; |
---|
4291 | |
---|
4292 | --------------------------------------- |
---|
4293 | |
---|
4294 | *npcskilleffect <skill id>,<number>,<x>,<y>; |
---|
4295 | *npcskilleffect "<skill name>",<number>,<x>,<y>; |
---|
4296 | |
---|
4297 | This command behaves identically to 'skilleffect', however, the effect will not |
---|
4298 | be centered on the invoking character's sprite, nor on the NPC sprite, if any, |
---|
4299 | but will be centered at map coordinates given on the same map as the invoking |
---|
4300 | character. |
---|
4301 | |
---|
4302 | --------------------------------------- |
---|
4303 | |
---|
4304 | *specialeffect <effect number>; |
---|
4305 | |
---|
4306 | This command will display special effect with the given number, centered on the |
---|
4307 | specified NPCs coordinates, if any. For a full list of special effect numbers |
---|
4308 | known see 'doc/effect_list.txt'. Some effect numbers are known not to work in |
---|
4309 | some client releases. (Notably, rain is absent from any client executables |
---|
4310 | released after April 2005.) |
---|
4311 | |
---|
4312 | --------------------------------------- |
---|
4313 | |
---|
4314 | *specialeffect2 <effect number>; |
---|
4315 | |
---|
4316 | This command behaves identically to the 'specialeffect', but the effect will be |
---|
4317 | centered on the invoking character's sprite. |
---|
4318 | |
---|
4319 | --------------------------------------- |
---|
4320 | |
---|
4321 | *statusup <stat>; |
---|
4322 | |
---|
4323 | This command will bump a specified stat of the invoking character up by one |
---|
4324 | permanently. Stats are to be given as number, but you can use these constants to |
---|
4325 | replace them: |
---|
4326 | |
---|
4327 | bStr - Strength |
---|
4328 | bVit - Vitality |
---|
4329 | bInt - Intelligence |
---|
4330 | bAgi - Agility |
---|
4331 | bDex - Dexterity |
---|
4332 | bLuk - Luck |
---|
4333 | |
---|
4334 | --------------------------------------- |
---|
4335 | |
---|
4336 | *statusup2 <stat>,<amount>; |
---|
4337 | |
---|
4338 | This command will bump a specified stat of the invoking character up by the |
---|
4339 | specified amount permanently. The amount can be negative. See 'statusup'. |
---|
4340 | |
---|
4341 | // This will decrease a character's Vit forever. |
---|
4342 | statusup bVit,-1; |
---|
4343 | |
---|
4344 | --------------------------------------- |
---|
4345 | |
---|
4346 | *bonus <bonus type>,<val1>; |
---|
4347 | *bonus2 <bonus type>,<val1>,<val2>; |
---|
4348 | *bonus3 <bonus type>,<val1>,<val2>,<val3>; |
---|
4349 | *bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>; |
---|
4350 | *bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>; |
---|
4351 | |
---|
4352 | These commands are meant to be used in item scripts. They will probably work |
---|
4353 | outside item scripts, but the bonus will not persist for long. They, as |
---|
4354 | expected, refer only to an invoking character. |
---|
4355 | |
---|
4356 | You can find the full list of possible bonuses and which command to use for each |
---|
4357 | kind in 'doc/item_bonus.txt'. |
---|
4358 | |
---|
4359 | --------------------------------------- |
---|
4360 | |
---|
4361 | *bonusautoscript <script>,<rate>{,<flag>} |
---|
4362 | *bonusautoscript2 <script>,<rate>{,<flag>} |
---|
4363 | |
---|
4364 | These commands are meant to be used in item scripts. They will probably work |
---|
4365 | outside item scripts, but the bonus will not persist for long. They, as |
---|
4366 | expected, refer only to an invoking character. |
---|
4367 | |
---|
4368 | What these commands do is 'attach' a script to the player which will get |
---|
4369 | executed on attack (or when attacked in the case of bonusautoscript2). Rate is |
---|
4370 | the trigger rate of the script (1000 = 100%). The optional argument flag is |
---|
4371 | used to classify the type of attack where the script can trigger (it shares |
---|
4372 | the same flags as the bAutoSpell bonus script): |
---|
4373 | |
---|
4374 | Range criteria: |
---|
4375 | BF_SHORT: Trigger on melee attack |
---|
4376 | BF_LONG: Trigger on ranged attack |
---|
4377 | Default: BF_SHORT+BF_LONG |
---|
4378 | Attack type criteria: |
---|
4379 | BF_WEAPON: Trigger on weapon skills |
---|
4380 | BF_MAGIC: Trigger on magic skills |
---|
4381 | BF_MISC: Trigger on misc skills |
---|
4382 | Default: BF_WEAPON |
---|
4383 | Skill criteria: |
---|
4384 | BF_NORMAL: Trigger on normal attacks |
---|
4385 | BF_SKILL: Trigger on skills |
---|
4386 | default: If the attack type is BF_WEAPON (only) BF_NORMAL is used, otherwise |
---|
4387 | BF_SKILL+BF_NORMAL is used. |
---|
4388 | |
---|
4389 | In both cases, when the script triggers, the attached player will be the one |
---|
4390 | who holds the bonus. There is currently no way of knowing within this script |
---|
4391 | who was the other character (the attacker in autoscript2, or the target in |
---|
4392 | autoscript). |
---|
4393 | |
---|
4394 | //Grants a 1% chance of starting the state "all stats +10" for 10 seconds when |
---|
4395 | //using weapon or misc attacks (both melee and ranged skills). |
---|
4396 | bonusautoscript "{ sc_start SC_INCALLSTATUS,10000,10; }",10,BF_WEAPON|BF_MISC; |
---|
4397 | |
---|
4398 | --------------------------------------- |
---|
4399 | |
---|
4400 | *skill <skill id>,<level>{,<flag>}; |
---|
4401 | *skill "<skill name>",<level>{,<flag>}; |
---|
4402 | *addtoskill <skill id>,<level>{,<flag>}; |
---|
4403 | *addtoskill "<skill name>",<level>{,<flag>}; |
---|
4404 | |
---|
4405 | These commands will give the invoking character a specified skill. This is also |
---|
4406 | used for item scripts. |
---|
4407 | |
---|
4408 | Level is obvious. Skill id is the ID number of the skill in question as per |
---|
4409 | 'db/skill_db.txt'. It is not known for certain whether this can be used to give |
---|
4410 | a character a monster's skill, but you're welcome to try with the numbers given |
---|
4411 | in 'db/mob_skill_db.txt'. |
---|
4412 | |
---|
4413 | Flag is 0 if the skill is given permanently (will get written with the character |
---|
4414 | data) or 1 if it is temporary (will be lost eventually, this is meant for card |
---|
4415 | item scripts usage.). The flag parameter is optional, and defaults to 1 in |
---|
4416 | 'skill' and to 2 in 'addtoskill'. |
---|
4417 | |
---|
4418 | Flag 2 means that the level parameter is to be interpreted as a stackable |
---|
4419 | additional bonus to the skill level. If the character did not have that skill |
---|
4420 | previously, they will now at 0+the level given. |
---|
4421 | |
---|
4422 | // This will permanently give the character Stone Throw (TF_THROWSTONE,152), at |
---|
4423 | // level 1. |
---|
4424 | skill 152,1,0; |
---|
4425 | |
---|
4426 | --------------------------------------- |
---|
4427 | |
---|
4428 | *nude; |
---|
4429 | |
---|
4430 | This command will unequip anything equipped on the invoking character. |
---|
4431 | |
---|
4432 | It is not required to do this when changing jobs since 'jobchange' will unequip |
---|
4433 | everything not equippable by the new job class anyway. |
---|
4434 | |
---|
4435 | --------------------------------------- |
---|
4436 | |
---|
4437 | *disguise <Monster ID>; |
---|
4438 | *undisguise; |
---|
4439 | |
---|
4440 | This command disguises the current player with a monster sprite. |
---|
4441 | The disguise lasts until 'undisguise' is issued or the player logs out. |
---|
4442 | |
---|
4443 | Example: |
---|
4444 | |
---|
4445 | disquise 1002; //Yay! You're a Poring!!! |
---|
4446 | next; |
---|
4447 | undisquise; //Yay!!!! You're a human again!! |
---|
4448 | |
---|
4449 | --------------------------------------- |
---|
4450 | \\ |
---|
4451 | 4,3 Marriage-related commands |
---|
4452 | \\ |
---|
4453 | --------------------------------------- |
---|
4454 | *marriage("<spouse name>"); |
---|
4455 | |
---|
4456 | This function will marry two characters, the invoking character and the one |
---|
4457 | referred to by name given, together, setting them up as each other's marriage |
---|
4458 | partner. No second function call has to be issued (in current SVN at least) to |
---|
4459 | make sure the marriage works both ways. The function returns 1 upon success, or |
---|
4460 | 0 if the marriage could not be completed, either because the other character |
---|
4461 | wasn't found or because one of the two characters is already married. |
---|
4462 | |
---|
4463 | This will do nothing else for the marriage except setting up the spouse ID for |
---|
4464 | both of these characters. No rings will be given and no effects will be shown. |
---|
4465 | |
---|
4466 | --------------------------------------- |
---|
4467 | |
---|
4468 | *wedding; |
---|
4469 | |
---|
4470 | This command will call up wedding effects - the music and confetti - centered on |
---|
4471 | the invoking character. |
---|
4472 | |
---|
4473 | --------------------------------------- |
---|
4474 | |
---|
4475 | *divorce() |
---|
4476 | |
---|
4477 | This function will un-marry the invoking character from whoever they were |
---|
4478 | married to. Both will no longer be each other's marriage partner, (at least in |
---|
4479 | current SVN, which prevents the cases of multi-spouse problems). It will return |
---|
4480 | 1 upon success or 0 if the character was not married at all. |
---|
4481 | |
---|
4482 | This function will also destroy both wedding rings and send a message to both |
---|
4483 | players, telling them they are now divorced. |
---|
4484 | |
---|
4485 | --------------------------------------- |
---|
4486 | |
---|
4487 | *adopt "<parent name>","<parent name>","<novice name>"; |
---|
4488 | *adopt("<parent name>","<parent name>","<novice name>") |
---|
4489 | |
---|
4490 | This command will set up a novice as a baby of a married couple. All three are |
---|
4491 | referred to by character name. The correct variables are set on all three |
---|
4492 | characters in the same call. The command will unequip anything the novice has |
---|
4493 | equipped and make them a Job_Baby class, as well as send them a 'your job has |
---|
4494 | been changed' message. |
---|
4495 | |
---|
4496 | Beware of calling this from inside a 'callfunc' function, cause upon successful |
---|
4497 | adoption, this command returns a zero, as if it were a function. This is likely |
---|
4498 | to screw up execution of a 'return' command. You may try to call it as a |
---|
4499 | function instead, but it doesn't return anything upon an error, which may also |
---|
4500 | cause script execution to throw up errors. |
---|
4501 | |
---|
4502 | Nothing will happen (and nothing will be returned either) if either future |
---|
4503 | parent is below base level 70 and/or if any of the three characters is not found |
---|
4504 | online. |
---|
4505 | |
---|
4506 | --------------------------------------- |
---|
4507 | // |
---|
4508 | 4,3.- End of marriage-related commands |
---|
4509 | // |
---|
4510 | --------------------------------------- |
---|
4511 | |
---|
4512 | *pcfollow <id>,<target id>; |
---|
4513 | *pcstopfollow <id>; |
---|
4514 | |
---|
4515 | Makes a character follow or stop following someone. This command does the same as the @follow command. |
---|
4516 | The main difference is that @follow can use character names, and this commands needs the Account ID for the target. |
---|
4517 | |
---|
4518 | Example(s): |
---|
4519 | |
---|
4520 | //This will make Aaron follow Bullah, when both of these characters are online. |
---|
4521 | PCFollow getCharID(3,"Aaron"),getCharID(3,"Bullah"); |
---|
4522 | |
---|
4523 | //Makes Aaron stop following whoever he is following. |
---|
4524 | PCStopFollow getCharID(3,"Aaron"); |
---|
4525 | |
---|
4526 | --------------------------------------- |
---|
4527 | |
---|
4528 | * pcblockmove <id>,<option>; |
---|
4529 | |
---|
4530 | Prevents the given ID from moving when the option != 0, 0 enables the ID to move again. |
---|
4531 | ID should be able to be GID of a monster/npc or AID from a character. |
---|
4532 | |
---|
4533 | Example(s): |
---|
4534 | |
---|
4535 | //prevents the current char from moving away; |
---|
4536 | pcblockmove getcharid(3),1; |
---|
4537 | |
---|
4538 | //enables the current char to move again. |
---|
4539 | pcblockmove getcharid(3),0; |
---|
4540 | |
---|
4541 | --------------------------------------- |
---|
4542 | |
---|
4543 | ================================== |
---|
4544 | |5.- Mob / NPC -related commands.| |
---|
4545 | ================================== |
---|
4546 | --------------------------------------- |
---|
4547 | |
---|
4548 | *monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"}; |
---|
4549 | *areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>"}; |
---|
4550 | |
---|
4551 | This command will spawn a monster on the specified coordinates on the specified |
---|
4552 | map. If the script is invoked by a character, a special map name, "this", will |
---|
4553 | be recognised to mean the name of the map the invoking character is located at. |
---|
4554 | This command works fine in the item scripts. |
---|
4555 | |
---|
4556 | The same command arguments mean the same things as described above in the |
---|
4557 | beginning of this document when talking about permanent monster spawns. Monsters |
---|
4558 | spawned in this manner will not respawn upon being killed. |
---|
4559 | |
---|
4560 | Unlike the permanent monster spawns, if the mob id is -1, a random monster will |
---|
4561 | be picked from the entire database according to the rules configured in the |
---|
4562 | server for dead branches. This will work for all other kinds of non-permanent |
---|
4563 | monster spawns. |
---|
4564 | |
---|
4565 | The only very special thing about this command is an event label, which is an |
---|
4566 | optional parameter. This label is written like '<NPC object name>::<label name>' |
---|
4567 | and upon the monster being killed, it will execute the script inside of the |
---|
4568 | specified NPC object starting from the label given. The RID of the player |
---|
4569 | attached at this execution will be the RID of the killing character. |
---|
4570 | |
---|
4571 | monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel"; |
---|
4572 | |
---|
4573 | If you do not specify any event label, a label in the NPC object that ran this |
---|
4574 | command, called 'OnMyMobDead:' will execute anyway, if present. |
---|
4575 | |
---|
4576 | The coordinates of 0,0 will spawn the monster on a random place on the map. |
---|
4577 | |
---|
4578 | The 'areamonster' command works much like the 'monster' command and is not |
---|
4579 | significantly different, but spawns the monsters within a square defined by |
---|
4580 | x1/y1-x2/y2. |
---|
4581 | |
---|
4582 | Simple monster killing script: |
---|
4583 | |
---|
4584 | <Normal NPC object definition. Let's assume you called him NPCNAME.> |
---|
4585 | mes "[Summon Man]"; |
---|
4586 | mes "Want to start the kill?"; |
---|
4587 | next; |
---|
4588 | menu "Yes",L_Yes,"No",-; |
---|
4589 | mes "[Summon Man]"; |
---|
4590 | mes "Come back later"; |
---|
4591 | close; |
---|
4592 | L_Yes: |
---|
4593 | monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled"; |
---|
4594 | // By using 0,0 it will spawn them in a random place. |
---|
4595 | mes "[Summon Man]"; |
---|
4596 | mes "Now go and kill all the Poring I summoned"; |
---|
4597 | // He summoned ten. |
---|
4598 | close; |
---|
4599 | L_PoringKilled: |
---|
4600 | set $PoringKilled,$PoringKilled+1; |
---|
4601 | if ($PoringKilled==10) goto L_AllDead; |
---|
4602 | end; |
---|
4603 | L_AllDead: |
---|
4604 | announce "Summon Man: Well done all the poring are dead",3; |
---|
4605 | set $PoringKilled,0; |
---|
4606 | end; |
---|
4607 | |
---|
4608 | For more good examples see just about any official 2-1 or 2-2 job quest script. |
---|
4609 | |
---|
4610 | --------------------------------------- |
---|
4611 | |
---|
4612 | *killmonster "<map name>","<event label>"{,<type>}; |
---|
4613 | |
---|
4614 | This command will kill all monsters that were spawned with 'monster' or |
---|
4615 | 'addmonster' and have a specified event label attached to them. Commonly used to |
---|
4616 | get rid of remaining quest monsters once the quest is complete. |
---|
4617 | |
---|
4618 | If the label is given as "All", all monsters which have their respawn times set |
---|
4619 | to -1 (like all the monsters summoned with 'monster' or 'areamonster' script |
---|
4620 | command, and all monsters summoned with GM commands, but no other ones - that |
---|
4621 | is, all non-permanent monsters) on the specified map will be killed regardless |
---|
4622 | of the event label value. |
---|
4623 | |
---|
4624 | As of r12876 killmonster now supports an optional argument type. Using 1 for type |
---|
4625 | will make the command fire "OnMyMobDead" events from any monsters that do die |
---|
4626 | as a result of this command. |
---|
4627 | |
---|
4628 | --------------------------------------- |
---|
4629 | |
---|
4630 | *killmonsterall "<map name>"{,<type>}; |
---|
4631 | |
---|
4632 | This command will kill all monsters on a specified map name, regardless of how |
---|
4633 | they were spawned or what they are. As of r12873, The behavior has changed slightly. |
---|
4634 | In light of a label behavior fix for mob spawning commands that will now allow the label to |
---|
4635 | trigger when there is no player, killmonsterall has also been modified to support this. |
---|
4636 | |
---|
4637 | Using this the normal/old way means labels dont trigger when a player didn't |
---|
4638 | attack/kill a monster. This is because it breaks compatability with older scripts if |
---|
4639 | forced to use the new method. However, if you wish to use the new label type with this |
---|
4640 | command, simply use 1 for type. Any other number won't be recognized. |
---|
4641 | |
---|
4642 | --------------------------------------- |
---|
4643 | |
---|
4644 | *strmobinfo(<type>,<monster id>); |
---|
4645 | |
---|
4646 | This function will return information about a monster record in the database, as |
---|
4647 | per 'db/mob_db.txt'. Type is the kind of information returned. Valid types are: |
---|
4648 | |
---|
4649 | 1 - 'english name' field in the database, a string. |
---|
4650 | 2 - 'japanese name' field in the database, a string. |
---|
4651 | All other returned values are numbers: |
---|
4652 | 3 - Level. |
---|
4653 | 4 - Maximum HP. |
---|
4654 | 5 - Maximum SP. |
---|
4655 | 6 - Experience reward. |
---|
4656 | 7 - Job experience reward. |
---|
4657 | |
---|
4658 | --------------------------------------- |
---|
4659 | |
---|
4660 | *mobcount("<map name>","<event label>") |
---|
4661 | |
---|
4662 | This function will count all the monsters on the specified map that have a given |
---|
4663 | event label and return the number or 0 if it can't find any. Naturally, only |
---|
4664 | monsters spawned with 'monster' and 'areamonster' script commands can be like |
---|
4665 | this. |
---|
4666 | |
---|
4667 | However, apparently, if you pass this function an empty string for the event |
---|
4668 | label, it should return the total count of normal permanently respawning |
---|
4669 | monsters instead. With the current dynamic mobs system, where mobs are not kept |
---|
4670 | in memory for maps with no actual people playing on them, this will return a 0 |
---|
4671 | for any such map. |
---|
4672 | |
---|
4673 | --------------------------------------- |
---|
4674 | |
---|
4675 | *clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}} |
---|
4676 | |
---|
4677 | This command creates a monster which is a copy of another player. The first |
---|
4678 | four arguments serve the same purpose as in the monster script command, The |
---|
4679 | <char id> is the character id of the player to clone (player must be online). |
---|
4680 | If <master id> is given, the clone will be a 'slave/minion' of it. Master_id |
---|
4681 | must be a character id of another online player. |
---|
4682 | |
---|
4683 | The mode can be specified to determine the behaviour of the clone, it's |
---|
4684 | values are the same as the ones used for the mode field in the mob_db. The |
---|
4685 | default mode is aggressive, assists, can move, can attack. |
---|
4686 | |
---|
4687 | Flag can be either zero or one currently. If zero, the clone is a normal |
---|
4688 | monster that'll target players, if one, it is considered a summoned monster, |
---|
4689 | and as such, it'll target other monsters. Defaults to zero. |
---|
4690 | |
---|
4691 | The duration specifies how long the clone will live before it is auto-removed. |
---|
4692 | Specified in seconds, defaults to no limit (zero). |
---|
4693 | |
---|
4694 | Returned value is the monster ID of the spawned clone. If command fails, |
---|
4695 | returned value is zero. |
---|
4696 | |
---|
4697 | --------------------------------------- |
---|
4698 | |
---|
4699 | *summon "Monster name",<monster id>{,<Time Out>{,"event label"}}; |
---|
4700 | |
---|
4701 | This command will summon a monster. (see also 'monster') Unlike monsters spawned |
---|
4702 | with other commands, this one will set up the monster to fight to protect the |
---|
4703 | invoking character. Monster name and mob id obey the same rules as the one given |
---|
4704 | at the beginning of this document for permanent monster spawns with the |
---|
4705 | exceptions mentioned when describing 'monster' command. |
---|
4706 | |
---|
4707 | The effect for the skill 'Call Homonuculus' will be displayed centered on the |
---|
4708 | invoking character. |
---|
4709 | |
---|
4710 | Timeout is the time in milliseconds the summon lives, and is set default |
---|
4711 | to 60000 (1 minute). Note that also the value 0 will set the timer to default, |
---|
4712 | and it is not possible to create a spawn that lastst forever. |
---|
4713 | If an event label is given, upon the monster being killed, the event label will |
---|
4714 | run as if by 'donpcevent'. |
---|
4715 | |
---|
4716 | // Will summon a dead branch-style monster to fight for the character. |
---|
4717 | summon "--ja--",-1; |
---|
4718 | |
---|
4719 | --------------------------------------- |
---|
4720 | |
---|
4721 | *homevolution; |
---|
4722 | |
---|
4723 | This command will try to evolve the current player's homunculus. |
---|
4724 | If it doesn't work, the /swt emoticon is shown. |
---|
4725 | |
---|
4726 | To evolve a homunculus, the invoking player must have a homunculus, |
---|
4727 | the homunculus must not be the last evolution and |
---|
4728 | the homunculus must be on at least 91000/100000 intimacy with it's owner. |
---|
4729 | |
---|
4730 | --------------------------------------- |
---|
4731 | ------------------------------------------------ |
---|
4732 | //===========================================\\ |
---|
4733 | || Mob Control Suit Commands || |
---|
4734 | \\===========================================// |
---|
4735 | ------------------------------------------------ |
---|
4736 | |
---|
4737 | --------------------------------------- |
---|
4738 | |
---|
4739 | * mobspawn (<monster name>,<monster ID>,<mapname>,<x>,<y>) |
---|
4740 | * mobRemove <GID>; |
---|
4741 | |
---|
4742 | This is used to spawn a monster and return it's Game ID, to be used |
---|
4743 | in the unit/mobcontrol commands. |
---|
4744 | |
---|
4745 | Note, I will use the stuff here in the examples for the unitcontrol. |
---|
4746 | |
---|
4747 | Example(s): |
---|
4748 | |
---|
4749 | //Spawns a poring named poi poi and put's it's GID in .GID. |
---|
4750 | set .GID,mobspawn("Poi Poi",1002,"prontera",160,180); |
---|
4751 | //would kill our poring. |
---|
4752 | mobRemove .GID; |
---|
4753 | |
---|
4754 | --------------------------------------- |
---|
4755 | |
---|
4756 | * getmobdata (<GID>,<arrayname>) |
---|
4757 | * setmobdata <GID>,<parameter>,<new value>; |
---|
4758 | |
---|
4759 | This is used to get and set special data related to the monster. |
---|
4760 | With getmobdata, the array given will be filled with the current data. In setmobdata |
---|
4761 | the indexes in the array would be used to set that data on the monster. |
---|
4762 | Parameters (indexes) are: |
---|
4763 | |
---|
4764 | 0 = class (big, small, normal) 7 = y 14 = hair style 21 = weapon |
---|
4765 | 1 = level 8 = speed 15 = hair color 22 = shield (again) |
---|
4766 | 2 = HP 9 = mode (see doc/mob_db_mode_list.txt) 16 = head gear bottom 23 = looking dir |
---|
4767 | 3 = max HP 10 = special AI state (?) 17 = head gear middle 24 = killer state (1 or 0) |
---|
4768 | 4 = master ID (aid of the master, summon) 11 = SC option 18 = head gear top 25 = callback flag |
---|
4769 | 5 = map index 12 = sex 19 = cloth color 26 = no random walk (1 or 0) |
---|
4770 | 6 = x 13 = class (Monster ID, Job ID) 20 = shield |
---|
4771 | |
---|
4772 | Example(s): |
---|
4773 | |
---|
4774 | //this will set all the mobdata in the @array variable. (@array[1] being level, @array[13] class etc) |
---|
4775 | getmobdata .GID,@array; |
---|
4776 | |
---|
4777 | //set the max hp of our poring to 1000. |
---|
4778 | setmobdata .GID,3,1000; |
---|
4779 | |
---|
4780 | --------------------------------------- |
---|
4781 | |
---|
4782 | * mobassist <GID>,<target id>; |
---|
4783 | This will make the monster assist the Target ID as if it was a summon of it. |
---|
4784 | Example(s): |
---|
4785 | |
---|
4786 | /this will make our poring assist the current attached player! >:3 |
---|
4787 | mobassist .GID,getcharid(3); |
---|
4788 | |
---|
4789 | --------------------------------------- |
---|
4790 | |
---|
4791 | * mobattach <GID>{,"<NPC Name>"}; |
---|
4792 | |
---|
4793 | GID is the GID of a monster, NPC or account id. The NPC running or |
---|
4794 | he NPC name given is used to attach the monster. |
---|
4795 | |
---|
4796 | By attaching a monster, the NPC to which it is attached is ran on special actions by the monster. |
---|
4797 | The system will set specific data in the .ai_action variable array on the NPC invoked. |
---|
4798 | The special AI actions types are set in the .ai_action at place AI_ACTION_TAR_TYPE |
---|
4799 | |
---|
4800 | More AI_ vars are set in const.txt, and you can also look at sample/monstercontroller.cpp: |
---|
4801 | |
---|
4802 | --------------------------------------- |
---|
4803 | |
---|
4804 | * unitwalk <GID>,<x>,<y>; |
---|
4805 | * unitwalk <GID>,<mapid>; |
---|
4806 | |
---|
4807 | This is one command, but can be used in two ways. If only the first argument is given, |
---|
4808 | the unit whose GID is given will start walking towards the map with the given mapid |
---|
4809 | (we believe these are the mapindexes found in db/map_index.txt). |
---|
4810 | |
---|
4811 | When 2 arguments are passed, the given unit will walk to the given x,y coordinates on |
---|
4812 | the map where the unit currently is. |
---|
4813 | |
---|
4814 | Example(s): |
---|
4815 | |
---|
4816 | //Will move/walk the poring we made to the coordinates 150,150 |
---|
4817 | unitwalk .GID,150,150; |
---|
4818 | |
---|
4819 | //Will move the poring towards alberta (if my assumed mapindexes are correct). |
---|
4820 | unitwalk .GID,3; |
---|
4821 | |
---|
4822 | --------------------------------------- |
---|
4823 | |
---|
4824 | * unitkill <GID>; |
---|
4825 | * unitwarp <GID>,<Mapname>,<x>,<y>; |
---|
4826 | * unitattack <GID>,<Target ID>; |
---|
4827 | * unitstop <GID>; |
---|
4828 | * unittalk <GID>,<Text>; |
---|
4829 | * unitemote <GID>,<Emote>; |
---|
4830 | |
---|
4831 | Okay, these commands should be fairly self explaining. |
---|
4832 | For the emotions, you can look in db/const.txt for prefixes with e_ |
---|
4833 | |
---|
4834 | --------------------------------------- |
---|
4835 | |
---|
4836 | ------------------------------------------------ |
---|
4837 | //===========================================\\ |
---|
4838 | || End of Mob Control Suit Commands || |
---|
4839 | \\===========================================// |
---|
4840 | ------------------------------------------------ |
---|
4841 | --------------------------------------- |
---|
4842 | |
---|
4843 | *disablenpc "<NPC object name>"; |
---|
4844 | *enablenpc "<NPC object name>"; |
---|
4845 | |
---|
4846 | These two commands will disable and enable, respectively, an NPC object |
---|
4847 | specified by name. The disabled NPC will disappear from sight and will no longer |
---|
4848 | be triggerable in the normal way. It is not clear whether it will still be |
---|
4849 | accessible through 'donpcevent' and other triggering commands, but it probably |
---|
4850 | will be. You can disable even warp NPCs if you know their object names, which is |
---|
4851 | an easy way to make a map only accessible through walking half the time. Then |
---|
4852 | you 'enablenpc' them back. |
---|
4853 | |
---|
4854 | You can also use these commands to create the illusion of an NPC switching |
---|
4855 | between several locations, which is often better than actually moving the NPC - |
---|
4856 | create one NPC object with a visible and a hidden part to their name, make a few |
---|
4857 | copies, and then disable all except one. |
---|
4858 | |
---|
4859 | --------------------------------------- |
---|
4860 | |
---|
4861 | *hideonnpc "<NPC object name>"; |
---|
4862 | *hideoffnpc "<NPC object name>"; |
---|
4863 | |
---|
4864 | These commands will make the NPC object specified display as hidden/visible, |
---|
4865 | even though not actually disabled per se. Hidden as in thief Hide skill, but |
---|
4866 | unfortunately, not detectable by Ruwach or Sight. |
---|
4867 | |
---|
4868 | As they are now, these commands are pointless, it is suggested to use |
---|
4869 | 'disablenpc'/'enablenpc', because these two commands actually unload the NPC |
---|
4870 | sprite location and other accompanying data from memory when it is not used. |
---|
4871 | However, you can use these for some quest ideas (such as cloaking npcs talking |
---|
4872 | while hidden then revealing.... you can wonder around =P |
---|
4873 | |
---|
4874 | --------------------------------------- |
---|
4875 | |
---|
4876 | *doevent "<NPC object name>::<event label>"; |
---|
4877 | |
---|
4878 | This command will start a new execution thread in a specified NPC object at the |
---|
4879 | specified label. The execution of the script running this command will not stop. |
---|
4880 | No parameters may be passed with a doevent call. |
---|
4881 | |
---|
4882 | The script of the NPC object invoked in this manner will run as if it's been |
---|
4883 | invoked by the RID that was active in the script that issued a 'doevent'. |
---|
4884 | |
---|
4885 | place,100,100,1%TAB%script%TAB%NPC%TAB%53,{ |
---|
4886 | mes "This is what you will see when you click me"; |
---|
4887 | close; |
---|
4888 | Label: |
---|
4889 | mes "This is what you will see if the doevent is activated"; |
---|
4890 | close; |
---|
4891 | } |
---|
4892 | |
---|
4893 | .... |
---|
4894 | |
---|
4895 | doevent "NPC::Label"; |
---|
4896 | |
---|
4897 | --------------------------------------- |
---|
4898 | |
---|
4899 | *donpcevent "{NPC NAME}::<event label>"; |
---|
4900 | |
---|
4901 | This command is kinda confusing cause it performs in two completely different |
---|
4902 | ways. |
---|
4903 | |
---|
4904 | If the event label is phrased like "::<label name>", all NPC objects that have a |
---|
4905 | specified label in them will be invoked as if by a 'doevent', but no RID |
---|
4906 | whatsoever will be attached while they execute. |
---|
4907 | |
---|
4908 | Otherwise, if the label is given as "<NPC name>::<label name>", a label within |
---|
4909 | the NPC object that runs this command will be called, but as if it was running |
---|
4910 | inside another, specified NPC object. No RID will be attached to it in this case |
---|
4911 | either. |
---|
4912 | |
---|
4913 | This can be used for making another NPC react to an action that you have done |
---|
4914 | with the NPC that has this command in it, i.e. show an emotion, or say |
---|
4915 | something. |
---|
4916 | |
---|
4917 | place,100,100,1%TAB%script%TAB%NPC%TAB%53,{ |
---|
4918 | mes "Hey NPC2 copy what I do"; |
---|
4919 | close2; |
---|
4920 | set @emo, rand(1,30); |
---|
4921 | donpcevent "NPC2::Emo"; |
---|
4922 | Emo: |
---|
4923 | emotion @emo; |
---|
4924 | end; |
---|
4925 | } |
---|
4926 | |
---|
4927 | place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{ |
---|
4928 | mes "Hey NPC copy what I do"; |
---|
4929 | close2; |
---|
4930 | set @emo, rand(1,30); |
---|
4931 | donpcevent "NPC::Emo"; |
---|
4932 | Emo: |
---|
4933 | emotion @emo; |
---|
4934 | end; |
---|
4935 | } |
---|
4936 | |
---|
4937 | This will make both NPC perform the same random emotion from 1 to 30, and the |
---|
4938 | emotion will appear above each of their heads. |
---|
4939 | |
---|
4940 | --------------------------------------- |
---|
4941 | |
---|
4942 | *cmdothernpc "<npc name>","<command>"; |
---|
4943 | |
---|
4944 | This is simply "donpcevent <npc name>::OnCommand<command>". |
---|
4945 | It is an approximation of official server script language's 'cmdothernpc'. |
---|
4946 | |
---|
4947 | --------------------------------------- |
---|
4948 | |
---|
4949 | *npctalk "<message>"; |
---|
4950 | |
---|
4951 | This command will display a message to the surrounding area as if the NPC object |
---|
4952 | running it was a player talking - that is, above their head and in the chat |
---|
4953 | window. The display name of the NPC will get appended in front of the message to |
---|
4954 | complete the effect. |
---|
4955 | |
---|
4956 | // This will make everyone in the area see the NPC greet the character |
---|
4957 | // who just invoked it. |
---|
4958 | npctalk "Hello "+strcharinfo(0)+" how are you"; |
---|
4959 | |
---|
4960 | --------------------------------------- |
---|
4961 | |
---|
4962 | *setnpcdisplay("<npc name>", "<display name>", <class id>, <size>) |
---|
4963 | *setnpcdisplay("<npc name>", "<display name>", <class id>) |
---|
4964 | *setnpcdisplay("<npc name>", "<display name>") |
---|
4965 | *setnpcdisplay("<npc name>", <class id>) |
---|
4966 | |
---|
4967 | Changes the display name and/or display class of the target npc. |
---|
4968 | Returns 0 is successful, 1 if the npc does not exist. |
---|
4969 | Size is 0 = norma 1 = small 2 = big. |
---|
4970 | |
---|
4971 | Since trunk r11779 |
---|
4972 | |
---|
4973 | --------------------------------------- |
---|
4974 | \\ |
---|
4975 | 5,1.- Time-related commands |
---|
4976 | \\ |
---|
4977 | --------------------------------------- |
---|
4978 | *addtimer <ticks>,"<NPC object name>::<label>"; |
---|
4979 | *deltimer "<NPC object name>::<event label>"; |
---|
4980 | *addtimercount <ticks>,"<NPC object name>::<event label>"; |
---|
4981 | |
---|
4982 | These commands will create, destroy, and delay a countdown timer - 'addtimer' to |
---|
4983 | create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified |
---|
4984 | number of ticks. For all three cases, the event label given is the identifier of |
---|
4985 | that timer. |
---|
4986 | |
---|
4987 | When this timer runs out, a new execution thread will start in the specified NPC |
---|
4988 | object at the specified label. If no such label is found in the NPC object, it |
---|
4989 | will run as if clicked. In either case, the script runs with no RID attached. |
---|
4990 | |
---|
4991 | The ticks are given in 1/1000ths of a second. |
---|
4992 | |
---|
4993 | One more thing. These timers are stored as part of player data. If the player |
---|
4994 | logs out, all of these get immediately deleted, without executing the script. |
---|
4995 | If this behavior is undesirable, use some other timer mechanism (like 'sleep'). |
---|
4996 | |
---|
4997 | --------------------------------------- |
---|
4998 | |
---|
4999 | *initnpctimer{ "<NPC name>" {, <Attach Flag>} } | |
---|
5000 | { "<NPC name>" | <Attach Flag> }; |
---|
5001 | *stopnpctimer{ "<NPC name>" {, <Detach Flag>} } | |
---|
5002 | { "<NPC name>" | <Detach Flag> }; |
---|
5003 | *startnpctimer{ "<NPC name>" {, <Attach Flag>} } | |
---|
5004 | { "<NPC name>" | <Attach Flag> }; |
---|
5005 | *setnpctimer <tick>{,"<NPC name>"}; |
---|
5006 | *getnpctimer(<type of information>{,"<NPC name>"}); |
---|
5007 | *attachnpctimer {"<character name>"}; |
---|
5008 | *detachnpctimer {"<NPC name>"}; |
---|
5009 | |
---|
5010 | This set of commands and functions will create and manage an NPC-based timer. |
---|
5011 | The NPC name may be omitted, in which case the calling NPC is used as target. |
---|
5012 | |
---|
5013 | Contrary to addtimer/deltimer commands which let you have many different timers |
---|
5014 | referencing different labels in the same NPC, each with their own countdown, |
---|
5015 | 'initnpctimer' can only have one per NPC object. But it can trigger many labels |
---|
5016 | and let you know how many were triggered already and how many still remain. |
---|
5017 | |
---|
5018 | This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon |
---|
5019 | creating this timer, the execution will not stop, but will happily continue |
---|
5020 | onward. The timer will then invoke new execution threads at labels |
---|
5021 | "OnTimer<time>:" in the NPC object it is attached to. |
---|
5022 | |
---|
5023 | To create the timer, use the 'initnpctimer', which will start it running. |
---|
5024 | 'stopnpctimer' will pause the timer, without clearing the current tick, while |
---|
5025 | 'startnpctimer' will let the paused timer continue. |
---|
5026 | |
---|
5027 | By default timers do not have a RID attached, which lets them continue even |
---|
5028 | if the player that started them logs off. To attach a RID to a timer, you can |
---|
5029 | either use the optional "attach flag" when using 'initnpctimer/startnpctimer', |
---|
5030 | or do it manually by using 'attachnpctimer'. Likewise, the optional flag of |
---|
5031 | stopnpctimer lets you detach any RID after stopping the timer, and by using |
---|
5032 | 'detachnpctimer' you can detach a RID at any time. |
---|
5033 | |
---|
5034 | Normally there is only a single timer per NPC, but as an exception, as long as |
---|
5035 | you attach a player to the timer, you can have multiple timers running at once, |
---|
5036 | because these will get stored on the players instead of the NPC. |
---|
5037 | NOTE: You need to attach the RID before the timer _before_ you start it to |
---|
5038 | get a player-attached timer. Otherwise it'll stay a NPC timer (no effect). |
---|
5039 | |
---|
5040 | If the player that is attached to the npctimer logs out, the "OnTimerQuit:" |
---|
5041 | event label of that npc will be triggered, so you can do the appropiate |
---|
5042 | cleanup (the player is still attached when this event is triggered). |
---|
5043 | |
---|
5044 | The 'setnpctimer' command will explicitly set the timer to a given tick. |
---|
5045 | 'getnpctimer' provides timer information. Its parameter defines what type: |
---|
5046 | |
---|
5047 | 0 - Will return the current tick count of the timer. |
---|
5048 | 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the |
---|
5049 | specified NPC waiting for execution. |
---|
5050 | 2 - Will return the number of times the timer has triggered an "OnTimer<tick>:" |
---|
5051 | label in the specified NPC. |
---|
5052 | |
---|
5053 | Example 1: |
---|
5054 | |
---|
5055 | <NPC Header> { |
---|
5056 | initnpctimer; |
---|
5057 | npctalk "I cant talk right now, give me 10 seconds"; |
---|
5058 | end; |
---|
5059 | OnTimer5000: |
---|
5060 | npctalk "Ok 5 seconds more"; |
---|
5061 | end; |
---|
5062 | OnTimer6000: |
---|
5063 | npctalk "4"; |
---|
5064 | end; |
---|
5065 | OnTimer7000: |
---|
5066 | npctalk "3"; |
---|
5067 | end; |
---|
5068 | OnTimer8000: |
---|
5069 | npctalk "2"; |
---|
5070 | end; |
---|
5071 | OnTimer9000: |
---|
5072 | npctalk "1"; |
---|
5073 | end; |
---|
5074 | OnTimer10000: |
---|
5075 | stopnpctimer; |
---|
5076 | mes "[Man]"; |
---|
5077 | mes "Ok we can talk now"; |
---|
5078 | } |
---|
5079 | |
---|
5080 | Example 2: |
---|
5081 | |
---|
5082 | OnTimer15000: |
---|
5083 | npctalk "Another 15 seconds have passed."; |
---|
5084 | setnpctimer 0; |
---|
5085 | end; |
---|
5086 | |
---|
5087 | // This OnInit label will run when the script is loaded, so that the timer |
---|
5088 | // is initialised immediately as the server starts. It is dropped back to 0 |
---|
5089 | // every time the NPC says something, so it will cycle continiously. |
---|
5090 | OnInit: |
---|
5091 | initnpctimer; |
---|
5092 | end; |
---|
5093 | |
---|
5094 | Example 3: |
---|
5095 | |
---|
5096 | mes "[Man]"; |
---|
5097 | mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you"; |
---|
5098 | // we divide the timer returned by 1000 cause it will be displayed in |
---|
5099 | // milliseconds otherwise |
---|
5100 | close; |
---|
5101 | |
---|
5102 | Example 4: |
---|
5103 | |
---|
5104 | mes "[Man]"; |
---|
5105 | mes "Ok I will let you have 30 sec more"; |
---|
5106 | close2; |
---|
5107 | setnpctimer (getnpctimer(0)-30000); |
---|
5108 | // Notice the 'close2'. If there were a 'next' there the timer would be |
---|
5109 | // changed only after the player pressed the 'next' button. |
---|
5110 | end; |
---|
5111 | |
---|
5112 | --------------------------------------- |
---|
5113 | |
---|
5114 | *sleep {<milliseconds>}; |
---|
5115 | *sleep2 {<milliseconds>}; |
---|
5116 | *awake "<NPC name>"; |
---|
5117 | |
---|
5118 | These commands are used to control the pause of a NPC. |
---|
5119 | sleep and sleep2 will pause the script for the given amount of milliseconds. |
---|
5120 | Awake is used to cancel a sleep. When awake is callen on a NPC it will run as |
---|
5121 | if the sleep timer ran out, and thus making the script continue. Sleep and sleep2 |
---|
5122 | basically do the same, but the main difference is that sleep will not keep the rid, |
---|
5123 | while sleep2 does. |
---|
5124 | |
---|
5125 | Examples: |
---|
5126 | sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore) |
---|
5127 | sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached. |
---|
5128 | awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'. |
---|
5129 | |
---|
5130 | --------------------------------------- |
---|
5131 | // |
---|
5132 | 5,1.- End of time-related commands |
---|
5133 | // |
---|
5134 | |
---|
5135 | *announce "<text>",<flag>{,<color>}; |
---|
5136 | |
---|
5137 | This command will broadcast a message to all or most players, similar to |
---|
5138 | @kami/@kamib GM commands. |
---|
5139 | |
---|
5140 | The region the broadcast is heard in and the color the message will come up as |
---|
5141 | will be determined by the flags: |
---|
5142 | |
---|
5143 | announce "This will be shown to everyone at all in yellow.",0; |
---|
5144 | |
---|
5145 | The flag values are coded as constants in db/const.txt to make them easier to use: |
---|
5146 | - bc_all: Broadcast message is sent server-wide |
---|
5147 | - bc_map: Message is sent to everyone in the same map |
---|
5148 | - bc_area: Message is sent to players in the vecinity of the source. |
---|
5149 | - bc_self: Message is sent only to current player. |
---|
5150 | |
---|
5151 | - bc_npc: Broadcast source is the npc, not the player attached to the script |
---|
5152 | (useful when a player is not attached or the message should be sent to those |
---|
5153 | nearby the npc) |
---|
5154 | |
---|
5155 | - bc_yellow: The default is to send broadcasts in yellow color. |
---|
5156 | - bc_blue: Alternate broadcast is displayed in blue color. |
---|
5157 | |
---|
5158 | The optional parameter, color, allows usage of broadcasts in any custom color. |
---|
5159 | The color parameter is a single number which can be in hexadecimal notation. |
---|
5160 | For example: |
---|
5161 | announce "This will be shown to everyone at all in yellow.",bc_all,0xFFFF00; |
---|
5162 | Will display a global announce in yellow. The color format is in RGB (0xRRGGBB). |
---|
5163 | |
---|
5164 | Using this for private messages to players is probably not that good an idea, |
---|
5165 | but it can be used instead in NPCs to "preview" an announce. |
---|
5166 | |
---|
5167 | // This will be a private message to the player using the NPC that made the |
---|
5168 | // annonucement |
---|
5169 | announce "This is my message just for you",bc_blue|bc_self; |
---|
5170 | |
---|
5171 | // This will be shown on everyones screen that is in sight of the NPC. |
---|
5172 | announce "This is my message just for you people here",bc_area; |
---|
5173 | |
---|
5174 | --------------------------------------- |
---|
5175 | |
---|
5176 | *mapannounce "<map name>","<text>",<flag>{,<color>}; |
---|
5177 | |
---|
5178 | This command will work like 'announce' but will only broadcast to characters |
---|
5179 | currently residing on the specified map. The flag and optional color |
---|
5180 | parameters are the same as in 'announce', even though the only ones that make |
---|
5181 | sense are the color related ones. |
---|
5182 | |
---|
5183 | --------------------------------------- |
---|
5184 | |
---|
5185 | *areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>[,<color>]; |
---|
5186 | |
---|
5187 | This command works like 'announce' but will only broadcast to characters |
---|
5188 | residing in the specified x1/y1-x2/y2 square on the map given. The flags and |
---|
5189 | color parameter given are the same as in 'announce', but only the color |
---|
5190 | related ones have effect. |
---|
5191 | |
---|
5192 | areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0; |
---|
5193 | |
---|
5194 | --------------------------------------- |
---|
5195 | |
---|
5196 | *callshop "<name>",<option>; |
---|
5197 | |
---|
5198 | These are a series of commands used to create dynamic shops. |
---|
5199 | The callshop function calls a invisible shop (view -1) as if the player clicked on it. |
---|
5200 | |
---|
5201 | For the options on callShop: |
---|
5202 | 0 = The normal window (buy, sell and cancel) |
---|
5203 | 1 = The buy window |
---|
5204 | 2 = The sell window |
---|
5205 | |
---|
5206 | Example(s): |
---|
5207 | |
---|
5208 | callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu. |
---|
5209 | |
---|
5210 | The shop which is called by callshop (as long as an npcshop* command is executed |
---|
5211 | from that NPC (see note 1)) will trigger the labels OnBuyItem and OnSellitem. These |
---|
5212 | labels can take over handling for relatively the buying of items from the shop |
---|
5213 | and selling the items to a shop. Via these labels you can customize the way an item |
---|
5214 | is bought or sold by a player. |
---|
5215 | |
---|
5216 | In the OnBuyItem, two arrays are set (@bought_nameid and @bough_quantity), which |
---|
5217 | hold information about the name id (item id) sold and the amount sold of it. Same |
---|
5218 | goes for the OnSellItem label, only the variables are named different |
---|
5219 | (@sold_nameid and @sold_quantity). An example on a shop comes with eAthena, and |
---|
5220 | can be found in the npc/sample/npc_dynamic_shop.txt file. |
---|
5221 | |
---|
5222 | This example shows how to use the labels and their set variables to create a dynamic shop. |
---|
5223 | |
---|
5224 | Note 1: These labels will only be triggered if a npcshop* command is executed, this is |
---|
5225 | because these commands set a special data on the shop npc,named master_nd in the source. |
---|
5226 | The OnSellItem and OnBuyItem are triggered in the NPC whose master_nd is given in the shop. |
---|
5227 | This was found out thanks to 'Hondacrx', noticing the OnBuyItem wasn't triggered unless |
---|
5228 | npcshopitem was used. After rechecking the source, I found what caused this. |
---|
5229 | |
---|
5230 | --------------------------------------- |
---|
5231 | |
---|
5232 | *npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}} |
---|
5233 | |
---|
5234 | This command lets you override the contents of an existing npc shop. The |
---|
5235 | current sell list will be wiped, and only the items specified with the price |
---|
5236 | specified will be for sale. |
---|
5237 | |
---|
5238 | The function returns 1 if shop was updated successfully, or 0 if not found. |
---|
5239 | |
---|
5240 | Note that you cannot use -1 to specify default selling price! |
---|
5241 | |
---|
5242 | --------------------------------------- |
---|
5243 | |
---|
5244 | *npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}} |
---|
5245 | |
---|
5246 | This command will add more items at the end of the selling list for the |
---|
5247 | specified npc shop. If you specify an item already for sell, that item will |
---|
5248 | appear twice on the sell list. |
---|
5249 | |
---|
5250 | The function returns 1 if shop was updated successfully, or 0 if not found. |
---|
5251 | |
---|
5252 | Note that you cannot use -1 to specify default selling price! |
---|
5253 | |
---|
5254 | --------------------------------------- |
---|
5255 | |
---|
5256 | *npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}} |
---|
5257 | |
---|
5258 | This command will remove items from the specified npc shop. |
---|
5259 | If the item to remove exists more than once on the shop, all instances will be |
---|
5260 | removed. |
---|
5261 | |
---|
5262 | Note that the function returns 1 even if no items were removed. The return |
---|
5263 | value is only to confirm that the shop was indeed found. |
---|
5264 | |
---|
5265 | --------------------------------------- |
---|
5266 | |
---|
5267 | *npcshopattach "<name>"{,<flag>} |
---|
5268 | |
---|
5269 | This command will attach the current script to the given npc shop. |
---|
5270 | When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem" |
---|
5271 | of your script will be executed whenever a player buys/sells from the shop. |
---|
5272 | Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[] |
---|
5273 | and @sold_quantity[] will be filled up with the items and quantities |
---|
5274 | bought/sold. |
---|
5275 | |
---|
5276 | The optional parameter specifies whether to attach ("1") or detach ("0") from |
---|
5277 | the shop (the default is to attach). Note that detaching will detach any npc |
---|
5278 | attached to the shop, even if it's from another script, while attaching will |
---|
5279 | override any other script that may be already attached. |
---|
5280 | |
---|
5281 | The function returns 0 if the shop was not found, 1 otherwise. |
---|
5282 | |
---|
5283 | --------------------------------------- |
---|
5284 | |
---|
5285 | *waitingroom "<chatroom name>",<limit>{,<event label>,<trigger>}; |
---|
5286 | |
---|
5287 | This command will create a chat room, owned by the NPC object running this |
---|
5288 | script and displayed above the NPC sprite. |
---|
5289 | The maximum length of a chatroom name is 60 letters. |
---|
5290 | |
---|
5291 | The limit is the maximum number of people allowed to enter the chat room. If the |
---|
5292 | optional event and trigger parameters are given, the event label |
---|
5293 | ("<NPC object name>::<label name>") will be invoked as if with a 'doevent' upon |
---|
5294 | the number of people in the chat room reaching the given triggering amount. |
---|
5295 | |
---|
5296 | It's funny, but for compatibility with jAthena, you can swap the event label and |
---|
5297 | the trigger parameters, and it will still work. |
---|
5298 | |
---|
5299 | // The NPC will just show a box above its head that says "Hello World", clicking |
---|
5300 | // it will do nothing, since the limit is zero. |
---|
5301 | waitingroom "Hello World",0; |
---|
5302 | |
---|
5303 | // The NPC will have a box above its head, it will say "Disco - Waiting Room" |
---|
5304 | // and will have 8 waiting slots. Clicking this will enter the chat room, where |
---|
5305 | // the player will be able to wait until 8 people accumulate. Once this happens, |
---|
5306 | // it will cause the NPC "Bouncer" run the label "OnStart" |
---|
5307 | |
---|
5308 | waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",8; |
---|
5309 | |
---|
5310 | Creating a waiting room does not stop the execution of the script and it will |
---|
5311 | continue to the next line. |
---|
5312 | |
---|
5313 | For more examples see the 2-1 and 2-2 job quest scripts which make extensive use |
---|
5314 | of waiting rooms. |
---|
5315 | |
---|
5316 | --------------------------------------- |
---|
5317 | |
---|
5318 | *delwaitingroom {"<NPC object name"}; |
---|
5319 | |
---|
5320 | This command will delete a waiting room. If no parameter is given, it will |
---|
5321 | delete a waiting room attached to the NPC object running this command, if it is, |
---|
5322 | it will delete a waiting room owned by another NPC object. This is the only way |
---|
5323 | to get rid of a waiting room, nothing else will cause it to disappear. |
---|
5324 | |
---|
5325 | It's not clear what happens to a waiting room if the NPC is disabled with |
---|
5326 | 'disablenpc', by the way. |
---|
5327 | |
---|
5328 | --------------------------------------- |
---|
5329 | |
---|
5330 | *enablewaitingroomevent {"<NPC object name>"}; |
---|
5331 | *disablewaitingroomevent {"<NPC object name>"}; |
---|
5332 | *enablearena; |
---|
5333 | *disablearena; |
---|
5334 | |
---|
5335 | This will enable and disable triggering the waiting room event (see |
---|
5336 | 'waitingroom') respectively. Optionally giving an NPC object name will do that |
---|
5337 | for a specified NPC object. The chat room will not disappear when triggering is |
---|
5338 | disabled and enabled in this manner and players will not be kicked out of it. |
---|
5339 | Enabling a chat room event will also cause it to immediately check whether the |
---|
5340 | number of users in it exceeded the trigger amount and trigger the event |
---|
5341 | accordingly. |
---|
5342 | |
---|
5343 | Normally, whenever a waiting room was created to make sure that only one |
---|
5344 | character is, for example, trying to pass a job quest trial, and no other |
---|
5345 | characters are present in the room to mess up the script. |
---|
5346 | |
---|
5347 | The 'enablearena'/'disablearena' commands are just aliases with no parameter. |
---|
5348 | These are supposedly left here for compatibility with official server scripts, |
---|
5349 | but no eathena script uses these at the moment. |
---|
5350 | |
---|
5351 | --------------------------------------- |
---|
5352 | |
---|
5353 | *getwaitingroomstate(<information type>{,"<NPC object name>"}) |
---|
5354 | |
---|
5355 | This function will return information about the wating room state for the |
---|
5356 | attached waiting room or for a waiting room attached to the specified NPC if |
---|
5357 | any. |
---|
5358 | |
---|
5359 | The valid information types are: |
---|
5360 | |
---|
5361 | 0 - Number of users currently chatting. |
---|
5362 | 1 - Maximum number of users allowed. |
---|
5363 | 2 - Will return 1 if the waiting room has a trigger set. |
---|
5364 | 0 otherwise. |
---|
5365 | 3 - Will return 1 if the waiting room is currently disabled. |
---|
5366 | 0 otherwise. |
---|
5367 | 4 - The Title of the waiting room (string) |
---|
5368 | 5 - Password of the waiting room, if any. Pointless, since there is no way to |
---|
5369 | set a password on a waiting room right now. |
---|
5370 | 16 - Event name of the waiting room (string) |
---|
5371 | 32 - Whether or not the waiting room is full. |
---|
5372 | 33 - Whether the amount of users in the waiting room is higher than the trigger |
---|
5373 | number. |
---|
5374 | |
---|
5375 | --------------------------------------- |
---|
5376 | |
---|
5377 | *warpwaitingpc "<map name>",<x>,<y>{,<number of people>}; |
---|
5378 | |
---|
5379 | This command will warp the amount of characters equal to the trigger number of |
---|
5380 | the waiting room chat attached to the NPC object running this command to the |
---|
5381 | specified map and coordinates, kicking them out of the chat. Those waiting the |
---|
5382 | longest will get warped first. It can also do a random warp on the same map |
---|
5383 | ("Random" instead of map name) and warp to the save point ("SavePoint"). |
---|
5384 | |
---|
5385 | The list of characters to warp is taken from the list of the chat room members. |
---|
5386 | Those not in the chat room will not be considered even if they are talking to |
---|
5387 | the NPC in question. If the number of people is given, exactly this much people |
---|
5388 | will be warped. |
---|
5389 | |
---|
5390 | This command can also keep track of who just got warped. It does this by setting |
---|
5391 | special variables: |
---|
5392 | |
---|
5393 | $@warpwaitingpc[] is an array containing the character id numbers of the |
---|
5394 | characters who were just warped. |
---|
5395 | $@warpwaitingpcnum contains the number of the character it just warped. |
---|
5396 | |
---|
5397 | See also 'getpartymember' for advice on what to do with those variables. |
---|
5398 | |
---|
5399 | The obvious way of using this effectively would be to set up a waiting room for |
---|
5400 | two characters to be warped onto a random PVP map for a one-on-one duel, for |
---|
5401 | example. |
---|
5402 | |
---|
5403 | --------------------------------------- |
---|
5404 | |
---|
5405 | *waitingroomkickall {"<NPC object name>"}; |
---|
5406 | |
---|
5407 | This command would kick everybody out of a specified waiting room chat. IF it |
---|
5408 | was properly linked into the script interpreter which it isn't, even though the |
---|
5409 | code for it is in place. Expect this to become available in upcoming SVN |
---|
5410 | releases. |
---|
5411 | |
---|
5412 | --------------------------------------- |
---|
5413 | |
---|
5414 | *setmapflagnosave "<map name>","<alternate map name>",<x>,<y>; |
---|
5415 | |
---|
5416 | This command sets the 'nosave' flag for the specified map and also gives an |
---|
5417 | alternate respawn-upon-relogin point. |
---|
5418 | |
---|
5419 | It does not make a map impossible to make a savepoint on as you would normally |
---|
5420 | think, 'savepoint' will still work. It will, however, make the specified map |
---|
5421 | kick the reconnecting players off to the alternate map given to the coordinates |
---|
5422 | specified. |
---|
5423 | |
---|
5424 | --------------------------------------- |
---|
5425 | |
---|
5426 | *setmapflag "<map name>",<flag>; |
---|
5427 | |
---|
5428 | This command marks a specified map with a map flag given. Map flags alter the |
---|
5429 | behavior of the map, you can see the list of the available ones in |
---|
5430 | 'db/const.txt' under 'mf_'. |
---|
5431 | |
---|
5432 | The map flags alter the behavior of the map regarding teleporting (mf_nomemo, |
---|
5433 | mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected |
---|
5434 | (mf_nosave), dead branch usage (mf_nobranch), penalties upon death |
---|
5435 | (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty, |
---|
5436 | mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use |
---|
5437 | skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall), |
---|
5438 | current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds, |
---|
5439 | mf_fireworks) and whether day/night will be in effect on this map (mf_indoors). |
---|
5440 | |
---|
5441 | --------------------------------------- |
---|
5442 | |
---|
5443 | *setbattleflag "<battle flag>",<value>; |
---|
5444 | *getbattleflag "<battle flag>"; |
---|
5445 | |
---|
5446 | Sets or gets the value of the given battle flag. |
---|
5447 | Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script. |
---|
5448 | |
---|
5449 | Example(s): |
---|
5450 | |
---|
5451 | //will set the base experience rate to 20x (2000%) |
---|
5452 | setBattleFlag "base_exp_rate",2000; |
---|
5453 | |
---|
5454 | //will return the value of the base experience rate (when used after the above example, it would return 2000). |
---|
5455 | getBattleFlag "base_exp_rate"; |
---|
5456 | |
---|
5457 | --------------------------------------- |
---|
5458 | |
---|
5459 | *removemapflag "<map name>",<flag>; |
---|
5460 | |
---|
5461 | This command removes a mapflag from a specified map. See 'setmapflag'. |
---|
5462 | |
---|
5463 | --------------------------------------- |
---|
5464 | |
---|
5465 | *warpportal <x>,<y>,"<mapname>",<x>,<y>; |
---|
5466 | |
---|
5467 | Creates a warp Portal as if a acolyte class character did it. |
---|
5468 | The first x and y is the place of the warp portal on the map where the NPC is on |
---|
5469 | The mapname and second x and y is the target area of the warp portal. |
---|
5470 | |
---|
5471 | Example(s): |
---|
5472 | |
---|
5473 | //Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180. |
---|
5474 | warpPortal 150,150,"prontera",150,180; |
---|
5475 | |
---|
5476 | --------------------------------------- |
---|
5477 | |
---|
5478 | *mapwarp "<from map>","<to map>",<x>,<y>; |
---|
5479 | |
---|
5480 | This command will collect all characters located on the From map and warp them |
---|
5481 | wholesale to the same point on the To map, or randomly distribute them there if |
---|
5482 | the coordinates are zero. "Random" is understood as a special To map name and |
---|
5483 | will mean randomly shuffling everyone on the same map. |
---|
5484 | |
---|
5485 | --------------------------------------- |
---|
5486 | \\ |
---|
5487 | 5,2.- Guild-related Commands |
---|
5488 | \\ |
---|
5489 | --------------------------------------- |
---|
5490 | |
---|
5491 | *maprespawnguildid "<map name>",<guild id>,<flag>; |
---|
5492 | |
---|
5493 | This command goes through the specified map and for each player and monster |
---|
5494 | found there does stuff. |
---|
5495 | |
---|
5496 | Flag is a bitmask (add up numbers to get effects you want) |
---|
5497 | 1 - warp all guild members to their savepoints. |
---|
5498 | 2 - warp all non-guild members to their savepoints. |
---|
5499 | 4 - remove all monsters which are not guardian or emperium. |
---|
5500 | |
---|
5501 | Flag 7 will, therefore, mean 'wipe all mobs but guardians and the emperium and |
---|
5502 | kick all characters out', which is what the official scripts do upon castle |
---|
5503 | surrender. Upon start of WoE, the scripts do 2 (warp all intruiders out). |
---|
5504 | |
---|
5505 | Characters not belonging to any guild will warp out regardless of the flag setting. |
---|
5506 | |
---|
5507 | For examples, check the WoE scripts in the distribution. |
---|
5508 | |
---|
5509 | --------------------------------------- |
---|
5510 | |
---|
5511 | *agitstart; |
---|
5512 | *agitend; |
---|
5513 | |
---|
5514 | These two commands will start and end War of Emperium. |
---|
5515 | |
---|
5516 | This is a bit more complex than it sounds, since the commands themselves won't |
---|
5517 | actually do anything interesting, except causing all 'OnAgitStart:' and |
---|
5518 | 'OnAgitEnd:' events to run everywhere, respectively. They are used as |
---|
5519 | simple triggers to run a lot of complex scripts all across the server, and they, |
---|
5520 | in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label. |
---|
5521 | |
---|
5522 | --------------------------------------- |
---|
5523 | |
---|
5524 | *gvgon "<map name>"; |
---|
5525 | *gvgoff "<map name>"; |
---|
5526 | |
---|
5527 | These commands will turn GVG mode for the specified maps on and off, setting up |
---|
5528 | appropriate map flags. In GVG mode, maps behave as if during the time of WoE, |
---|
5529 | even though WoE itself may or may not actually be in effect. |
---|
5530 | |
---|
5531 | --------------------------------------- |
---|
5532 | |
---|
5533 | *flagemblem <guild id>; |
---|
5534 | |
---|
5535 | This command only works when run by the NPC objects which have sprite id 722, |
---|
5536 | which is a 3D guild flag sprite. If it isn't, the data will change, but nothing |
---|
5537 | will be seen by anyone. If it is invoked in that manner, the emblem of the |
---|
5538 | specified guild will appear on the flag, though, if any players are watching it |
---|
5539 | at this moment, they will not see the emblem change until they move out of sight |
---|
5540 | of the flag and return. |
---|
5541 | |
---|
5542 | This is commonly used in official guildwar scripts with a function call which |
---|
5543 | returns a guild id: |
---|
5544 | |
---|
5545 | // This will change the emblem on the flag to that of the guild that owns |
---|
5546 | // "guildcastle" |
---|
5547 | |
---|
5548 | flagemblem GetCastleData("guildcastle",1); |
---|
5549 | |
---|
5550 | --------------------------------------- |
---|
5551 | |
---|
5552 | *guardian("<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"}{,<guardian index>}) |
---|
5553 | |
---|
5554 | This command is roughly equivalent to 'monster', but is meant to be used with |
---|
5555 | castle guardian monsters and will only work with them. It will set the guardian |
---|
5556 | characteristics up according to the castle's investment values and otherwise |
---|
5557 | set the things up that only castle guardians need. |
---|
5558 | |
---|
5559 | Since trunk r12524: |
---|
5560 | Returns the id of the mob or 0 if an error occurred. |
---|
5561 | When 'guardian index' isn't supplied it produces a temporary guardian. |
---|
5562 | Temporary guardians are not saved with the castle and can't be accessed by guardianinfo. |
---|
5563 | |
---|
5564 | --------------------------------------- |
---|
5565 | |
---|
5566 | *guardianinfo("<map name>", <guardian number>, <type>) |
---|
5567 | |
---|
5568 | This function will return various info about the specified guardian, or -1 |
---|
5569 | if it fails for some reason. It is primarily used in the castle manager npc. |
---|
5570 | |
---|
5571 | Map name and guardian number (value between 0 and 7) define the target. |
---|
5572 | Type indicates what information to return: |
---|
5573 | 0 - visibility (whether the guardian is installed or not) |
---|
5574 | 1 - max. hp |
---|
5575 | 2 - current hp |
---|
5576 | |
---|
5577 | --------------------------------------- |
---|
5578 | // |
---|
5579 | 5,2.- End of guild-related commands |
---|
5580 | // |
---|
5581 | --------------------------------------- |
---|
5582 | |
---|
5583 | *npcspeed <speed value>; |
---|
5584 | *npcwalkto <x>,<y>; |
---|
5585 | *npcstop; |
---|
5586 | |
---|
5587 | These commands will make the NPC object in question move around the map. As they |
---|
5588 | currently are, they are a bit buggy and are not useful for much more than making |
---|
5589 | an NPC move randomly around the map. (see 'npc/custom/devnpc.txt' for an example |
---|
5590 | of such usage) |
---|
5591 | |
---|
5592 | 'npcspeed' will set the NPCs walking speed to a specified value. As in the |
---|
5593 | @speed GM command, 200 is the slowest possible speed while 0 is the fastest |
---|
5594 | possible (instant motion). 100 is the default character walking speed. |
---|
5595 | 'npcwalkto' will start the NPC sprite moving towards the specified coordinates |
---|
5596 | on the same map as it is currently on. |
---|
5597 | 'npcstop' will stop the motion. |
---|
5598 | |
---|
5599 | While in transit, the NPC will be clickable, but invoking it will cause it to |
---|
5600 | stop motion, which will make it's coordinates different from what the client |
---|
5601 | computed based on the speed and motion coordinates. The effect is rather |
---|
5602 | unnerving. |
---|
5603 | |
---|
5604 | Only a few NPC sprites have walking animations, and those that do, do not get |
---|
5605 | the animation invoked when moving the NPC, due to the problem in the npc walking |
---|
5606 | code, which looks a bit silly. You might have better success by defining a job- |
---|
5607 | sprite based sprite id in 'db/mob-avail.txt' with this. |
---|
5608 | |
---|
5609 | --------------------------------------- |
---|
5610 | |
---|
5611 | *movenpc <NPC name>,x,y; |
---|
5612 | |
---|
5613 | This command looks like the NPCWalkToxy function,but is a little different. |
---|
5614 | |
---|
5615 | While NPCWalkToXY just makes the NPC 'walk' to the coordinates given |
---|
5616 | (which sometimes gives problems if the path isn't a straight line without objects), |
---|
5617 | this command just moves the NPC. It basically warps out and in on the current and given spot. |
---|
5618 | |
---|
5619 | Example(s): |
---|
5620 | |
---|
5621 | //This will move Bugga from it's current position to the coords 100,20 (if those coords are walkable (legit)). |
---|
5622 | moveNPC "Bugga",100,20; |
---|
5623 | |
---|
5624 | --------------------------------------- |
---|
5625 | |
---|
5626 | ===================== |
---|
5627 | |6.- Other commands.| |
---|
5628 | ===================== |
---|
5629 | --------------------------------------- |
---|
5630 | |
---|
5631 | *debugmes "<message>"; |
---|
5632 | |
---|
5633 | This command will send the message to the server console (map-server window). It |
---|
5634 | will not be displayed anywhere else. |
---|
5635 | |
---|
5636 | debugmes strcharinfo(0)+" has just done this that and the other"; |
---|
5637 | // You would see in the map-server window "NAME has just done this that and |
---|
5638 | // the other" |
---|
5639 | |
---|
5640 | --------------------------------------- |
---|
5641 | |
---|
5642 | *logmes "<message>"; |
---|
5643 | |
---|
5644 | This command will write the message given to the map server npc log file, as |
---|
5645 | specified in 'conf/log_athena.conf'. In the TXT version of the server, the log |
---|
5646 | file is 'log/npclog.log' by default. In the SQL version, if SQL logging is |
---|
5647 | enabled, the message will go to the 'npclog' table, otherwise, it will go to the |
---|
5648 | same log file. |
---|
5649 | |
---|
5650 | If logs are not enabled, nothing will happen. |
---|
5651 | |
---|
5652 | --------------------------------------- |
---|
5653 | |
---|
5654 | *globalmes "<message>"{,"<NPC name>"}; |
---|
5655 | |
---|
5656 | This command will send a message to the chat window of all currently connected |
---|
5657 | characters. |
---|
5658 | |
---|
5659 | If NPC name is specified, the message will be sent as if the sender would be |
---|
5660 | the npc with the said name. |
---|
5661 | |
---|
5662 | --------------------------------------- |
---|
5663 | |
---|
5664 | *rand(<number>{,<number>}); |
---|
5665 | |
---|
5666 | This function returns a number, randomly positioned between 0 and the number you |
---|
5667 | specify (if you only specify one) and the two numbers you specify if you give it |
---|
5668 | two. |
---|
5669 | |
---|
5670 | rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9 |
---|
5671 | |
---|
5672 | rand(2,10) would result in 2,3,4,5,6,7,8,9 or 10 |
---|
5673 | |
---|
5674 | --------------------------------------- |
---|
5675 | |
---|
5676 | *viewpoint <action>,<x>,<y>,<point number>,<color>; |
---|
5677 | |
---|
5678 | This command will mark places on the mini map in the client connected to the |
---|
5679 | invoking character. It uses the normal X and Y coordinates from the main map. |
---|
5680 | The colors of the marks are defined using a hexidecimal number, same as the ones |
---|
5681 | used to color text in 'mes' output, but are written as hexadecimal numbers in C. |
---|
5682 | (They look like 0x<six numbers>.) |
---|
5683 | |
---|
5684 | Action is what you want to do with a point, 1 will set it, while 2 will clear |
---|
5685 | it. Point number is the number of the point - you can have several. If more than |
---|
5686 | one point is drawn at the same coordinates, they will cycle, which can be used |
---|
5687 | to create flashing marks. |
---|
5688 | |
---|
5689 | // This command will show a mark at coordinates X 30 Y 40, is mark number 1, |
---|
5690 | // and will be red. |
---|
5691 | |
---|
5692 | viewpoint 1,30,40,1,0xFF0000; |
---|
5693 | |
---|
5694 | This will create three points: |
---|
5695 | |
---|
5696 | viewpoint 1,30,40,1,0xFF0000; |
---|
5697 | viewpoint 1,35,45,2,0xFF0000; |
---|
5698 | viewpoint 1,40,50,3,0xFF0000; |
---|
5699 | |
---|
5700 | And this is how you remove them: |
---|
5701 | |
---|
5702 | viewpoint 2,30,40,1,0xFF0000; |
---|
5703 | viewpoint 2,35,45,2,0xFF0000; |
---|
5704 | viewpoint 2,40,50,3,0xFF0000; |
---|
5705 | |
---|
5706 | The client determines what it does with the points entirely, the server keeps no |
---|
5707 | memory of where the points are set whatsoever. |
---|
5708 | |
---|
5709 | --------------------------------------- |
---|
5710 | |
---|
5711 | *cutin "<filename>",<position>; |
---|
5712 | |
---|
5713 | This command will display a picture stored in the GRF file in the client for the |
---|
5714 | player. |
---|
5715 | |
---|
5716 | The files are taken from '\data\texture\A_A£AIIAI«§\illust' directory in the |
---|
5717 | GRF file. Also it seems that card cutins from \cardbmp will work here as well. |
---|
5718 | Only bitmaps (images stored in the bitmap format) will actually get displayed. |
---|
5719 | The '.bmp' extension is optional. |
---|
5720 | The client has no problem rendering huge 4096x4096 bitmaps, but usually they're |
---|
5721 | around 500x500. Bright magenta (color FF00FF) is considered to be transparent in |
---|
5722 | these pictures. You can easily add and alter them, but how to do this is outside |
---|
5723 | of the scope of this document. |
---|
5724 | |
---|
5725 | The position determines just where on screen the picture will appear: |
---|
5726 | 0 - bottom left corner |
---|
5727 | 1 - bottom middle |
---|
5728 | 2 - bottom right corner |
---|
5729 | 3 - middle of screen in a movable window with an empty title bar. |
---|
5730 | 4 - middle of screen without the window header, but still movable. |
---|
5731 | 255 - will remove the cutin previously displayed. |
---|
5732 | |
---|
5733 | Giving an empty string for the filename and 255 for the position will remove all |
---|
5734 | cutin pictures. Any other position value will not cause a script error but will |
---|
5735 | cause the player's client to curl up and die. Only one cutin may be on screen at |
---|
5736 | any given time, any new cutins will replace it. |
---|
5737 | |
---|
5738 | // This will display the picture of the 7th kafra, |
---|
5739 | // the one in orange and the mini-skirt :P |
---|
5740 | cutin "kafra_7",2; |
---|
5741 | |
---|
5742 | // This will remove the displayed picture. |
---|
5743 | cutin "Kafra_7",255; |
---|
5744 | |
---|
5745 | // This will remove all pictures displayed. |
---|
5746 | cutin "",255; |
---|
5747 | |
---|
5748 | --------------------------------------- |
---|
5749 | |
---|
5750 | *pet <pet id>; |
---|
5751 | |
---|
5752 | This command is used in all the item scripts for taming items. Running this |
---|
5753 | command will make the pet catching cursor appear on the client connected to the |
---|
5754 | invoking character, usable on the monsters with the specified pet ID number. It |
---|
5755 | will still work outside an item script. |
---|
5756 | |
---|
5757 | A full list of pet IDs can be found inside 'db/pet_db.txt' |
---|
5758 | |
---|
5759 | --------------------------------------- |
---|
5760 | |
---|
5761 | *emotion <emotion number>{, target}; |
---|
5762 | |
---|
5763 | This command makes an object display an emoticon sprite above their own as |
---|
5764 | if they were doing that emotion. For a full list of emotion numbers, |
---|
5765 | see 'db/const.txt' under 'e_'. The inobvious ones are 'e_what' (a question mark) |
---|
5766 | and 'e_gasp' (the exclamation mark). |
---|
5767 | |
---|
5768 | The optional target parameter specifies who will get the emotion on top of |
---|
5769 | their head. If 0 (the default if omitted), the NPC in current use will show |
---|
5770 | the emotion, if 1, the player that is running the script will display it. |
---|
5771 | |
---|
5772 | --------------------------------------- |
---|
5773 | |
---|
5774 | *misceffect <effect number>; |
---|
5775 | |
---|
5776 | This command, if run from an NPC object that has a sprite, will call up a |
---|
5777 | specified effect number, centered on the NPC sprite. If the running code does |
---|
5778 | not have an object ID (a 'floating' npc) or is not running from an NPC object at |
---|
5779 | all (an item script) the effect will be centered on the character who's RID got |
---|
5780 | attached to the script, if any. For usable item scripts, this command will |
---|
5781 | create an effect centered on the player using the item. |
---|
5782 | |
---|
5783 | A full list of known effects is found in 'doc/effect_list.txt'. The list of |
---|
5784 | those that actually work may differ greatly between client versions. |
---|
5785 | |
---|
5786 | --------------------------------------- |
---|
5787 | |
---|
5788 | *soundeffect "<effect filename>",<type> |
---|
5789 | *soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>} |
---|
5790 | |
---|
5791 | These two commands will play a sound effect to either the invoking character |
---|
5792 | only ('soundeffect') or multiple characters ('soundeffectall'). If the running |
---|
5793 | code does not have an object ID (a 'floating' npc) or is not running from an NPC |
---|
5794 | object at all (an item script) the sound will be centered on the character who's |
---|
5795 | RID got attached to the script, if any. If it does, it will be centered on that |
---|
5796 | object. (an NPC sprite) |
---|
5797 | |
---|
5798 | Effect filename is the filename in a GRF. It must have the .wav extension. |
---|
5799 | |
---|
5800 | It's not quite certain what the 'type' actually does, it is sent to the client |
---|
5801 | directly. It probably determines which directory to play the effect from. |
---|
5802 | It's certain that giving 0 for the number will play sound files from 'data/wav', |
---|
5803 | but where the other numbers will read from is unclear. |
---|
5804 | |
---|
5805 | You can add your own effects this way, naturally. |
---|
5806 | |
---|
5807 | --------------------------------------- |
---|
5808 | |
---|
5809 | *pvpon "<map name>"; |
---|
5810 | *pvpoff "<map name>"; |
---|
5811 | |
---|
5812 | These commands will turn PVP mode for the specified maps on and off. Beside |
---|
5813 | setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP |
---|
5814 | timer and ranking as will @pvpon GM command do. |
---|
5815 | |
---|
5816 | --------------------------------------- |
---|
5817 | |
---|
5818 | *atcommand "<command line>"; |
---|
5819 | |
---|
5820 | This command will run the given command line exactly as if it was typed in from |
---|
5821 | the keyboard by the player connected to the invoking character, and that |
---|
5822 | character belonged to an account which had GM level 99. |
---|
5823 | |
---|
5824 | // This will ask the invoker for a character name and then use the '@nuke' |
---|
5825 | // GM command on them, killing them mercilessly. |
---|
5826 | input @player$; |
---|
5827 | atcommand "@nuke "+@player$; |
---|
5828 | |
---|
5829 | This command has a lot of good uses, I am sure you can have some fun with this |
---|
5830 | one. |
---|
5831 | |
---|
5832 | --------------------------------------- |
---|
5833 | |
---|
5834 | *charcommand <command>; |
---|
5835 | |
---|
5836 | NOTE: This command is changed a bit on newer trunk versions, |
---|
5837 | scroll down a bit for the new version! |
---|
5838 | |
---|
5839 | On older trunk versions and stable: |
---|
5840 | |
---|
5841 | command is the name of the current character (strcharinfo(0)) |
---|
5842 | followed by ':' and the command and it's parameters. |
---|
5843 | |
---|
5844 | Example(s): |
---|
5845 | |
---|
5846 | //Will be executed as if a lvl 99 GM done the #option command. |
---|
5847 | charCommand strcharinfo(0)+":#option 0 0 0 Roy"; |
---|
5848 | |
---|
5849 | Newer Trunk version: |
---|
5850 | |
---|
5851 | The big change is that the character name is no longer needed. |
---|
5852 | This also enabled the commands to run without a player attached (according to Lance). |
---|
5853 | |
---|
5854 | Example(s): |
---|
5855 | |
---|
5856 | //this would do the same as above, but now doesn't need a player attached by default. |
---|
5857 | charCommand "#option 0 0 0 Roy"; |
---|
5858 | |
---|
5859 | --------------------------------------- |
---|
5860 | |
---|
5861 | *unitskilluseid <GID>,<skill id>,<skill lvl>{,<target id>}; |
---|
5862 | *unitskilluseid <GID>,"<skill name>",<skill lvl>{,<target id>}; |
---|
5863 | *unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>; |
---|
5864 | *unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>; |
---|
5865 | |
---|
5866 | This is the replacement of the older commands, these use the same values for |
---|
5867 | GID as the other unit* commands (See 'GID'). |
---|
5868 | |
---|
5869 | Skill ID is the ID of the skill, skill level is the level of the skill. |
---|
5870 | For the position, the x and y are given in the unitSkillUsePos. |
---|
5871 | |
---|
5872 | --------------------------------------- |
---|
5873 | |
---|
5874 | *day; |
---|
5875 | *night; |
---|
5876 | |
---|
5877 | These two commands will switch the entire server between day and night mode. |
---|
5878 | Depending on the configuration, it may cause differing client effects. If your |
---|
5879 | server is set to cycle between day and night, it will eventually return to that |
---|
5880 | cycle. |
---|
5881 | |
---|
5882 | This example will set the night time to start at 03 AM and end at 08 AM, and the |
---|
5883 | nighttime will persist if the server restarts during the night, if the automated |
---|
5884 | day/night switching is turned off in the configuration files. Figure it out on |
---|
5885 | your own: |
---|
5886 | |
---|
5887 | -%TAB%script%TAB%DayNight%TAB%-1,{ |
---|
5888 | |
---|
5889 | end; |
---|
5890 | |
---|
5891 | OnClock0300: |
---|
5892 | |
---|
5893 | OnClock0800: |
---|
5894 | |
---|
5895 | OnInit: |
---|
5896 | |
---|
5897 | set $@minutesfrommidnight, gettime(3)*60+gettime(2); |
---|
5898 | |
---|
5899 | set $@night_start, 180; // 03:00 |
---|
5900 | set $@night_end, 480; // 08:00 |
---|
5901 | |
---|
5902 | if ($@minutesfrommidnight>=$@night_start && $@minutesfrommidnight<$@night_end) goto StartNight; |
---|
5903 | |
---|
5904 | goto StartDay; |
---|
5905 | StartNight: |
---|
5906 | night; |
---|
5907 | end; |
---|
5908 | StartDay: |
---|
5909 | day; |
---|
5910 | end; } |
---|
5911 | |
---|
5912 | --------------------------------------- |
---|
5913 | |
---|
5914 | *defpattern <set number>,"<regular expression pattern>","<event label>"; |
---|
5915 | *activatepset <set number>; |
---|
5916 | *deactivatepset <set number>; |
---|
5917 | *deletepset <set number>; |
---|
5918 | |
---|
5919 | This set of commands is only available if the server is compiled with regular |
---|
5920 | expressions library enabled. Default compilation and most binary distributions |
---|
5921 | aren't, which is probably bad, since these, while complex to use, are quite |
---|
5922 | fascinating. |
---|
5923 | |
---|
5924 | They will make the NPC object listen for text spoken publicly by players and |
---|
5925 | match it against regular expression patterns, then trigger labels associated |
---|
5926 | with these regular expression patterns. |
---|
5927 | |
---|
5928 | Patterns are organised into sets, which are referred to by a set number. You can |
---|
5929 | have multiple sets patterns, and multiple patterns may be active at once. |
---|
5930 | Numbers for pattern sets start at 1. |
---|
5931 | |
---|
5932 | 'defpattern' will associate a given regular expression pattern with an event |
---|
5933 | label. This event will be triggered whenever something a player says is matched |
---|
5934 | by this regular expression pattern, if the pattern is currently active. |
---|
5935 | |
---|
5936 | 'activatepset' will make the pattern set specified active. An active pattern |
---|
5937 | will enable triggering labels defined with 'defpattern', which will not happen |
---|
5938 | by default. |
---|
5939 | 'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern |
---|
5940 | set number in this case will deactivate all pattern sets defined. |
---|
5941 | |
---|
5942 | 'deletepset' will delete a pattern set from memory, so you can create a new |
---|
5943 | pattern set in it's place. |
---|
5944 | |
---|
5945 | Using regular expressions is high wizardry. But with this high wizardry comes |
---|
5946 | unparallelled power of text manipulation. For an explanation of what a regular |
---|
5947 | expression pattern is, see a few web pages: |
---|
5948 | |
---|
5949 | http://www.regular-expressions.info/ |
---|
5950 | http://www.weitz.de/regex-coach/ |
---|
5951 | |
---|
5952 | For an example of this in use, see 'npc\sample\npc_pcre.txt'. |
---|
5953 | |
---|
5954 | With this you could, for example, automagically punish players for asking for |
---|
5955 | zeny in public places, or alternatively, automagically give them zeny instead if |
---|
5956 | they want it so much. |
---|
5957 | |
---|
5958 | --------------------------------------- |
---|
5959 | |
---|
5960 | *pow(<number>,<power>) |
---|
5961 | |
---|
5962 | Returns the result of the calculation. |
---|
5963 | |
---|
5964 | Example: |
---|
5965 | set @i, pow(2,3); // @i will be 8 |
---|
5966 | |
---|
5967 | --------------------------------------- |
---|
5968 | |
---|
5969 | *sqrt(<number>) |
---|
5970 | |
---|
5971 | Returns square-root of number. |
---|
5972 | |
---|
5973 | Examlpe: |
---|
5974 | set @i, sqrt(25); // @i will be 5 |
---|
5975 | |
---|
5976 | --------------------------------------- |
---|
5977 | |
---|
5978 | *distance(<x0>,<y0>,<x1>,<y1>) |
---|
5979 | |
---|
5980 | Returns distance between 2 points. |
---|
5981 | |
---|
5982 | Example: |
---|
5983 | set @i, distance(100,200,101,202); |
---|
5984 | |
---|
5985 | --------------------------------------- |
---|
5986 | |
---|
5987 | *query_sql "your MySQL query", <array variable> {,<array variable>, ...}; |
---|
5988 | *query_logsql "your MySQL query", <array variable> {,<array variable>, ...}; |
---|
5989 | |
---|
5990 | Puts up to 128 rows of values into the arrays and returns the number of rows. |
---|
5991 | |
---|
5992 | Example: |
---|
5993 | set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame); |
---|
5994 | mes "Hall Of Fame: TOP5"; |
---|
5995 | mes "1."+@name$[0]+"("+@fame[0]+")"; // Will return a person with the biggest fame value. |
---|
5996 | mes "2."+@name$[1]+"("+@fame[1]+")"; |
---|
5997 | mes "3."+@name$[2]+"("+@fame[2]+")"; |
---|
5998 | mes "4."+@name$[3]+"("+@fame[3]+")"; |
---|
5999 | mes "5."+@name$[4]+"("+@fame[4]+")"; |
---|
6000 | |
---|
6001 | Note: In the TXT version it doesn't fill the array and always return -1. |
---|
6002 | Note: Use $ as suffix in the array to receive all data as text. |
---|
6003 | Note: The difference between query_sql and query_logsql is that the latter |
---|
6004 | uses the sql connection to the log database, and should be used when you want |
---|
6005 | to query the server log tables. |
---|
6006 | |
---|
6007 | --------------------------------------- |
---|
6008 | |
---|
6009 | *setitemscript(<ItemID>,<"{ new item script }">); |
---|
6010 | |
---|
6011 | Set a new script bonus to the Item. Very useful for game events. |
---|
6012 | You can remove an item's itemscript by leaving empty the itemscript argument. |
---|
6013 | |
---|
6014 | Example: |
---|
6015 | |
---|
6016 | setitemscript 2637,"{ bonus bDamageWhenUnequip,40; if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }"; |
---|
6017 | setitemscript 2639,""; |
---|
6018 | |
---|
6019 | --------------------------------------- |
---|
6020 | |
---|
6021 | *atoi ("<string>") |
---|
6022 | *axtoi ("<string>") |
---|
6023 | |
---|
6024 | These commands are used to convert strings to numbers. |
---|
6025 | atoi will convert string using normal number (0,1,2,3,etc) while axtoi converts them to |
---|
6026 | hexadecimal numbers (0,1,11,01). |
---|
6027 | |
---|
6028 | Example: |
---|
6029 | |
---|
6030 | mes atoi("11"); // Will display 11 (can also be used to set a @var to 11) |
---|
6031 | set @var, axtoi("FF"); // Will set the @var to 255 |
---|
6032 | mes axtoi("11"); // Will display 17 (1 = 1, 10 = 16, |
---|
6033 | // hexadecimal number set: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}) |
---|
6034 | |
---|
6035 | --------------------------------------- |
---|
6036 | |
---|
6037 | *compare (<string>,<substring>) |
---|
6038 | |
---|
6039 | This command returns 1 or 0 when a the substring is in the main string (1) or not (0). |
---|
6040 | This command is not case sensitive. |
---|
6041 | |
---|
6042 | Example(s): |
---|
6043 | |
---|
6044 | //dothis; will be executed ('Bloody Murderer' contains 'Blood'). |
---|
6045 | if (compare("Bloody Murderer","Blood")) |
---|
6046 | dothis; |
---|
6047 | //dothat; will not be executed ('Blood butterfly' does not contain 'Bloody'). |
---|
6048 | if (compare("Blood Butterfly","Bloody")) |
---|
6049 | dothat; |
---|
6050 | |
---|
6051 | -------------------------------------- |
---|
6052 | |
---|
6053 | *charisalpha("<string>",<position>) |
---|
6054 | |
---|
6055 | This function will return 1 if the character number Position in the given string |
---|
6056 | is a letter, 0 if it isn't a letter but a digit or a space. |
---|
6057 | |
---|
6058 | --------------------------------------- |
---|
6059 | |
---|
6060 | *wedding_effect; |
---|
6061 | Starts the effect used when a wedding is done (music and everything else) |
---|
6062 | Example can be found in the wedding script. |
---|
6063 | |
---|
6064 | -------------------------------------- |
---|
6065 | |
---|
6066 | * The Pet AI commands |
---|
6067 | |
---|
6068 | These commands will only work if the invoking character has a pet, and are meant |
---|
6069 | to be executed from pet scripts. They will modify the pet AI decision-making for |
---|
6070 | the current pet of the invoking character, and will NOT have any independent |
---|
6071 | effect by themselves, which is why only one of them each may be in effect at any |
---|
6072 | time for a specific pet. A pet may have 'petloot', 'petskillbonus', |
---|
6073 | 'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at |
---|
6074 | the same time. 'petheal' is deprecated and is no longer used in the default pet |
---|
6075 | scripts. |
---|
6076 | |
---|
6077 | *petskillbonus <bonus type>,<value>,<duration>,<delay>; |
---|
6078 | |
---|
6079 | This command will make the pet give a bonus to the owner's stat (bonus type - |
---|
6080 | bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the values |
---|
6081 | starting with 'b' in 'db/const.txt') |
---|
6082 | |
---|
6083 | *petrecovery <status type>,<delay>; |
---|
6084 | |
---|
6085 | This command will make the pet cure a specified status condition. The curing |
---|
6086 | actions will occur once every Delay seconds. For a full list of status |
---|
6087 | conditions that can be cured, see the list of 'SC_' status condition constants |
---|
6088 | in 'db/const.txt' |
---|
6089 | |
---|
6090 | *petloot <max items>; |
---|
6091 | |
---|
6092 | This command will turn on pet looting, with a maximum number of items to loot |
---|
6093 | specified. Pet will store items and return them when the maximum is reached or |
---|
6094 | when pet performance is activated. |
---|
6095 | |
---|
6096 | *petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>; |
---|
6097 | *petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>; |
---|
6098 | *petheal <level>,<delay>,<percent hp>,<percent sp>; |
---|
6099 | |
---|
6100 | This will make the pet use a specified support skill on the owner whenever the |
---|
6101 | HP and SP are below the given percent values, with a specified delay time |
---|
6102 | between activations. The skill numbers are as per 'db/skill_db.txt'. |
---|
6103 | 'petheal' works the same as 'petskillsupport' but has the skill ID hardcoded to |
---|
6104 | 28 (Heal). This command is deprecated. |
---|
6105 | It's not quite certain who's stats will be used for the skills cast, the |
---|
6106 | character's or the pets. Probably, Skotlex can answer that question. |
---|
6107 | |
---|
6108 | *petskillattack <skill id>,<skill level>,<rate>,<bonusrate>; |
---|
6109 | *petskillattack "<skill name>",<skill level>,<rate>,<bonusrate>; |
---|
6110 | *petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>; |
---|
6111 | *petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>; |
---|
6112 | |
---|
6113 | These two commands will make the pet cast an attack skill on the enemy the pet's |
---|
6114 | owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'. |
---|
6115 | 'petskillattack2' will make the pet cast the skill with a fixed amount of damage |
---|
6116 | inflicted and the specified number of attacks. |
---|
6117 | |
---|
6118 | All commands with delays and durations will only make the behavior active for |
---|
6119 | the specified duration of seconds, with a delay of the specified number of |
---|
6120 | seconds between activations. Rates are a chance of the effect occuring and are |
---|
6121 | given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is |
---|
6122 | at the maximum possible. |
---|
6123 | |
---|
6124 | The behavior modified with the abovementioned commands will only be exibited if |
---|
6125 | the pet is loyal and appropriate configuration options are set in |
---|
6126 | 'battle_athena.conf'. |
---|
6127 | |
---|
6128 | Pet scripts in the database normally run whenever a pet of that type hatches |
---|
6129 | from the egg. Other commands usable in item scripts (see 'bonus') will also |
---|
6130 | happily run from pet scripts. Apparently, the pet-specific commands will also |
---|
6131 | work in NPC scripts and modify the behavior of the current pet up until the pet |
---|
6132 | is hatched again. (Which will also occur when the character is logged in again |
---|
6133 | with the pet still out of the egg.) It is not certain for how long the effect of |
---|
6134 | such command running from an NPC script will eventually persist, but apparently, |
---|
6135 | it is possible to usefully employ them in usable item scripts to create pet |
---|
6136 | buffing items. |
---|
6137 | |
---|
6138 | Nobody tried this before, so you're essentially on your own here. |
---|
6139 | |
---|
6140 | -------------------------------------- |
---|
6141 | |
---|
6142 | *bpet; |
---|
6143 | |
---|
6144 | This command opens up a pet hatching window on the client connected to the |
---|
6145 | invoking character. It is used in item script for the pet incubators and will |
---|
6146 | let the player hatch an owned egg. If the character has no eggs, it will just |
---|
6147 | open up an empty incubator window. |
---|
6148 | This is still usable outside item scripts. |
---|
6149 | |
---|
6150 | --------------------------------------- |
---|
6151 | |
---|
6152 | *makepet <pet id>; |
---|
6153 | |
---|
6154 | This command will create a pet egg and put it in the invoking character's |
---|
6155 | inventory. The kind of pet is specified by pet ID numbers listed in |
---|
6156 | 'db/pet_db.txt'. The egg is created exactly as if the character just successfuly |
---|
6157 | caught a pet in the normal way. |
---|
6158 | |
---|
6159 | // This will make you a poring: |
---|
6160 | makepet 1002; |
---|
6161 | |
---|
6162 | Notice that you absolutely have to create pet eggs with this command. If you try |
---|
6163 | to give a pet egg with 'getitem', pet data will not be created by the char |
---|
6164 | server and the egg will disappear when anyone tries to hatch it. |
---|
6165 | |
---|
6166 | --------------------------------------- |
---|
6167 | |
---|
6168 | *openmail; |
---|
6169 | |
---|
6170 | This will open a character's Mail window on the client connected to the |
---|
6171 | invoking character. |
---|
6172 | |
---|
6173 | mes "Close this window to open your mail inbox."; |
---|
6174 | close2; |
---|
6175 | openmail; |
---|
6176 | end; |
---|
6177 | |
---|
6178 | --------------------------------------- |
---|
6179 | |
---|
6180 | *homshuffle; |
---|
6181 | |
---|
6182 | This will recalculate the homunculus stats acording to its level, of the |
---|
6183 | current invoking character. |
---|
6184 | |
---|
6185 | --------------------------------------- |
---|
6186 | |
---|
6187 | *setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>; |
---|
6188 | |
---|
6189 | Each map cell has several 'flags' that specify the properties of that cell. |
---|
6190 | These include terrain properties (walkability, shootability, presence of water), |
---|
6191 | skills (basilica, land protector, ...) and other (npc nearby, no vending, ...). |
---|
6192 | Each of these can be 'on' or 'off'. Together they define a cell's behavior. |
---|
6193 | |
---|
6194 | This command lets you alter these flags for all map cells in the specified |
---|
6195 | (x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag). |
---|
6196 | The 'type' defines which flag to modify. Possible options include cell_walkable, |
---|
6197 | cell_shootable, cell_basilica. For a full list, see const.txt. |
---|
6198 | |
---|
6199 | Example: |
---|
6200 | |
---|
6201 | setcell "arena",0,0,300,300,cell_basilica,1; |
---|
6202 | setcell "arena",140,140,160,160,cell_basilica,0; |
---|
6203 | setcell "arena",135,135,165,165,cell_walkable,0; |
---|
6204 | setcell "arena",140,140,160,160,cell_walkable,1; |
---|
6205 | |
---|
6206 | This will add a makeshift ring into the center of the map. The ring will be |
---|
6207 | surrounded by a 5-cell wide 'gap' to prevent interference from outside, and |
---|
6208 | the rest of the map will be marked as 'basilica', preventing observers from |
---|
6209 | casting any offensive skills or fighting among themselves. Note that the wall |
---|
6210 | will not be shown nor known client-side, which may cause movement problems. |
---|
6211 | |
---|
6212 | Another example: |
---|
6213 | |
---|
6214 | OnBarricadeDeploy: |
---|
6215 | setcell "schg_cas05",114,51,125,51,cell_walkable,0; |
---|
6216 | end; |
---|
6217 | OnBarricadeBreak: |
---|
6218 | setcell "schg_cas05",114,51,125,51,cell_walkable,1; |
---|
6219 | end; |
---|
6220 | |
---|
6221 | This could be a part of the WoE:SE script, where attackers are not allowed |
---|
6222 | to proceed until all barricades are destroyed. This script would place and |
---|
6223 | remove a nonwalkable row of cells after the barricade mobs. |
---|
6224 | |
---|
6225 | --------------------------------------- |
---|
6226 | |
---|
6227 | *checkcell ("<map name>",<x>,<y>,<type>); |
---|
6228 | |
---|
6229 | This command will return 1 or 0, depending on whether the specified cell has |
---|
6230 | the 'type' flag set or not. There are various types to check, all mimicking |
---|
6231 | the server's cell_chk enumeration. The types can be found in db/const.txt. |
---|
6232 | |
---|
6233 | The meaning of the individual types can be confusing, so here's an overview: |
---|
6234 | - cell_chkwall/water/cliff |
---|
6235 | these check directly for the 'terrain component' of the specified cell |
---|
6236 | - cell_chkpass/reach/nopass/noreach |
---|
6237 | passable = not wall & not cliff, reachable = passable wrt. no-stacking mod |
---|
6238 | - cell_chknpc/basilica/landprotector/novending/nochat |
---|
6239 | these check for specific dynamic flags (their name indicates what they do) |
---|
6240 | |
---|
6241 | Example: |
---|
6242 | |
---|
6243 | mes "Pick a destination map."; |
---|
6244 | input .@map$; |
---|
6245 | mes "Alright, now give me the coordinates."; |
---|
6246 | input .@x; |
---|
6247 | input .@y; |
---|
6248 | if( !checkcell(.@map$,.@x,.@y,cell_chkpass) ) |
---|
6249 | { |
---|
6250 | mes "Can't warp you there, sorry!"; |
---|
6251 | close; |
---|
6252 | } |
---|
6253 | else |
---|
6254 | { |
---|
6255 | mes "Ok, get ready..."; |
---|
6256 | close2; |
---|
6257 | warp .@map$, .@x, .@y; |
---|
6258 | end; |
---|
6259 | } |
---|
6260 | |
---|
6261 | --------------------------------------- |
---|
6262 | |
---|
6263 | Whew. |
---|
6264 | That's about all of them. |
---|