· 6 years ago · Feb 22, 2020, 03:58 PM
1//===== Athena Doc ========================================
2//= SeAthena 腳本指令列表
3//===== Description =======================================
4//= 腳本指令列表
5//===== Version ===========================================
6//= 1.0.20090807
7//=========================================================
8//= 1.0 - 標準化文檔,整合SeA [Inkfish]
9//=========================================================
10
11目錄:
12
130.- 基礎知識
141.- 基本指令.
152.- 信息獲取類指令.
163.- 檢查類指令.
174.- 玩家相關之類.
185.- 魔物相關指令.
196.- 其他指令. (已漢化)
207.- 副本系統指令.
218.- 任務系統指令. (已漢化)
229.- 戰場指令
2310.- 傭兵指令.
2411.- SeA指令. (已漢化)
2512.- 成就系統指令
26
27=====================
28|0.- 基 礎 知 識.|
29=====================
30
31腳本加載
32------------------------
33
34將腳本路徑設置在 'conf/map_athena.conf' 以被地圖服務器加載,或任何被其加載的.conf
35文件,如 'npc/scripts_main.conf'.
36格式如下:
37
38npc: <path to a filename>
39
40Any line like this, invoked, ultimately, by 'map_athena.conf' will load up the
41script contained in this file, which will make the script available. No file
42will get loaded twice, to prevent possible errors.
43
44Another configuration file option of relevance is:
45
46delnpc: <path to a filename>
47
48This will unload a specified script filename from memory, which, while
49seemingly useless, may sometimes be required.
50
51Whenever '//' is encountered in a line upon reading, everything beyond this on
52that line is considered to be a comment and is ignored. This works wherever you
53place it.
54
55Upon loading all the files, the server will execute all the top-level commands
56in them. No variables exist yet at this point, no commands can be called other
57than those given in this section. These commands set up the basic server script
58structure - create NPC objects, spawn monster objects, set map flags, etc. No
59code is actually executed at this point except them. The top-level commands the
60scripting are pretty confusing, since they aren't structured like you would
61expect commands, command name first, but rather, normally start with a map name.
62
63What's more confusing about the top-level commands is that most of them use a
64tab symbol to divide their arguments.
65
66To prevent problems and confusion, the tab symbols are written as '%TAB%'
67throughout this document, even though this makes the text a bit less readable.
68Using an invisible symbol to denote arguments is one of the bad things about
69this language, but we're stuck with it for now. :)
70
71頂級指令列表:
72
73** 設置地圖標籤:
74
75<map name>%TAB%mapflag%TAB%<flag>
76
77This will, upon loading, set a specified map flag on a map you like. These are
78normally in files inside 'conf/mapflag' and are loaded first, so by the time the
79server's up, all the maps have the flags they should have. Map flags determine
80the behavior of the map regarding various common problems, for a better
81explanation, see 'setmapflag'.
82
83** 創建可重生魔物:
84
85<地圖名>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<魔物名字>{,<魔物等級>{,<無視等級懲罰>}}%TAB%<魔物ID>,<數量>,<延遲1>,<延遲2>,<事件>{,<大小>,<魔物ai>}
86
87Map name is the name of the map the monsters will spawn on. x,y are the
88coordinates where the mob should spawn. If xs and ys are non-zero, they
89specify the diameters of a spawn-rectangle area who's center is x,y.
90Putting zeros instead of these coordinates will spawn the monsters randomly.
91Note this is only the initial spawn zone, as mobs random-walk, they are free
92to move away from their specified spawn region.
93
94Monster name is the name the monsters will have on screen, and has no relation
95whatsoever to their names anywhere else. It's the mob id that counts, which
96identifies monster record in 'mob_db.txt' database of monsters. If the mob name
97is given as "--ja--", the 'japanese name' field from the monster database is
98used, (which, in eAthena, actually contains an english name) if it's "--en--",
99it's the 'english name' from the monster database (which contains an uppercase
100name used to summon the monster with a GM command).
101
102魔物等級設-1為默認。
103無視等級懲罰&1為無視經驗懲罰&2為無視掉落懲罰。
104
105If you add 20000 to the monster ID, the monster will be spawned in a 'big
106version', (monster size class will increase) and if you add 10000, the 'tiny
107version' of the monster will be created. However, this method is deprecated
108and not recommended, as the values to add can change at a later time (20000
109and 10000 actually stand for 2*MAX_MOB_DB and MAX_MOB_DB respectively, which
110is defined on mob.h, and can change in the future as more mobs are created).
111The recommended way to change a mob's size is to use the event-field (see
112below).
113
114Amount is the amount of monsters that will be spawned when this command is
115executed, it is affected by spawn rates in 'battle_athena.conf'.
116
117Delay1 and delay2 are the monster respawn delays - the first one counts the time
118since a monster defined in this spawn was last respawned and the second one
119counts the time since the monster of this spawn was last killed. Whichever turns
120out to be higher will be used. If the resulting number is smaller than a random
121value between 5 and 10 seconds, this value will be used instead. (Which is
122normally the case if both delay values are zero.) The times are given in
1231/1000ths of a second.
124
125You can specify a custom level to use for the mob different from the one of
126the database by adjoining the level after the name with a comma. eg:
127"Poring,50" for a name will spawn a monster with name Poring and level 50.
128
129Event is a script event to be executed when the mob is killed. The event must
130be in the form "NPCName::OnEventName" to execute, and the event name label
131should start with "On". As with all events, if the NPC is an on-touch NPC, the
132player who triggers the script must be within 'trigger' range for the event to
133work.
134
135The Event field can be used alternatively to specify other mob properties. Use
1362 to specify that the mob should be small, 4 for big monsters, and 8 for
137special ai mobs (which by default attack other monsters instead of players).
138You can add these, so using 10 will spawn small monsters that attack other
139mobs (if you specify both 2 and 4, the small version takes priority).
140
141** NPC名字
142
143/!\ WARNING: this applies to warps, NPCs, duplicates and shops /!\
144
145NPC names are kinda special and are formatted this way:
146
147<Display name>{::<Unique name>}
148
149All NPCs need to have a unique name that is used for identification purposes.
150When you have to identify a NPC by it's name, you should use <Unique name>.
151If <Unique name> is not provided, use <Display name> instead.
152
153The client has a special feature when displaying names:
154if the display name contains a '#' character, it hides that part of the name.
155ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
156
157<Display name> must be at most 24 characters in length.
158<Unique name> must be at most 24 characters in length.
159
160** 定義傳送點
161
162<from map name>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
163<from map name>,<fromX>,<fromY>,<facing>%TAB%warp2%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
164
165This will define a warp NPC that will warp a player between maps, and while most
166arguments of that are obvious, some deserve special mention.
167
168SpanX and SpanY will make the warp sensitive to a character who didn't step
169directly on it, but walked into a zone which is centered on the warp from
170coordinates and is SpanX in each direction across the X axis and SpanY in each
171direction across the Y axis.
172
173Warp NPC objects also have a name, because you can use it to refer to them later
174with 'enablenpc'/'disablenpc'
175
176Facing of a warp object is irrelevant, it is not used in the code and all
177current scripts have a zero in there.
178
179warp2和warp的區別是,warp2可以傳送隱身對像
180
181** 創建NPC
182
183<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
184<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
185
186This will place an NPC object on a specified map at the specified location, and
187is a top-level command you will use the most in your custom scripting. The NPCs
188are triggered by clicking on them, and/or by walking in their trigger area, if
189defined, see that below.
190
191Facing is a direction the NPC sprite will face in. Not all NPC sprites have
192different images depending on the direction you look from, so for some facing
193will be meaningless. Facings are counted counterclockwise in increments of 45
194degrees, where 0 means facing towards the top of the map. (So to turn the sprite
195towards the bottom of the map, you use facing 4, and to make it look southeast
196it's facing 5.)
197
198Sprite id is the sprite number used to display this particular NPC. For a full
199list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml You may
200also use a monster's ID number instead to display a monster sprite for this NPC.
201It is possible to use a job sprite as well, but you must first define it as a
202monster sprite in 'mob_avail.txt', a full description on how to do this is not
203in the scope of this manual.
204A '-1' sprite id will make the NPC invisible (and unclickable).
205A '111' sprite id will make an NPC which does not have a sprite, but is still
206clickable, which is useful if you want to make a clickable object of the 3D
207terrain.
208
209TriggerX and triggerY, if given, will define an area, centered on NPC and
210spanning triggerX cells in every direction across X and triggerY in every
211direction across Y. Walking into that area will trigger the NPC. If no
212'OnTouch:' special label is present in the NPC code, the execution will start
213from the beginning of the script, otherwise, it will start from the 'OnTouch:'
214label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
215used in this case.
216
217The code part is the script code that will execute whenever the NPC is
218triggered. It may contain commands and function calls, descriptions of which
219compose most of this document. It has to be in curly brackets, unlike elsewhere
220where we use curly brackets, these do NOT signify an optional parameter.
221
222** 創建浮動NPC
223
224-%TAB%script%TAB%<NPC Name>%TAB%-1,{<code>}
225
226This will define an NPC object not triggerable by normal means. This would
227normally mean it's pointless since it can't do anything, but there are
228exceptions, mostly related to running scripts at specified time, which is what
229these floating NPC objects are for. More on that below.
230
231** 創建商店
232
233-%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
234<map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
235<map name>,<x>,<y>,<facing>%TAB%cashshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
236<map name>,<x>,<y>,<facing>%TAB%marketshop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>:<數量>{,<itemid>:<price>:<數量>...}
237
238This will define a shop NPC, which, when triggered (which can only be done by
239clicking) will cause a shop window to come up. No code whatsoever runs in shop
240NPCs and you can't change the prices otherwise than by editing the script
241itself. (No variables even exist at this point of scripting, so don't even
242bother trying to use them.)
243
244The item id is the number of item in the 'item_db.txt' database. If Price is set
245to -1, the 'buy price' given in the item database will be used. Otherwise, the
246price you gave will be used for this item, which is how you create differing
247prices for items in different shops.
248
249Since trunk r12264 you can alternatively use "cashshop" in place of "shop"
250to use the Cash Shop interface, allowing you to buy items with special points
251(Currently stored as account vars in global_reg #CASHPOINTS and #KAFRAPOINTS.)
252This type of shop will not allow you to sell items at it, you may only
253purchase items here. The layout used to define sale items still count, and
254"<price>" refers to how many points will be spent purchasing the them.
255
256** 複製NPC
257
258warp: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<spanx>,<spany>
259shop/cashshop/marketshop/npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
260shop/cashshop/marketshop/npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>
261npc: -%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
262npc: <map name>,<x>,<y>,<facing>%TAB%duplicate(<label>)%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>
263
264This will duplicate an warp/shop/cashshop/NPC referred to by 'label'.
265Warp duplicates inherit the target location.
266Shop/cashshop duplicates inherit the item list.
267NPC duplicates inherit the script code.
268The rest (name, location, facing, sprite ID, span/trigger area)
269is obtained from the definition of the duplicate (not inherited).
270
271** 定義函數
272
273function%TAB%script%TAB%<function name>%TAB%{<code>}
274
275This will define a function object, callable with the 'callfunc' command (see
276below). This object will load on every map server separately, so you can get at
277it from anywhere. It's not possible to call the code in this object by
278anything other than the 'callfunc' script command.
279
2801.9.24更新無須使用callfunc來調用。
281例如:
282function script F_Test { return getarg(0) }
283原來使用callfunc "F_Test",1;
284現可使用F_Test(1);
285
286The code part is the script code that will execute whenever the function is
287called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
288we use curly brackets, these do NOT signify an optional parameter.
289
290
291Once an object is defined which has a 'code' field to it's definition, it
292contains script commands which can actually be triggered and executed.
293
294~ RID? GID? ~
295
296What a RID is and why do you need to know
297-----------------------------------------
298
299Most scripting commands and functions will want to request data about a
300character, store variables referenced to that character, send stuff to the
301client connected to that specific character. Whenever a script is invoked by a
302character, it is passed a so-called RID - this is the character ID number of a
303character that caused the code to execute by clicking on it, walking into it's
304OnTouch zone, or otherwise.
305
306If you are only writing common NPCs, you don't need to bother with it. However,
307if you use functions, if you use timers, if you use clock-based script
308activation, you need to be aware of all cases when a script execution can be
309triggered without a RID attached. This will make a lot of commands and functions
310unusable, since they want data from a specific character, want to send stuff to
311a specific client, want to store variables specific to that character, and they
312would not know what character to work on if there's no RID.
313
314Unless you use 'attachrid' to explicitly attach a character to the script first.
315
316Whenever we say 'invoking character', we mean 'the character who's RID is
317attached to the running script. The script function "playerattached" can be
318used to check which is the currently attached player to the script (it will
319return 0 if the there is no player attached or the attached player no longer
320is logged on to the map-server).
321
322But what about GID?
323--- ---- ----- ----
324
325GID stands for the Game ID of something, this can either be the GID obtained
326through mobspawn (mob control commands) or the account ID of a character.
327Another way would be to right click on a mob,
328NPC or char as GM sprited char to view the GID.
329
330This is mostly used for the new version of skill and the mob control commmands
331implemented (but NEVER documented by Lance. Shame on you...).
332
333Item and pet scripts
334--------------------
335
336Each item in the item database has three special fields - Script , OnEquip_Script
337and OnUnequip_Script. The first is script code run every time a character equips the item,
338with the RID of the equipping character. Every time they unequip an item, all
339temporary bonuses given by the script commands are cleared, and all the scripts
340are executed once again to rebuild them. This also happens in several other
341situations (like upon login) but the full list is currently unknown.
342
343OnEquip_Script is a piece of script code run whenever the item is used by a character
344by doubleclicking on it. OnUnequip_Script runs whenever the
345equipment is unequip by a character
346
347Not all script commands work properly in the item scripts. Where commands and
348functions are known to be meant specifically for use in item scripts, they are
349described as such.
350
351Every pet in the pet database has a PetScript field, which determines pet
352behavior. It is invoked wherever a pet of the specified type is spawned.
353(hatched from an egg, or loaded from the char server when a character who had
354that pet following them connects) This may occur in some other situations as
355well. Don't expect anything other than commands definitely marked as usable in
356pet scripts to work in there reliably.
357
358數字
359-------
360
361Beside the common decimal numbers, which are nothing special whatsoever (though
362do not expect to use fractions, since ALL numbers are integer in this language),
363the script engine also handles hexadecimal numbers, which are otherwise
364identical. Writing a number like '0x<hex digits>' will make it recognized as a
365hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
366to 'mes 0x10' it will print '16'.
367
368This is not used much, but it pays to know about it.
369
370變量
371---------
372
373The meat of every programming language is variables - places where you store
374data.
375
376Variables are divided into and uniquely identified by the combination of:
377prefix - determines the scope and extent (or lifetime) of the variable
378name - an identifier consisting of '_' and alphanumeric characters
379postfix - determines the type of the variable: integer or string
380
381Scope can be:
382global - global to all servers
383local - local to the server
384account - attached to the account of the character identified by RID
385character - attached to the character identified by RID
386npc - attached to the NPC
387scope - attached to the scope of the instance
388
389Extent can be:
390permanent - They still exist when the server resets.
391temporary - They cease to exist when the server resets.
392
393Prefix: scope and extent
394nothing - A permanent variable attached to the character, the default variable
395 type. They are stored with all the account data in "save\athena.txt"
396 in TXT versions and in the SQL versions in the `global_reg_value`
397 table using type 3.
398"@" - A temporary variable attached to the character.
399 SVN versions before 2094 revision and RC5 version will also treat
400 'l' as a temporary variable prefix, so beware of having variable
401 names starting with 'l' if you want full backward compatibility.
402"$" - A global permanent variable.
403 They are stored in "save\mapreg.txt" or database table `mapreg`,
404 depending on server type.
405"$@" - A global temporary variable.
406 This is important for scripts which are called with no RID
407 attached, that is, not triggered by a specific character object.
408"." - A NPC variable.
409 They exist in the NPC and disappear when the server restarts or the
410 NPC is reloaded. Can be accessed from inside the NPC or by calling
411 'getvariableofnpc'.
412".@" - A scope variable.
413 They are unique to the instance and scope. Each instance has it's
414 own scope that ends when the script ends. Calling a function with
415 callsub/callfunc starts a new scope, returning from the function
416 ends it. When a scope ends, it's variables are converted to values
417 ('return .@var;' returns a value, not a reference).
418"#" - A permanent local account variable.
419 They are stored with all the account data in "save\accreg.txt" in
420 TXT versions and in the SQL versions in the 'global_reg_value'
421 table using type 2.
422"##" - A permanent global account variable stored by the login server.
423 They are stored in "save\account.txt" and in the SQL versions in the
424 'global_reg_value' table, using type 1. The only difference you will
425 note from normal # variables is when you have multiple char-servers
426 connected to the same login server. The # variables are unique to
427 each char-server, while the ## variables are shared by all these
428 char-servers.
429
430Postfix: integer or string
431nothing - integer variable, can store positive and negative numbers, but only
432 whole numbers (so don't expect to do any fractional math)
433'$' - string variable, can store text
434
435Examples:
436 name - permanent character integer variable
437 name$ - permanent character string variable
438 @name - temporary character integer variable
439 @name$ - temporary character string variable
440 $name - permanent global integer variable
441 $name$ - permanent global string variable
442$@name - temporary global integer variable
443$@name$ - temporary global string variable
444 .name - NPC integer variable
445 .name$ - NPC string variable
446.@name - scope integer variable
447.@name$ - scope string variable
448 #name - permanent local account integer variable
449 #name$ - permanent local account string variable
450##name - permanent global account integer variable
451##name$ - permanent global account string variable
452
453If a variable was never set, it is considered to equal zero for integer
454variables or an empty string ("", nothing between the quotes) for string
455variables. Once you set it to that, the variable is as good as forgotten
456forever, and no trace remains of it even if it was stored with character or
457account data.
458
459Some variables are special, that is, they are already defined for you by the
460scripting engine. You can see the full list somewhere in 'db/const.txt', which
461is a file you should read, since it also allows you to replace lots of numbered
462arguments for many commands with easier to read text. The special variables most
463commonly used are all permanent character-based variables:
464
465StatusPoint - Amount of status points remaining.
466BaseLevel - Current base level
467SkillPoint - Amount of skill points remaining
468Class - Current job
469Upper - 1 if the character is an advanced job class.
470Zeny - Current amount of Zeny
471Sex - Character's gender, 0 if female, 1 if male.
472Weight - The weight the character currently carries.
473MaxWeight - The maximum weight the character can carry.
474JobLevel - Character's job level
475BaseExp - The amount of base experience points the character has.
476 Notice that it's zero (or close) if the character just got a level.
477JobExp - Same for job levels
478NextBaseExp - Amount of experience points needed to reach the next base level.
479NextJobExp - Same for job levels.
480Hp - Current amount of hit points.
481MaxHp - Maximum amount of hit points.
482Sp - Current spell points.
483MaxSp - Maximum amount of spell points.
484BaseJob - This is sneaky, apparently meant for baby class support.
485 This will supposedly equal Job_Acolyte regardless of whether the
486 character is an acolyte or a baby acolyte, for example.
487Karma - The character's karma. Karma system is not fully functional, but
488 this doesn't mean this doesn't work at all. Not tested.
489Manner - The character's manner rating. Becomes negative if the player
490 utters words forbidden through the use of 'manner.txt' client-side
491 file.
492
493While these behave as variables, do not always expect to just set them - it is
494not certain whether this will work for all of them. Whenever there is a command
495or a function to set something, it's usually preferable to use that instead. The
496notable exception is Zeny, which you can and often will address directly -
497setting it will make the character own this number of Zeny.
498If you try to set Zeny to a negative number, the script will be terminated with an error.
499
500字符串
501-------
502
503To include symbol '"' in a string you should use prefix '\"'
504
505
506數組
507------
508
509Arrays (in eAthena at least) are essentially a set of variables going under the
510same name. You can tell between the specific variables of an array with an
511'array index', a number of a variable in that array:
512
513<variable name>[<array index>]
514
515Variables stored in this way, inside an array, are also called 'array elements'.
516Arrays are specifically useful for storing a set of similar data (like several
517item IDs for example) and then looping through it. You can address any array
518variable as if it was a normal variable:
519
520 set @arrayofnumbers[0],1;
521
522You can also do sneaky things like using a variable (or an expression, or even a
523value from an another array) to get at an array value:
524
525 set @x,100;
526 set @arrayofnumbers[@x],10;
527
528This will make @arrayofnumbers[100] equal to 10.
529
530Notice that index numbering always starts with 0. Arrays cannot hold more than
531128 variables. (So the last one can't have a number higher than 127)
532
533And array indexes probably can't be negative. Nobody tested what happens when
534you try to get a negatively numbered variable from an array, but it's not going
535to be pretty. :)
536
537Arrays can naturally store strings:
538
539@menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
540the '$', normally denoting a string variable, before the square brackets that
541denotes an array index.
542
543Resume of the allowed variable and array scopes
544------ -- --- ------- -------- --- ----- ------
545
546+==========+======+=======+
547|VarType | Norm | Array |
548+==========+======+=======+
549|$Str$ | OK! | OK! |
550+----------+------+-------+
551|$@Str$ | OK! | OK! |
552+----------+------+-------+
553|@Str$ | OK! | OK! |
554+----------+------+-------+
555|#Str$ | OK! | FAIL! |
556+----------+------+-------+
557|Str$ | OK! | FAIL! |
558+----------+------+-------+
559|$Int | OK! | OK! |
560+----------+------+-------+
561|$@Int | OK! | OK! |
562+----------+------+-------+
563|@Int | OK! | OK! |
564+----------+------+-------+
565|#Int | OK! | FAIL! |
566+----------+------+-------+
567|Int | OK! | FAIL! |
568+----------+------+-------+
569|.Str$ | OK! | OK! |
570+----------+------+-------+
571|.Int | OK! | OK! |
572+----------+------+-------+
573|.@Str$ | OK! | OK! |
574+----------+------+-------+
575|.@Int | OK! | OK! |
576+----------+------+-------+
577
578操作符
579---------
580
581Operators are things you can do to variables and numbers. They are either the
582common mathematical operations or conditional operators
583
584+ - will add two numbers. If you try to add two strings, the result will be a
585 string glued together at the +. You can add a number to a string, and the
586 result will be a string. No other math operators work with strings.
587- - will subtract two numbers.
588* - will multiply two numbers.
589/ - will divide two numbers. Note that this is an integer division, i.e.
590 7/2 is not equal 3.5, it's equal 3.
591% - will give you the remainder of the division. 7%2 is equal to 1.
592
593There are also conditional operators. This has to do with the conditional
594command 'if' and they are meant to return either 1 if the condition is satisfied
595and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
596Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
597zero will also be True.)
598
599You can compare numbers to each other and you compare strings to each other, but
600you can not compare numbers to strings.
601
602 == - Is true if both sides are equal. For strings, it means they are the same.
603 >= - True if the first value is equal to, or greater than, the second value.
604 <= - True if the first value is equal to, or less than, the second value
605 > - True if the first value greater than the second value
606 < - True if the first value is less than the second value
607 != - True if the first value IS NOT equal to the second one
608
609Examples:
610
611 1==1 is True.
612 1<2 is True while 1>2 is False.
613 @x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
614
615Only '==' and '!=' have been tested for comparing strings. Since there's no way
616to code a seriously complex data structure in this language, trying to sort
617strings by alphabet would be pointless anyway.
618
619Comparisons can be stacked in the same condition:
620
621 && - Is True if and only if BOTH sides are true.
622 ('1==1 && 2==2' is true. '2==1 && 1==1' is false.)
623 || - Is True if either side of this expression is True.
624
625 1==1 && 2==2 is True.
626 1==1 && 2==1 is False.
627 1==1 || 2==1 is True.
628
629Logical bitwise operators work only on numbers, and they are the following:
630
631 << - Left shift.
632 >> - Right shift.
633 Left shift moves the binary 1(s) of a number n positions to the left,
634 which is the same as multiplying by 2, n times.
635 In the other hand, Right shift moves the binary 1(s) of a number n positions
636 to the right, which is the same as dividing by 2, n times.
637 Example:
638 set b,2;
639 set a, b << 3;
640 mes a;
641 set a, a >> 2;
642 mes a;
643 The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
644 The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
645 & - And.
646 | - Or.
647 The bitwise operator AND (&) is used to test two values against each other,
648 and results in setting bits which are active in both arguments. This can
649 be used for a few things, but in eAthena this operator is usually used to
650 create bit-masks in scripts.
651
652 The bitwise operator OR (|)sets to 1 a binary position if the binary position
653 of one of the numbers is 1. This way a variable can hold several values we can check,
654 known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
655 to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
656 that a player can have.
657
658 A bit-mask basically is (ab)using the variables bits to set various options in
659 one variable. With the current limit if variables it is possible to store 32
660 different options in one variable (by using the bits on position 0 to 31).
661
662 Example(s):
663 - Basic example of the & operator, bit example:
664 10 & 2 = 2
665 Why? :
666 10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
667 2 = 2^1 (2), so in bits (same size) it would be 0010
668 The & (AND) operator sets bits which are active (1) in both arguments, so in the
669 example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
670 0010, which is 2.
671 - Basic example of creating and using a bit-mask:
672 set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
673 if (@options & 1) mes "Option 1 is activated";
674 if (@options & 2) mes "Option 2 is activated";
675 if (@options & 4) mes "Option 3 is activated";
676 if (@options & 8) mes "Option 4 is activated";
677 if (@options & 16) mes "Options 5 is activated";
678 This would return the messages about option 2, 3 and 5 being shown (since we've set
679 the 2,4 and 16 bit to 1).
680 ^ - Xor.
681 The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
682 numbers have the same value in the said position. On the other hand, it
683 sets to 1 if they have different values in the said binary position.
684 This is another way of setting and unsetting bits in bit-masks.
685
686 Example:
687 - First let's set the quests that are currently in progress:
688 set inProgress,1|8|16; // quest 1,8 and 16 are in progress
689 - After playing for a bit, the player starts another quest:
690 if( inProgress&2 == 0 ){
691 // this will set the bit for quest 2 (inProgress has that bit set to 0)
692 set inProgress,inProgress^2;
693 mes "Quest 2: find a newbie and be helpful to him for an hour.";
694 close;
695 }
696 - After spending some time reading info on Xor's, the player finally completes quest 1:
697 if( inProgress&1 && isComplete ){
698 // this will unset the bit for quest 1 (inProgress has that bit set to 1)
699 set inProgress,inProgress^1;
700 mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
701 close;
702 }
703
704Unary operators with only with a single number, which follows the operator, and
705are following:
706
707 - - Negation.
708 The sign of the number will be reversed. If the number was positive, it will
709 become negative and vice versa.
710
711 Example:
712 set .@myvar,10;
713 mes "Negative 10 is "+(-.@myvar);
714
715 ! - Logical Not.
716 Reverses the boolean result of an expression. True will become false and
717 false will become true.
718
719 Example:
720 if(!callfunc("F_dosomething"))
721 {
722 mes "Doing something failed.";
723 close;
724 }
725
726 ~ - Bitwise Not.
727 Reverses each bit in a number, also known as one's complement. Cleared bits
728 are set, and set bits are cleared.
729
730 Example:
731 - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
732 set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
733
734Ternary operators take three expressions (numbers, strings or boolean), and are
735following:
736
737 ?: - Conditional operator
738 Very useful e.g. to replace
739
740 if(Sex) mes "..."; else mes "...";
741
742 clauses with simple
743
744 mes "Welcome, " + (Sex?"Mr.":"Mrs.") + " " + strcharinfo(0);
745
746 or to replace any other simple if-else clauses. It might be worth
747 mentioning that ?: has low priority and has to be enclosed with
748 parenthesis in most (if not all) cases.
749
750
751=====================
752|1.- Basic commands.|
753=====================
754---------------------------------------
755
756*mes <內容>;
757 作用: 把<內容>的內容顯示到消息窗口中。
758
759---------------------------------------
760
761*next;
762 作用: 在消息窗口上顯示next按鈕並等待。
763
764---------------------------------------
765
766*close;
767 作用: 在消息窗口上顯示close按鈕並結束腳本。
768
769---------------------------------------
770
771*close2;
772 作用: 在消息窗口上顯示close按鈕,但不結束腳本。要結束腳本時請使用end命令。
773
774---------------------------------------
775
776
777*clear;
778 作用: 不需要next按鈕,從服務端控制清楚消息窗口裡的內容。
779
780---------------------------------------
781
782*end;
783 作用: 結束腳本
784
785---------------------------------------
786
787*set <變量名>,<要設置的值>;
788
789 作用: 把值傳入<變量。值為字符串類型時,不要忘記變量名的$後綴。
790
791---------------------------------------
792
793*setd <變量名>,<要設置的值>{, <角色ID>};
794
795 作用:設置一個變量的值(主要作用是可以動態改變變量名)
796 舉例:
797 set $var$, "Poring";
798
799 setd "$var$", "Poporing";
800 mes $var$; // Will return Poporing
801
802 setd "$" + $var$ + "123$", "Poporing is cool";
803 mes $Poporing123$; // Will return Poporing is cool.
804
805---------------------------------------
806
807*getd("<變量名>")
808
809 作用:返回一個變量的引用(主要作用是可以動態改變變量名)
810 舉例:
811 set getd("$varRefence"), 1;
812 set @i, getd("$pikachu");
813
814---------------------------------------
815
816*getvariableofnpc(<變量>,"<NPC名字>")
817 作用:返回指定NPC的變量
818 舉例:
819 //設置.v變量的值為NPC:TargetNPC的變量.var
820 set .v,getvariableofnpc(.var,"TargetNPC");
821
822 //設置NPC:TargetNPC的變量.var的值為1
823 set getvariableofnpc(.var,"TargetNPC"),1;
824
825---------------------------------------
826
827*goto <label>;
828
829This command will make the script jump to a label, usually used in conjunction
830with other command, such as "if", but often used on it's own.
831
832 ...
833 goto Label;
834 mes "This will not be seen";
835Label:
836 mes "This will be seen";
837
838Note by FlavioJS: goto's are "evil" and should be avoided if possible
839
840---------------------------------------
841
842*menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
843
844This command will create a selectable menu for the invoking character. Only one
845menu can be on screen at the same time.
846
847Depending on what the player picks from the menu, the script execution will
848continue from the corresponding label. (it's string-label pairs, not label-
849string)
850
851Options can be grouped together, separated by the character ':'.
852
853 menu "A:B",L_Wrong,"C",L_Right;
854
855It also sets a special temporary character variable @menu, which contains the
856number of option the player picked. (Numbering of options starts at 1.)
857This number is consistent with empty options and grouped options.
858
859 menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
860 L_Wrong:
861 // If they click "A" or "B" they will end up here
862 // @menu == 1 if "A"
863 // @menu == 2 will never happen because the option is empty
864 // @menu == 3 if "B"
865 L_Impossible:
866 // Empty options are not displayed and therefore can't be selected
867 // this label will never be reached from the menu command
868 L_Right:
869 // If they click "C" they will end up here
870 // @menu == 5
871
872If a label is '-', the script execution will continue right after the menu
873command if that option is selected, this can be used to save you time, and
874optimize big scripts.
875
876 menu "A::B:",-,"C",L_Right;
877 // If they click "A" or "B" they will end up here
878 // @menu == 1 if "A"
879 // @menu == 3 if "B"
880 L_Right:
881 // If they click "C" they will end up here
882 // @menu == 5
883
884Both these examples will perform the exact same task.
885
886If you give an empty string as a menu item, the item will not display. This
887can effectively be used to script dynamic menus by using empty string for
888entries that should be unavailable at that time.
889
890You can do it by using arrays, but watch carefully - this trick isn't high
891wizardry, but minor magic at least. You can't expect to easily duplicate it
892until you understand how it works.
893
894Create a temporary array of strings to contain your menu items, and populate it
895with the strings that should go into the menu at this execution, making sure not
896to leave any gaps. Normally, you do it with a loop and an extra counter, like
897this:
898
899 setarray @possiblemenuitems$[0],<list of potential menu items>;
900 set @j,0; // That's the menu lines counter.
901
902 // We loop through the list of possible menu items.
903 // @i is our loop counter.
904 for( set @i,0; @i<getarraysize(@possiblemenuitems$) ; set @i,@i+1 )
905 {
906 // That 'condition' is whatever condition that determines whether
907 // a menu item number @i actually goes into the menu or not.
908
909 if (<condition>)
910 {
911 // We record the option into the list of options actually available.
912
913 set @menulist$[@j],@possiblemenuitems$[@i];
914
915 // We just copied the string, we do need it's number for later
916 // though, so we record it as well.
917
918 set @menureference[@j],@i;
919
920 // Since we've just added a menu item into the list, we increment
921 // the menu lines counter.
922
923 set @j,@j+1;
924 }
925
926 // We go on to the next possible menu item.
927 }
928
929This will create you an array @menulist$ which contains the text of all items
930that should actually go into the menu based on your condition, and an array
931@menureference, which contains their numbers in the list of possible menu items.
932(Remember, arrays start with 0.) There's less of them than the possible menu
933items you've defined, but the menu command can handle the empty lines - only if
934they are last in the list, and if it's made this way, they are. Now comes a
935dirty trick:
936
937 // X is whatever the most menu items you expect to handle.
938 menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
939
940This calls up a menu of all your items. Since you didn't copy some of the
941possible menu items into the list, it's end is empty and so no menu items will
942show up past the end. But this menu call doesn't jump anywhere, it just
943continues execution right after the menu command. (And it's a good thing it
944doesn't, cause you can only explicitly define labels to jump to, and how do you
945know which ones to define if you don't know beforehand which options will end up
946where in your menu?)
947But how do you figure out which option the user picked? Enter the @menu.
948
949@menu contains the number of option that the user selected from the list,
950starting with 1 for the first option. You know now which option the user picked
951and which number in your real list of possible menu items it translated to:
952
953 mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
954
955@menu is the number of option the user picked.
956@menu-1 is the array index for the list of actually used menu items that we
957made.
958@menureference[@menu-1] is the number of the item in the array of possible menu
959items that we've saved just for this purpose.
960
961And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
962display the menu line the user picked. (Yes, it's a handful, but it works.)
963
964You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
965route your execution based on the line selected and still generate a different
966menu every time, which is handy when you want to, for example, make users select
967items in any specific order before proceeding, or make a randomly shuffled menu.
968
969Kafra code bundled with the standard distribution uses a similar array-based
970menu technique for teleport lists, but it's much simpler and doesn't use @menu,
971probably since that wasn't documented anywhere.
972
973See also 'select', which is probably better in this particular case. Instead of
974menu, you could use 'select' like this:
975
976 set @dummy,select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
977
978For the purposes of the technique described above these two statements are
979perfectly equivalent.
980
981---------------------------------------
982
983*select("<option>"{,"<option>",...})
984*prompt("<option>"{,"<option>",...})
985
986This function is a handy replacement for 'menu' for some specific cases where
987you don't want a complex label structure - like, for example, asking simple yes-
988no questions. It will return the number of menu option picked, starting with 1.
989Like 'menu', it will also set the variable @menu to contain the option the user
990picked.
991
992 if (select("Yes:No")==1) mes "You said yes, I know.";
993
994And like 'menu', the selected option is consistent with grouped options
995and empty options.
996
997prompt works almost the same as select, except that when a character clicks
998the Cancel button, this function will return 255 instead.
999
1000---------------------------------------
1001
1002*input(<variable>{,<min>{,<max>}})
1003
1004This command will make an input box pop up on the client connected to the
1005invoking character, to allow entering of a number or a string. This has many
1006uses, one example would be a guessing game, also making use of the 'rand'
1007function:
1008
1009 mes "[Woman]";
1010 mes "Try and guess the number I am thinking of.";
1011 mes "The number will be between 1 and 10.";
1012 next;
1013 set @number, rand(1,10);
1014 input @guess;
1015 if(@guess==@number)
1016 {
1017 mes "[Woman]";
1018 mes "Well done that was the number I was thinking of";
1019 close;
1020 }
1021 else
1022 {
1023 mes "[Woman]";
1024 mes "Sorry, that wasn't the number I was thinking of.";
1025 close;
1026 }
1027
1028If you give the input command a string variable to put the input in, it will
1029allow the player to enter text. Otherwise, only numbers will be allowed.
1030
1031 mes "[Woman]";
1032 mes "Please say HELLO";
1033 next;
1034 input @var$;
1035 if(@var$=="HELLO")
1036 {
1037 mes "[Woman]";
1038 mes "Well done you typed it correctly";
1039 close;
1040 }
1041 else
1042 {
1043 mes "[Woman]";
1044 mes "Sorry you got it wrong";
1045 close;
1046 }
1047
1048Normally you may not input a negative number with this command.
1049This is done to prevent exploits in badly written scripts, which would
1050let people, for example, put negative amounts of zeny into a bank script and
1051receive free zeny as a result.
1052
1053Since trunk r12192 the command has two optional arguments and a return value.
1054The default value of 'min' and 'max' can be set with 'input_min_value' and
1055'input_max_value' in script_athena.conf.
1056For numeric inputs the value is capped to the range [min,max]. Returns 1 if
1057the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
1058For string inputs it returns 1 if the string was longer than 'max', -1 is
1059shorter than 'min' and 0 otherwise.
1060
1061---------------------------------------
1062
1063*callfunc "<function>"{,<argument>,...<argument>};
1064*callfunc("<function>"{,<argument>,...<argument>})
1065
1066This command lets you call up a function NPC. A function NPC can be called from
1067any script on any map server. Using the 'return' command it will come back to
1068the place that called it.
1069
1070 place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
1071 mes "[Woman]"
1072 mes "Lets see if you win";
1073 callfunc "funcNPC";
1074 mes "Well done you have won";
1075 close;
1076 }
1077 function%TAB%script%TAB%funcNPC%TAB%{
1078 set @win, rand(2);
1079 if(@win==0) return;
1080 mes "Sorry you lost";
1081 end;
1082 }
1083
1084You can pass arguments to your function - values telling it what exactly to do -
1085which will be available there with getarg() (see 'getarg')
1086Notice that returning is not mandatory, you can end execution right there.
1087
1088If you want to return a real value from inside your function NPC, it is better
1089to write it in the function form, which will also work and will make the script
1090generally cleaner:
1091
1092 place,50,50,6%TAB%script%TAB%Man%TAB%115,{
1093 mes "[Man]"
1094 mes "Gimme a number!";
1095 next;
1096 input @number;
1097 if (callfunc("OddFunc",@number)) mes "It's Odd!";
1098 close;
1099 }
1100 function%TAB%script%TAB%OddFunc%TAB%{
1101 if (getarg(0)%2==0) return 0;// it's even
1102 return 1;// it's odd
1103 }
1104
1105---------------------------------------
1106
1107*callsub <label>{,<argument>,...<argument>};
1108
1109This command will go to a specified label within the current script (do NOT use
1110quotes around it) coming in as if it were a 'callfunc' call, and pass it
1111arguments given, if any, which can be recovered there with 'getarg'. When done
1112there, you should use the 'return' command to go back to the point from where
1113this label was called. This is used when there is a specific thing the script
1114will do over and over, this lets you use the same bit of code as many times as
1115you like, to save space and time, without creating extra NPC objects which are
1116needed with 'callfunc'. A label is not callable in this manner from another
1117script.
1118
1119 mes "[Woman]"
1120 mes "Lets see if you win";
1121 callsub Check;
1122 mes "Well done you have won";
1123 close;
1124 Check:
1125 set @win, rand(2);
1126 if(@win==0) return;
1127 mes "Sorry you lost";
1128 close;
1129
1130---------------------------------------
1131
1132*getarg(<index>{,<default_value>})
1133
1134This function is used when you use the 'callsub' or 'callfunc' commands. In the
1135call you can specify variables that will make that call different from another
1136one. This function will return an argument the function or subroutine was
1137called with, and is the normal way to get them.
1138This is another thing that can let you use the same code more than once.
1139
1140Argument numbering starts with 0, i.e. the first argument you gave is number 0.
1141If no such argument was given, a zero is returned.
1142
1143 place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
1144 mes "[Woman]";
1145 mes "Lets see if you win";
1146 callfunc "funcNPC",2;
1147 mes "Well done you have won";
1148
1149 ...
1150
1151 place,52,50,6%TAB%script%TAB%Woman2%TAB%115,{
1152 mes "[Woman]";
1153 mes "Lets see if you win";
1154 callfunc "funcNPC",5;
1155 mes "Well done you have won";
1156
1157 ...
1158
1159 function%TAB%script%TAB%funcNPC%TAB%{
1160 set @win, rand(getarg(0));
1161 if(@win==0) return;
1162 mes "Sorry you lost";
1163
1164"woman1" NPC object calls the funcNPC. The argument it gives in this call is
1165stated as 2, so when the random number is generated by the 'rand' function, it
1166can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
1167calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
1168"woman2" less likely to say the player won.
1169
1170You can pass multiple arguments in a function call:
1171
1172 callfunc "funcNPC",5,4,3;
1173
1174getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
1175
1176Getarg has an optional argument since trunk r10773 and stable r10958.
1177If the target argument exists, it is returned.
1178Otherwise, if <default_value> is present it is returned instead,
1179if not the script terminates immediately.
1180
1181in the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1
1182
1183---------------------------------------
1184
1185*getargcount()
1186
1187This function is used when you use the 'callsub' or 'callfunc' commands. In the
1188call you can specify arguments. This function will return the number of arguments
1189provided.
1190
1191Example:
1192 callfunc "funcNPC",5,4,3;
1193 ...
1194 function%TAB%script%TAB%funcNPC%TAB%{
1195 set .@count, getargcount(); // 3
1196 ...
1197 }
1198
1199---------------------------------------
1200*return {<value>};
1201
1202When you use callsub or callfunc, this command allows you to go back to the
1203calling script. You can optionally return with a value telling the calling
1204program what exactly happened.
1205
1206 callfunc "<your function>";// when nothing is returned
1207 set <variable>,callfunc("<your function>");// when a value is being returned
1208
1209---------------------------------------
1210
1211*function <function name>;
1212*<function name>;
1213*function <function name> {
1214<code>
1215}
1216
1217(Skotlex stop being so selfish and give us all the commands T~T! J/k lol :P)
1218
1219This works like callfunc, but doesn't support arguments like callfunc. It's used for cleaner
1220and fast script that doesn't require arguments for it to work. Also they must be inside a script.
1221They're not separated scripts and they work more like labels.
1222
1223Note it looks like the normal declaration
1224
1225Usage:
1226
1227You first Declare the function with function <function name>;.
1228
1229Put the rest of your code. You can use then <function name>; to call the function. If it returns a value is unsure,
1230test it if you want and give us some comments ;3
1231
1232And at least, but inside the script itself, put the function <function name> {<code>}.
1233
1234舉例:
1235
1236prontera,154,189,4 script Item seller 767,{
1237
1238function SF_Selling;
1239
1240mes "I'll open this now if you have more than 50z and you are level 50 or bigger";
1241next;
1242
1243if (Zeny > 50) && (BaseLevel > 50) {
1244 mes "Welcome";
1245 next;
1246 SF_Selling;
1247 close;
1248} else
1249
1250set @needed,50-BaseLevel;
1251mes "You either are Level "+BaseLevel+", thus you need "+@needed+" more levels";
1252mes "to be able to use this npc; or you don't have enough zeny, so get some please";
1253close;
1254
1255function SF_Selling {
1256
1257 mes "Would you like to buy a phracon for 50z?";
1258 switch(select("Yes","No, thanks")) {
1259
1260 case 1:
1261 mes "Ok, how many?";
1262 input @quantity;
1263 set @check,Zeny/50;
1264 if (@quantity > @check) {
1265 mes "Sorry but you can only have "+@check+" Phracons with "+Zeny;
1266 close;
1267 } else
1268 next;
1269 mes "here you have";
1270 set Zeny,Zeny-@quantity*50;
1271 getitem 1010,@quantity;
1272 close;
1273 case 2:
1274 mes "Good bye then";
1275 close;
1276 }
1277 }
1278 return;
1279}
1280
1281---------------------------------------
1282
1283*if (<condition>) <statement>;
1284
1285This is the basic conditional statement command, and just about the only one
1286available in this scripting language.
1287
1288The condition can be any expression. All expressions resulting in a non-zero
1289value will be considered True, including negative values. All expressions
1290resulting in a zero are false.
1291
1292If the expression results in True, the statement will be executed. If it isn't
1293true, nothing happens and we move on to the next line of the script.
1294
1295 if (1) mes "This will always print.";
1296 if (0) mes "And this will never print.";
1297 if (5) mes "This will also always print.";
1298 if (-1) mes "Funny as it is, this will also print just fine.";
1299
1300For more information on conditional operators see the operators section above.
1301Anything that is returned by a function can be used in a condition check without
1302bothering to store it in a specific variable:
1303
1304 if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
1305
1306More examples of using the 'if' command in the real world:
1307
1308Example 1:
1309
1310 set @var1,1;
1311 input @var2;
1312 if(@var1==@var2) goto L_Same;
1313 mes "Sorry that is wrong";
1314 close;
1315 L_Same:
1316 close;
1317
1318Example 2:
1319
1320 set @var1,1;
1321 input @var2;
1322 if(@var1!=@var2) mes "Sorry that is wrong";
1323 close;
1324
1325(Notice examples 1 and 2 have the same effect.)
1326
1327Example 3:
1328
1329 set @var1,@var1+1;
1330 mes "[Forgetfull Man]";
1331 if (@var==1) mes "This is the first time you have talked to me";
1332 if (@var==2) mes "This is the second time you have talked to me";
1333 if (@var==3) mes "This is the third time you have talked to me";
1334 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";
1335 if (@var==4) set @var,0;
1336 close;
1337
1338Example 4:
1339
1340 mes "[Quest Person]";
1341 if(countitem(512)>=1) goto L_GiveApple;
1342 // The number 512 was found from item_db, it is the item number for the Apple.
1343 mes "Can you please bring me an apple?";
1344 close;
1345 L_GiveApple:
1346 mes "Oh an apple, I didnt want it, I just wanted to see one";
1347 close;
1348
1349Example 5:
1350
1351 mes "[Person Checker]";
1352 if($name$!=null) goto L_Check;
1353 mes "Please tell me someones name";
1354 next;
1355 input $name$;
1356 set $name2$,strcharinfo(0);
1357 mes "[Person Checker]";
1358 mes "Thank you";
1359 L_Check:
1360 if($name$==strcharinfo(0) ) goto L_SameName;
1361 mes "[Person Checker]";
1362 mes "You are not the person that " +$name2$+ " mentioned";
1363 L_End:
1364 set $name$,null;
1365 set $name2$,null;
1366 close;
1367 L_SameName:
1368 mes "[Person Checker]";
1369 mes "You are the person that " +$name2$+ " just mentioned";
1370 mes "nice to meet you";
1371 goto L_End;
1372
1373See 'strcharinfo' for explanation of what this function does.
1374
1375Example 6: Using complex conditions.
1376
1377 mes "[Multi Checker]";
1378 if( (@queststarted==1) && (countitem(512)>=5) ) goto L_MultiCheck;
1379 // Only if the quest has been started AND You have 5 apples will it goto "L_MultiCheck"
1380 mes "Please get me 5 apples";
1381 set @queststarted,1;
1382 close;
1383 L_MultiCheck:
1384 mes "[Multi Checker]";
1385 mes "Well done you have started the quest of got me 5 apples";
1386 mes "Thank you";
1387 set @queststarted,0;
1388 delitem 512,5;
1389 close;
1390
1391With the Advanced scripting engine, we got nested if's. That is:
1392
1393if (<condition>)
1394 dothis;
1395else
1396 dothat;
1397
1398If the condition doesn't meet, it'll do the action following the else.
1399We can also group several actions depending on a condition, the following way:
1400
1401if (<condition)
1402{
1403 dothis1;
1404 dothis2;
1405 dothis3;
1406} else {
1407 dothat1;
1408 dothat2;
1409 dothat3;
1410 dothat4;
1411}
1412
1413Remember that if you plan to do several actions upon the condition being false, and
1414you forget to use the curlies (the { } ), the second action will be executed regardless
1415the output of the condition, unless of course, you stop the execution of the script if the
1416condition is true (that is, in the first grouping using a return; , and end; or a close; )
1417
1418Also, you can have multiple conditions nested or chained, and don't worry about limits as to
1419how many nested if you can have, there is no spoon ;)
1420
1421...
1422if (<condition 1>)
1423 dothis;
1424else if (<condition 2>)
1425{
1426 dotheother;
1427 do that;
1428 end;
1429} else
1430 do this;
1431...
1432
1433---------------------------------------
1434
1435*jump_zero (<condition>),<label>;
1436
1437This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
1438If the condition is false (equal to zero) this command will immediately jump to
1439the specified label like in 'goto'.
1440
1441While 'if' is more generally useful, for some cases this could be an
1442optimisation.
1443
1444---------------------------------------
1445*while (<condition>) <statement>;
1446
1447This is probably the simplest and most frequently used loop structure. The 'while'
1448statement can be interpreted as "while <condition> is true, perform <statement>".
1449It is a pretest loop, meaning the conditional expression is tested before any of the
1450statements in the body of the loop are performed. If the condition evaluates to
1451false, the statement(s) in the body of the loop is/are never executed. If the
1452condition evaluates to true, the statement(s) are executed, then control transfers
1453back to the conditional expression, which is reevaluated and the cycle continues.
1454
1455Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
1456
1457Example 1:
1458 while (switch(select("Yes:No") == 2 ))
1459 mes "You picked no.";
1460
1461Example 2: multiple statements
1462 while (switch(select("Yes:No") == 2 )) {
1463 mes "Why did you pick no?";
1464 mes "You should pick yes instead!";
1465 }
1466
1467Example 3: counter-controlled loop
1468 set .@i, 1;
1469 while (.@i <= 5) {
1470 mes "This line will print 5 times.";
1471 set .@i, .@i +1;
1472 }
1473
1474Example 4: sentinel-controlled loop
1475 mes "Input 0 to stop";
1476 input .@num;
1477 while (.@num != 0) {
1478 mes "You entered " + .@num;
1479 input .@num;
1480 }
1481 close;
1482
1483---------------------------------------
1484
1485*for (<variable initialization>; <condition>; <variable update>) <statement>;
1486
1487Another pretest looping structure is the 'for' statement. It is considered a
1488specialized form of the 'while' statement, and is usually associated with counter-
1489controlled loops. Here are the steps of the 'for' statement: the initialize
1490statement is executed first and only once. The condition test is performed.
1491When the condition evaluates to false, the rest of the for statement is skipped.
1492When the condition evaluates to true, the body of the loop is executed, then the
1493update statement is executed (this usually involves incrementing a variable).
1494Then the condition is reevaluated and the cycle continues.
1495
1496Example 1:
1497 for( set .@i, 1; .@i <= 5; set .@i, .@i +1 )
1498 mes "This line will print 5 times.";
1499
1500Example 2:
1501 mes "This will print the numbers 1 - 5.";
1502 for( set .@i, 1; .@i <= 5; set .@i, .@i +1 )
1503 mes .@i;
1504
1505---------------------------------------
1506
1507*do { <statement>; } while (<condition>);
1508
1509The 'do...while' is the only posttest loop structure available in this script
1510language. With a posttest, the statements are executed once before the condition
1511is tested. When the condition is true, the statement(s) are repeated. When the
1512condition is false, control is transferred to the statement following the
1513'do...while' loop expression.
1514
1515Example 1: sentinel-controlled loop
1516 mes "This menu will keep appearing until you pick Cancel";
1517 do {
1518 set .@menu, select("One:Two:Three:Cancel");
1519 } while (.@menu != 4);
1520
1521Example 2: counter-controlled loop
1522 mes "This will countdown from 10 to 1.";
1523 set .@i, 10;
1524 do {
1525 mes .@i;
1526 set .@i, .@i - 1;
1527 } while (.@i > 0);
1528
1529---------------------------------------
1530
1531*setarray <array name>[<first value>],<value>{,<value>...<value>};
1532
1533This command will allow you to quickly fill up an array in one go. Check the
1534Kafra scripts in the distribution to see this used a lot.
1535
1536 setarray @array[0], 100, 200, 300, 400, 500, 600;
1537
1538First value is the index of the first element of the array to alter. For
1539舉例:
1540
1541 setarray @array[0],200,200,200;
1542 setarray @array[1],300,150;
1543
1544will produce:
1545
1546 @array[0]=200
1547 @array[1]=300
1548 @array[2]=150
1549
1550---------------------------------------
1551
1552*cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
1553
1554This command will change many array values at the same time to the same value.
1555
1556 setarray @array[0], 100, 200, 300, 400, 500, 600;
1557 // This will make all 6 values 0
1558 cleararray @array[0],0,6;
1559 // This will make array element 0 change to 245
1560 cleararray @array[0],245,1;
1561 // This will make elements 1 and 2 change to 345
1562 cleararray @array[1],345,2;
1563
1564See 'setarray'.
1565
1566---------------------------------------
1567
1568*copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
1569
1570This command lets you quickly shuffle a lot of data between arrays, which is in
1571some cases invaluable.
1572
1573 setarray @array[0], 100, 200, 300, 400, 500, 600;
1574 // So we have made @array[]
1575 copyarray @array2[0],@array[2],2;
1576
1577 // Now, @array2[0] will be equal to @array[2] (300) and
1578 // @array2[1] will be equal to @array[3].
1579
1580So using the examples above:
1581 @array[0] = 100
1582 @array[1] = 200
1583 @array[2] = 300
1584 @array[3] = 400
1585 @array[4] = 500
1586 @array[5] = 600
1587
1588New Array:
1589 @array2[0] = 300
1590 @array2[1] = 400
1591 @array2[2] = 0
1592 @array2[3] = 0
1593
1594Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
15950.
1596
1597---------------------------------------
1598
1599*deletearray <array name>[<first value>],<how much to delete>
1600
1601This command will delete a specified number of array elements totally from an
1602array, shifting all the elements beyond this towards the beginning.
1603
1604 // This will delete array element 0, and move all the other array elements
1605 // up one place.
1606 deletearray @array[0],1
1607
1608// This would delete array elements numbered 1, 2 and 3, leave element 0 in its
1609// place, and move the other elements ups, so there are no gaps.
1610
1611 deletearray @array[1],3
1612
1613---------------------------------------
1614
1615======================================
1616|2.- Information-retrieving commands.|
1617======================================
1618---------------------------------------
1619
1620*strcharinfo(<類型>,{<角色ID>})
1621
1622This function will return either the name, party name or guild name for the
1623invoking character. Whatever it returns is determined by type.
1624
1625 0 - Character's name.
1626 1 - The name of the party they're in if any.
1627 2 - The name of the guild they're in if any.
1628 3 - 讀取關聯角色的帳號當前地圖名.
1629 4 - 讀取關聯角色的帳號當前IP地址.
1630 5 - 讀取關聯角色的帳號註冊email地址.
1631 6 - 讀取關聯角色的帳號生日.
1632 7 - 網卡MAC地址.
1633
1634If a character is not a member of any party or guild, an empty string will be
1635returned when requesting that information.
1636
1637---------------------------------------
1638
1639---------------------------------------
1640
1641*strnpcinfo(<類型>)
1642
1643This function will return the various parts of the name of the calling npc.
1644Whatever it returns is determined by type.
1645
1646 0 - The NPC's display name (visible#hidden)
1647 1 - The visible part of the NPC's display name
1648 2 - The hidden part of the NPC's display name
1649 3 - The NPC's unique name (::name)
1650 4 - NPC所在地圖名
1651
1652---------------------------------------
1653
1654*getarraysize(<array name>)
1655
1656This function returns the number of values that are contained inside the
1657specified array. Notice that zeros and empty strings at the end of this array
1658are not counted towards this number.
1659
1660For 舉例:
1661
1662 setarray @array[0], 100, 200, 300, 400, 500, 600;
1663 set @arraysize,getarraysize(@array);
1664
1665This will make @arraysize == 6. But if you try this:
1666
1667 setarray @array[0], 100, 200, 300, 400, 500, 600, 0;
1668 set @arraysize,getarraysize(@array);
1669
1670@arraysize will still equal 6, even though you've set 7 values.
1671
1672---------------------------------------
1673
1674*getelementofarray(<array name>,<index>)
1675
1676This function will return an array's element when given an index.
1677
1678 // This will find the 2nd array value
1679 getelementofarray(@array,1)
1680
1681Pretty pointless now when we have
1682
1683 @array[1]
1684
1685which has the same effect.
1686
1687---------------------------------------
1688
1689*readparam(<parameter number>)
1690
1691This function will return the basic stats of an invoking character, referred to
1692by the parameter number. Instead of a number, you can use a parameter name if it
1693is defined in "db/const.txt".
1694
1695For reference, in there these things are defined:
1696
1697StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
1698JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
1699BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
1700
1701All of these also behave as variables, but don't expect to be able to just 'set'
1702all of them - some will not work for various internal reasons.
1703
1704 // This would return how many status points you haven't spent yet
1705 readparam(9)
1706
1707Using this particular information as a function call is not required. Just
1708putting
1709
1710 StatusPoint
1711
1712will give you the same result, and some of these parameters work just like
1713variables (i.e. you can 'set Zeny,100' to make the character have 100 zeny,
1714destroying whatever zeny they had before, or 'set Zeny,Zeny+100' to give them
1715100 zeny)
1716
1717You can also use this command to get stat values:
1718
1719 readparam(bVit)
1720 if(readparam(bVit)<=77) goto L_End;
1721 mes "Only people with over 77 Vit are reading this";
1722L_End:
1723 close;
1724
1725---------------------------------------
1726
1727*getcharid(<類型>{,"<角色名>"})
1728*getcharid(<類型>{,<CID>})
1729
1730This function will return a unique ID number of the invoking character, or, if a
1731character name is specified, of that character.
1732
1733Type is the kind of associated ID number required:
1734
1735 0 - 角色 ID number.(CID)
1736 1 - 隊伍 ID number.
1737 2 - 公會 ID number.
1738 3 - 賬號 ID number.(AID)
1739 4 - 戰場 ID number.
1740 5 - 幫派 ID number.
1741 6 - 稱號 ID number.
1742
1743For most purposes other than printing it, a number is better to have than a name
1744(people do horrifying things to their character names).
1745
1746If the character is not in a party or not in a guild, the function will return 0
1747if guild or party number is requested. If a name is specified and the character
1748is not found, 0 is returned.
1749
1750If getcharid(0) returns a zero, the script got called not by a character and
1751doesn't have an attached RID. Note that this will cause the map server to
1752print "player not attached!" error messages, so it is preferred to use
1753"playerattached" to check for the character attached to the script.
1754
1755if( getcharid(2) == 0 ) mes "Only members of a guild are allowed here!";
1756
1757---------------------------------------
1758
1759*getchildid()
1760*getmotherid()
1761*getfatherid()
1762
1763These functions return the characters (child/mother/father) ID
1764
1765 if (getmotherid()) mes "Oh... I know your mother's ID:"+getmotherid();
1766
1767---------------------------------------
1768
1769*ispartneron()
1770
1771This function returns 1 if the invoking character's marriage partner is
1772currently online and 0 if they are not or if the character has no partner.
1773
1774---------------------------------------
1775
1776*getpartnerid()
1777
1778This function returns the character ID of the invoking character's marriage
1779partner, if any. If the invoking character is not married, it will return 0,
1780which is a quick way to see if they are married:
1781
1782 if (getpartnerid()) mes "I'm not going to be your girlfriend!";
1783 if (getpartnerid()) mes "You're married already!";
1784
1785---------------------------------------
1786
1787*getpartyname(<party id>)
1788
1789This function will return the name of a party that has the specified ID number.
1790If there is no such party ID, "null" will be returned.
1791
1792Lets say the ID of a party was saved as a global variable:
1793
1794 // This would return the name of the party from the ID stored in a variable
1795 mes "You're in the '"+getpartyname($@var)"' party, I know!";
1796
1797---------------------------------------
1798
1799*getpartymember <party id>{,<類型>{,<角色ID>}};
1800
1801Thank you to HappyDenn for all this information.
1802
1803This command will find all members of a specified party and returns their names
1804(or character id or account id depending on the value of "type") into an array
1805of temporary global variables. There's actually quite a few commands like this
1806which will fill a special variable with data upon execution and not do anything
1807else.
1808
1809Upon executing this,
1810
1811$@partymembername$[] is a global temporary stringarray which contains all the
1812 names of these party members
1813 (only set when type is 0 or not specified)
1814
1815$@partymembercid[] is a global temporary number array which contains the
1816 character id of these party members.
1817 (only set when type is 1)
1818
1819$@partymemberaid[] is a global temporary number array which contains the
1820 account id of these party members.
1821 (only set when type is 2)
1822
1823$@partymembercount is the number of party members that were found.
1824
1825The party members will (apparently) be found regardless of whether they are
1826online or offline. Note that the names come in no particular order.
1827
1828Be sure to use $@partymembercount to go through this array, and not
1829'getarraysize', because it is not cleared between runs of 'getpartymember'. If
1830someone with 7 party members invokes this script, the array would have 7
1831elements. But if another person calls up the NPC, and he has a party of 5, the
1832server will not clear the array for you, overwriting the values instead. So in
1833addition to returning the 5 member names, the 6th and 7th elements from the last
1834call remain, and you will get 5+2 members, of which the last 2 don't belong to
1835the new guy's party. $@partymembercount will always contain the correct number,
1836(5) unlike 'getarraysize()' which will return 7 in this case.
1837
1838舉例:
1839
1840 // get the character's party ID
1841 getpartymember(getcharid(1));
1842
1843 // immediately copy $@partymembercount value to a new variable, since
1844 // you don't know when 'getpartymember' will get called again for someone
1845 // else's party, overwriting your global array.
1846 set @partymembercount,$@partymembercount;
1847
1848 // copy $@partymembername array to a new array
1849 copyarray @partymembername$[0],$@partymembername$[0],@partymembercount;
1850
1851 //list the party members in NPC dialog
1852 set @count,0;
1853 L_DisplayMember:
1854 if(@count == @partymembercount) goto L_DisplayMemberEnd;
1855 mes (@count + 1) + ". ^0000FF" + @partymembername$[@count] + "^000000";
1856 set @count,@count+1;
1857 goto L_DisplayMember;
1858 L_DisplayMemberEnd:
1859 close;
1860
1861---------------------------------------
1862
1863*getpartyleader(<party id>{,<類型>});
1864
1865This function returns some information about the given party-id's leader.
1866When type is ommitted, the default information retrieved is the leader's name.
1867Possible types are:
1868
1869 1: Leader account id
1870 2: Leader character id
1871 3: Leader's class
1872 4: Leader's current map name
1873 5: Leader's current level as stored on the party structure (may not be
1874 current level if leader leveled up recently).
1875
1876If retrieval fails (leader not found or party does not exist), this function
1877returns "null" instead of the character name, and -1 for the other types.
1878
1879---------------------------------------
1880
1881*getlook(<類型>)
1882
1883This function will return the number for the currentcharacter look value
1884specified by type. See 'setlook' for valid look types.
1885
1886This can be used to make a certain script behave differently for characters
1887dressed in black. :)
1888
1889---------------------------------------
1890
1891*getsavepoint(<information type>)
1892
1893This function will return information about the invoking character's save point.
1894You can use it to let a character swap between several recorded savepoints.
1895Available information types are:
1896
1897 0 - Map name (a string)
1898 1 - X coordinate
1899 2 - Y coordinate
1900
1901---------------------------------------
1902
1903*pushpc <方向>,<單元格>;
1904
1905該指令把當前關聯角色向指定方向推指定單元格。方向和NPC定義時用的一樣,
1906也能用 DIR_* 等恆量代替 (db/const.txt).
1907
1908這種擊退不收道具或地圖標籤限制, 只有障礙物有效。如果沒有足夠空間被擊退
1909(例如有牆), 角色會被推至障礙物。
1910
1911 // 把角色從當前位置向3點鐘方向推5格
1912 pushpc DIR_EAST, 5;
1913
1914---------------------------------------
1915
1916*searchstores <次數>,<效果>;
1917
1918打開商店搜索窗口, 用來搜索露天商店和採購商店。
1919數量表示一次搜索的最大商店量。
1920效果表示結果中的道具被雙擊時的效果,數值如下:
1921
1922 0 = 如果商店和玩家在同一地圖時,在小地圖顯示商店位置,並以黃色高亮顯示商店牌
1923 1 = 無視距離直接打開商店
1924
1925舉例:
1926
1927 // Item Universal_Catalog_Gold (搜索10次, 效果: 直接打開)
1928 searchstores 10,1;
1929
1930---------------------------------------
1931\\
19322,2 Item-related commands
1933\\
1934---------------------------------------
1935
1936*getequipid(<equipment slot>)
1937
1938This function returns the item ID of the item equipped in the equipment slot
1939specified on the invoking character. If nothing is equpped there, it returns -1.
1940Valid equipment slots are:
1941
1942EQI_HEAD_TOP (1) - Upper head gear
1943EQI_ARMOR (2) - Armor (Where you keep your Jackets and Robes)
1944EQI_HAND_L (3) - What is in your Left hand.
1945EQI_HAND_R (4) - What is in your Right hand.
1946EQI_GARMENT (5) - The garment slot (Mufflers, Hoods, Manteaus)
1947EQI_SHOES (6) - What foot gear the player has on.
1948EQI_ACC_L (7) - Accessory 1.
1949EQI_ACC_R (8) - Accessory 2.
1950EQI_HEAD_MID (9) - Middle Headgear (masks and glasses)
1951EQI_HEAD_LOW (10) - Lower Headgear (beards, some masks)
1952EQI_AMMO, 11
1953EQI_COSTUME_TOP (12) - Upper Costume Headgear
1954EQI_COSTUME_MID (13) - Middle Costume Headgear
1955EQI_COSTUME_LOW (14) - Lower Costume Headgear
1956EQI_COSTUME_GARMENT (15) - Costume Garment
1957EQI_SHADOW_ARMOR, 16
1958EQI_SHADOW_WEAPON, 17
1959EQI_SHADOW_SHIELD, 18
1960EQI_SHADOW_SHOES, 19
1961EQI_SHADOW_ACC_R, 20
1962EQI_SHADOW_ACC_L 21
1963
1964Notice that a few items occupy several equipment slots, and if the character is
1965wearing such an item, 'getequipid' will return it's ID number for either slot.
1966
1967Can be used to check if you have something equiped, or if you haven't got
1968something equiped:
1969
1970 if(getequipid(EQI_HEAD_TOP)==2234) goto L_WearingTiara;
1971 mes "Come back when you have a Tiara on";
1972 close;
1973 L_WearingTiara:
1974 mes "What a lovely Tiara you have on";
1975 close;
1976
1977You can also use it to make sure people don't pass a point before removing an
1978item totally from them. Let's say you don't want people to wear Legion Plate
1979armor, but also don't want them to equip if after the check, you would do this:
1980
1981 if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
1982 // the || is used as an or argument, there is 2341 and 2342 cause there are
1983 // two different legion plate armors, one with a slot one without.
1984 if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
1985 mes "I will lets you pass";
1986 close2;
1987 warp "place",50,50;
1988 end;
1989 L_EquipedLegionPlate:
1990 mes "You are wearing some Legion Plate Armor, please drop that in your stash before continuing";
1991 close;
1992 L_InventoryLegionPlate:
1993 mes "You have some Legion Plate Armor in your inventory, please drop that in your stash before continuing";
1994 close;
1995
1996---------------------------------------
1997
1998*getequipname(<equpment slot>)
1999
2000Returns the jname of the item equipped in the specified equipment slot on the
2001invoking character, or an empty string if nothing is equipped in that position.
2002Does the same thing as getitemname(getequipid()). Useful for an NPC to state
2003what your are wearing, or maybe saving as a string variable.
2004See 'getequipid' for a full list of valid equipment slots.
2005
2006 if( getequipname(EQI_HEAD_TOP) != "" )
2007 mes "So you are wearing a "+getequipname(EQI_HEAD_TOP)+" on your head";
2008 else
2009 mes "You are not wearing any head gear";
2010
2011---------------------------------------
2012
2013*getitemname(<item id>)
2014
2015Given the database ID number of an item, this function will return the text
2016stored in the 'japanese name' field (which, in eAthena, stores an english name
2017the players would normally see on screen.)
2018
2019---------------------------------------
2020
2021*getbrokenid(<number>)
2022
2023This function will search the invoking character's inventory for any broken
2024items, and will return their item ID numbers. Since the character may have
2025several broken items, 1 given as an argument will return the first one found, 2
2026will return the second one, etc. Will return 0 if no such item is found.
2027
2028 // Let's see if they have anything broken:
2029 if (getbrokenid(1)==0) goto Skip;
2030 // They do, so let's print the name of the first broken item:
2031 mes "Oh, I see you have a broken "+getitemname(getbrokenid(1))+" here!";
2032 Skip:
2033 mes "You don't have anything broken, quit bothering me.";
2034
2035---------------------------------------
2036
2037*getequipisequiped(<equipment slot>)
2038
2039This functions will return 1 if there is an equipment placed on the specified
2040equipment slot and 0 otherwise. For a list of equipment slots
2041see 'getequipid'. Function originally used by the refining NPCs:
2042
2043 if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
2044 mes "[Refiner]";
2045 mes "Do you want me to refine your dumb head?";
2046 close;
2047 L_equipped:
2048 mes "[Refiner]";
2049 mes "That's a fine hat you are wearing there...";
2050 close;
2051
2052
2053---------------------------------------
2054
2055*getequipisenableref(<equipment slot>)
2056
2057Will return 1 if the item equipped on the invoking character in the specified
2058equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
2059see 'getequipid'.
2060
2061 if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
2062 mes "[Refiner]";
2063 mes "I can't refine this hat!...";
2064 close;
2065 L_Refine:
2066 mes "[Refiner]";
2067 mes "Ok I can refine this";
2068 close;
2069
2070---------------------------------------
2071
2072*getequiprefinerycnt(<equipment slot>)
2073
2074Returns the current number of plusses for the item in the specified equipment
2075slot. For a list of equipment slots see 'getequipid'.
2076
2077Can be used to check if you have reached a maximum refine value, default for
2078this is +10:
2079
2080 if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
2081 mes "Sorry, it's not possible to refine hats better than +10";
2082 close;
2083 L_Refine_HeadGear:
2084 mes "I will now upgrade your "+getequipname(EQI_HEAD_TOP);
2085
2086---------------------------------------
2087
2088*getequipweaponlv(<equipment slot>)
2089
2090This function returns the weapon level for the weapon equipped in the specified
2091equipment slot on the invoking character. For a list of equipment slots see
2092'getequipid'.
2093
2094Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons
2095have a weapon level. You can, however, probably, use this field for other
2096equippable custom items as a flag or something.
2097If no item is equipped in this slot, or if it doesn't have a weapon level
2098according to the database, 0 will be returned.
2099
2100 switch (getequipweaponlv(EQI_HAND_R)) {
2101 case 1: mes "You are holding a lvl 1 weapon"; break;
2102 case 2: mes "You are holding a lvl 2 weapon"; break;
2103 case 3: mes "You are holding a lvl 3 weapon"; break;
2104 case 4: mes "You are holding a lvl 4 weapon"; break;
2105 case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design"; break;
2106 default: mes "Seems you don't have a weapon on"; break;
2107 }
2108
2109Or for the left hand, cause it can hold a weapon or a shield:
2110
2111 if(getequipid(EQI_HAND_R)==0) goto L_NothingEquiped;
2112 switch (getequipweaponlv(EQI_HAND_L)) {
2113 case 0: mes "You are holding a shield, so it doesnt have a level"; break;
2114 case 1: mes "You are holding a lvl 1 weapon"; break;
2115 case 2: mes "You are holding a lvl 2 weapon"; break;
2116 case 3: mes "You are holding a lvl 3 weapon"; break;
2117 case 4: mes "You are holding a lvl 4 weapon"; break;
2118 case 5: mes "You are holding a lvl 5 weapon, hm, must be a custom design"; break;
2119 }
2120 close;
2121 L_NothingEquiped:
2122 mes "Seems you have nothing equiped";
2123 close;
2124
2125---------------------------------------
2126
2127*getequippercentrefinery(<equipment slot>)
2128
2129This function calculates and returns the percent value chance to successfully
2130refine the item found in the specified equipment slot of the invoking character
2131by +1. There is no actual formula, the sucess rate for a given weapon level of
2132a certain refine level is found in the db/refine_db.txt file. For a list of
2133equipment slots see 'getequipid'.
2134
2135These values can be displayed for the player to see, or used to calculate the
2136random change of a refine succeeding or failing and then going through with it
2137(which is what the official NPC refinery scripts use it for)
2138
2139// This will find a random number from 0 - 99 and if that is equal to or more
2140// than the value recoverd by this command it will go to L_Fail
2141 if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
2142
2143---------------------------------------
2144
2145*getareadropitem("<地圖名>",<x1>,<y1>,<x2>,<y2>,<item>)
2146
2147This function will count all the items with the specified ID number lying on the
2148ground on the specified map within the x1/y1-x2/y2 square on it and return that
2149number.
2150
2151This is the only function around where a parameter may be either a string or a
2152number! If it's a number, it means that only the items with that item ID number
2153will be counted. If it is a string, it is assumed to mean the 'english name'
2154field from the item database. If you give it an empty string, or something that
2155isn't found from the item database, it will count items number '512' (apples).
2156
2157---------------------------------------
2158
2159*getequipcardcnt(<equipment slot>)
2160
2161This function will return the number of cards that have been compounded onto a
2162specific equipped item for the invoking character. See 'getequipid' for a list
2163of possible equipment slots.
2164
2165---------------------------------------
2166
2167*getinventorylist;
2168*getcartlist;
2169
2170This command sets a bunch of arrays with a complete list of whatever the
2171invoking character has in their inventory, including all the data needed to
2172recreate these items perfectly if they are destroyed. Here's what you get:
2173
2174 @inventorylist_index[] - 道具位置序號
2175 @inventorylist_id[] - 道具id
2176 @inventorylist_amount[] - 對應數量
2177 @inventorylist_equip[] - 是否可以裝備
2178 @inventorylist_refine[] - 精煉值
2179 @inventorylist_identify[] - 是否鑒定
2180 @inventorylist_attribute[] - 是否損壞
2181 @inventorylist_card1[] - 卡片id
2182 @inventorylist_card2[]
2183 @inventorylist_card3[]
2184 @inventorylist_card4[]
2185 @inventorylist_c_exp1[] - 卡片過期時間
2186 @inventorylist_c_exp2[]
2187 @inventorylist_c_exp3[]
2188 @inventorylist_c_exp4[]
2189 @inventorylist_expire[] - 過期時間
2190 @inventorylist_freeze[] - 冷凍截止時間
2191 @inventorylist_durability[]- 耐久度
2192 @inventorylist_maxdur[] - 最大耐久度
2193 @inventorylist_serialno$[] - 序列號
2194 @inventorylist_bonus1[] - 隨機屬性獎勵
2195 @inventorylist_bonus2[]
2196 @inventorylist_bonus3[]
2197 @inventorylist_bonus4[]
2198 @inventorylist_bonus5[]
2199 @inventorylist_val1[] - 隨機屬性值1
2200 @inventorylist_val2[]
2201 @inventorylist_val3[]
2202 @inventorylist_val4[]
2203 @inventorylist_val5[]
2204 @inventorylist_para1[] - 隨機屬性值2
2205 @inventorylist_para2[]
2206 @inventorylist_para3[]
2207 @inventorylist_para4[]
2208 @inventorylist_para5[]
2209 @inventorylist_count - 物品欄中物品數
2210 *以上變量中把inventory改為cart即為對應的getcartlist用法。
2211
2212This could be handy to save/restore a character's inventory, since no other
2213command returns such a complete set of data, and could also be the only way to
2214correctly handle an NPC trader for carded and named items who could resell them
2215- since NPC objects cannot own items, so they have to store item data in
2216variables and recreate the items.
2217
2218Notice that the variables this command generates are all temporary, attached to
2219the character, and integer.
2220
2221Be sure to use @inventorylist_count to go through these arrays, and not
2222'getarraysize', because the arrays are not automatically cleared between runs
2223of 'getinventorylist'.
2224
2225---------------------------------------
2226
2227*cardscnt()
2228
2229This function will return the number of cards inserted into the weapon currently
2230equipped on the invoking character.
2231While this function was meant for item scripts, it will work outside them:
2232
2233 if (cardscnt()==4) mes "So you've stuck four cards into that weapon, think you're cool now?";
2234
2235---------------------------------------
2236
2237*getrefine()
2238
2239This function will return the number of plusses the weapon currently equipped on
2240the invoking character has been refined for.
2241While this function was meant for item scripts, it will work outside them:
2242
2243 if (getrefine()==10) mes "Wow. That's a murder weapon.";
2244
2245---------------------------------------
2246
2247*getnameditem(<item id>,"<name to inscribe>");
2248*getnameditem("<item name>","<name to inscribe>");
2249
2250This function is equivalent to using 'getitem', however, it will not just give
2251the character an item object, but will also inscribe it with a specified
2252character's name. You may not inscribe items with arbitrary strings, only with
2253names of characters that actually exist. While this isn't said anywhere
2254specifically, apparently, named items may not have cards in them, slots or no -
2255these data slots are taken by the character ID who's name is inscribed. Only one
2256remains free and it's not quite clear if a card may be there.
2257
2258This function will return 1 if an item was successfully created and 0 if it
2259wasn't for whatever reason. Like 'getitem', this function will also accept an
2260'english name' from the item database as an item name and will return 0 if no
2261such item exists.
2262
2263---------------------------------------
2264
2265*getitemslots(<item ID>)
2266
2267This function will look up the item with the specified ID number in the database
2268and return the number of slots this kind of items has - 0 if they are not
2269slotted. It will also be 0 for all non-equippable items, naturally, unless
2270someone messed up the item database. It will return -1 if there is no such item.
2271
2272---------------------------------------
2273
2274*getiteminfo(<item ID>,<類型>)
2275
2276This function will look up the item with the specified ID number in the database
2277and return the info set by TYPE argument.
2278It will return -1 if there is no such item.
2279
2280Valid types are:
2281 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
2282 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
2283 if = 0, then monsters don't drop it at all (rare or a quest item)
2284 if = 10000, then this item is sold in NPC shops only
2285 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
2286 10 - slot; 11 - 外觀; 12 - 裝備必要等級; 13 - 裝備等級上限 14 - 武器等級;
2287 15 - view_id(item_avail中的設定); 16 - mdef; 17 - matk
2288
2289Check sample in nps\sample\getiteminfo.txt
2290
2291---------------------------------------
2292
2293*getequipcardid (<equipment slot>,<card slot>);
2294
2295Returns value from equipped item slot in the indicated slot:
2296
2297getequipcardid(num,slot)
2298
2299where:
2300 num = equip position slot
2301 slot = 0,1,2,3 (Card Slot N)
2302
2303This func returns CARD ID, 255,254,-255 (for card 0, if the item is produced) it's useful
2304when you want to check item cards or if it's signed. Useful for such quests as
2305"Sign this refined item with players name" etc;
2306 Hat[0] +4 -> Player's Hat[0] +4
2307
2308--------------------------------------
2309
2310*getitemslots (<item id>);
2311
2312Returns the amount of slots the item has.
2313
2314Example(s):
2315
2316//@slots now has the amount of slots of the item with ID 1205.
2317 set @slots, getItemSlots(1205);
2318
2319--------------------------------------
2320//
23212,1.- End of item-related commands.
2322//
2323---------------------------------------
2324
2325*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<類型>{,"<search string>"})
2326
2327This function will locate a character object, NPC object or pet's coordinates
2328and place their coordinates into the variables specified when calling it. It
2329will return 0 if the search was successful, and -1 if the parameters given were
2330not variables or the search was not successful.
2331
2332Type is the type of object to search for:
2333
2334 0 - Character object
2335 1 - NPC object
2336 2 - Pet object
2337 3 - Monster object.
2338
2339While 3 is meant to look for a monster object, no searching will be done if you
2340specify type 3, and the function will always return -1.
2341
2342The search string is optional. If it is not specified, the location of the
2343invoking character will always be returned for types 0 and 2, the location of
2344the NPC running this function for type 1.
2345If a search string is specified, for types 0 and 1, the character or NPC with
2346the specified name will be located. If type is 3, the search will locate the
2347current pet of the character who's name is given in the search string, it will
2348NOT locate a pet by name.
2349
2350What a mess. Example, a working and tested one now:
2351
2352 prontera,164,301,3%TAB%script%TAB%Meh%TAB%730,{
2353 mes "My name is Meh. I'm here so that Nyah can find me.";
2354 close;
2355 }
2356
2357 prontera,164,299,3%TAB%script%TAB%Nyah%TAB%730,{
2358 mes "My name is Nyah.";
2359 mes "I will now search for Meh all across the world!";
2360 if (getmapxy(@mapname$,@mapx,@mapy,1,"Meh")!=0) goto Notfound;
2361 mes "And I found him on map "+@mapname$+" at X:"+@mapx+" Y:"+@mapy+" !";
2362 close;
2363 Notfound:
2364 mes "I can't seem to find Meh anywhere!";
2365 close;
2366 }
2367
2368Notice that NPC objects disabled with 'disablenpc' will still be located.
2369
2370---------------------------------------
2371
2372*getgmlevel()
2373*getcharlevel()
2374
2375This function will return the GM level of the account to which the invoking
2376character belongs. If this is somehow executed from a console command, 99 will
2377be returned, and 0 will be returned if the account has no GM level.
2378
2379This allows you to make NPC's only accessable for certain GM levels, or behave
2380specially when talked to by GMs.
2381
2382 if (getgmlevel()) mes "What is your command, your godhood?";
2383 if (getgmlevel()) goto Wherever;
2384
2385getgmlevel和getcharlevel的區別是,getcharlevel會無條件返回GM等級,而getgmlevel
2386會返回0,如果你的GM等級小於gm.conf中設置的lowest_gm_level。如果大於等於,則
2387正常返回數值。
2388
2389---------------------------------------
2390
2391*gettimetick(<tick type>)
2392
2393This function will return the system time in UNIX epoch time (if tick type is 2)
2394or the time since the start of the current day in seconds if tick type is 1.
2395Passing 0 will make it return the server's tick, which is a measurement in
2396milliseconds used by the server's timer system. The server's tick is an
2397unsigned int which loops every ~50 days.
2398
2399Just in case you don't know, UNIX epoch time is the number of seconds elapsed
2400since 1st of January 1970, and is useful to see, for example, for how long the
2401character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow
2402you to make an 'online time counted for conviction only' jail script.
2403
2404---------------------------------------
2405
2406*gettime(<類型>)
2407
2408This function will return specified information about the current system time.
2409
24101 - Seconds (of a minute)
24112 - Minutes (of an hour)
24123 - Hour (of a day)
24134 - Week day (0 for Sunday, 6 is Saturday)
24145 - Day of the month.
24156 - Number of the month.
24167 - Year.
24178 - Day of the year.
2418
2419It will only return numbers.
2420
2421 if (gettime(4)==6) mes "It's a Saturday. I don't work on Saturdays.";
2422
2423---------------------------------------
2424
2425*gettimestr(<format string>,<max length>)
2426
2427This function will return a string containing time data as specified by the
2428format string.
2429
2430This uses the C function 'strfmtime', which obeys special format characters. For
2431a full description see, for example, the description of 'strfmtime' at
2432http://www.delorie.com/gnu/docs/glibc/libc_437.html
2433All the format characters given in there should properly work.
2434Max length is the maximum length of a time string to generate.
2435
2436The example given in eAthena sample scripts works like this:
2437
2438 mes gettimestr("%Y-%m/%d %H:%M:%S",21);
2439
2440This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
2441
2442---------------------------------------
2443
2444*getusers(<類型>)
2445
2446This function will return a number of users on a map or the whole server. What
2447it returns is specified by Type.
2448
2449Type can be one of the following values, which control what will be returned:
2450
2451 0 - Count of all characters on the map of the invoking character.
2452 1 - Count of all characters in the entire server.
2453 8 - Count of all characters on the map of the NPC the script is
2454 running in.
2455
2456---------------------------------------
2457
2458*getmapusers("<地圖名>")
2459
2460This function will return the number of users currently located on the specified
2461map.
2462
2463Currently being used in the PVP scripts to check if a PVP room is full of not,
2464if the number returned it equal to the maximum allowed it will not let you
2465enter.
2466
2467---------------------------------------
2468
2469*getareausers("<地圖名>",<x1>,<y1>,<x2>,<y2>)
2470
2471This function will return the count of connected characters which are located
2472within the specified area - an x1/y1-x2/y2 square on the specified map.
2473
2474This is useful for maps that are split into many buildings, such as all the
2475"*_in" maps, due to all the shops and houses.
2476
2477---------------------------------------
2478
2479*getusersname;
2480
2481This command will give the invoking character a list of names of the connected
2482characters (including themselves) into an NPC script message window (see 'mes')
2483paging it by 10 names as if with the 'next' command.
2484
2485You need to put a 'close' after that yourself.
2486
2487---------------------------------------
2488\\
24892,2.- Guild-related commands
2490\\
2491---------------------------------------
2492*getguildname(<guild id>)
2493
2494This function returns a guild's name given an ID number. If there is no such
2495guild, "null" will be returned;
2496
2497 // Would print what ever guild 10007 is, in my case this would return "AlcoROhics"
2498 mes "The guild "+GetGuildName(10007)+" are all nice people.";
2499
2500 // This will do the same as above:
2501 set @var,10007;
2502 mes "We have some friends in "+GetGuildName(@var)+", you know.";
2503
2504This is used all over the WoE controlling scripts. You could also use it for a
2505guild-based event.
2506
2507---------------------------------------
2508
2509*getguildmaster(<guild id>)
2510
2511This function return the name of the master of the guild which has the specified
2512ID number. If there is no such guild, "null" will be returned.
2513
2514// Would return the guild master of guild 10007, whatever that might be.
2515// In this example it would return "MissDjax" cause she owns "AlcoROhics" (10007)
2516 mes getguildmaster(10007)+" runs "+getguildname(10007);
2517
2518Can be used to check if the character is the guildmaster of the specified guild.
2519
2520Maybe you want to make a room only guildmasters can enter:
2521
2522 set @GID,getcharid(2);
2523 if(@GID==0) goto L_NoGuild;
2524 if(strcharinfo(0)==getguildmaster(@GID)) goto L_GuildMaster;
2525 mes "Sorry you don't own the guild you are in";
2526 close;
2527 L_NoGuild:
2528 mes "Sorry you are not in a guild";
2529 close;
2530 L_GuildMaster:
2531 mes "Welcome guild master of "+GetGuildName(@GID);
2532 close;
2533
2534
2535---------------------------------------
2536
2537*getguildmasterid(<guild id>)
2538
2539This function will return the character ID number of the guildmaster of the
2540guild specified by the ID. 0 if the character is not a guildmaster of any guild.
2541
2542---------------------------------------
2543
2544*getcastlename("<地圖名>")
2545
2546This function returns the name of the castle when given the map name for that
2547castle. The data is read from 'db/castle_db.txt'.
2548
2549---------------------------------------
2550
2551*getcastledata("<地圖名>",<type of data>)
2552*setcastledata "<地圖名>",<type of data>,<value>;
2553
2554This function returns the castle ownership information for the castle referred
2555to by it's map name. Castle information stored in 'save\castle.txt' for the TXT
2556version of the server and in 'guild_castle' table for the SQL version.
2557
2558Valid types of data are:
2559
2560 0 - Will make the map server request the castle data from the char server, and
2561 always return 0. This, apparently, will also cause indirectly the execution
2562 of an 'OnAgitInit:' event mentioned at the beginning of this document.
2563 1 - Guild ID
2564 2 - Castle Economy score.
2565 3 - Castle Defence score.
2566 4 - Number of times the economy was invested in today.
2567 5 - Number of times the defence was invested in today.
2568 9 - Will return 1 if a Kafra was hired for this castle, 0 otherwise.
256910 - Is 1 if the 1st guardian is present (Soldier Guardian)
257011 - Is 1 if the 2nd guardian is present (Soldier Guardian)
257112 - Is 1 if the 3rd guardian is present (Soldier Guardian)
257213 - Is 1 if the 4th guardian is present (Archer Guardian)
257314 - Is 1 if the 5th guardian is present (Archer Guardian)
257415 - Is 1 if the 6th guardian is present (Knight Guardian)
257516 - Is 1 if the 7th guardian is present (Knight Guardian)
257617 - Is 1 if the 8th guardian is present (Knight Guardian)
257718 - 佔有城堡的公會的公會名
2578
2579The 'setcastledata' command will behave identically, but instead of returning
2580values for the specified types of accessible data, it will alter them and cause
2581them to be sent to the char server for storage. Data type of 0 won't do
2582anything, obviously.
2583
2584---------------------------------------
2585
2586*getgdskilllv(<guild id>,<skill id>)
2587*getgdskilllv(<guild id>,"<skill name>")
2588
2589This function returns the level of the skill <skill id> of the guild <guild id>.
2590If the guild does not have that skill, 0 is returned.
2591If the guild does not exist, -1 is returned.
2592Refer to 'db/skill_db.txt' for the full list of skills. (GD_* are guild skills)
2593
2594---------------------------------------
2595
2596*requestguildinfo <guild id>,"<event label>";
2597
2598This command requests the guild data from the char server and merrily continues
2599with the execution. Whenever the guild information becomes available (which
2600happens instantly if the guild information is already in memory, or later, if it
2601isn't and the map server has to wait for the char server to reply) it will run
2602the specified event as in a 'doevent' call.
2603
2604---------------------------------------
2605
2606*getmapguildusers <mapname>,<guild id>;
2607
2608Returns the amount of persons from the given guild that are on the given map.
2609Example(s):
2610
2611//Will set the @persons variable to the amount of persons from the guild
2612//which ID's = 10 and are at prontera.
2613
2614 set @persons,getMapGuildUsers "prontera",10;
2615
2616---------------------------------------
2617//
26182,2.- End of guild-related commands
2619//
2620---------------------------------------
2621
2622*getskilllv(<skill id>)
2623*getskilllv("<skill name>")
2624
2625This function returns the level of the specified skill that the invoking
2626character has. If they don't have the skill, 0 will be returned. The full list
2627of character skills is available in 'db/skill_db.txt'.
2628
2629There are two main uses for this function, it can check whether the character
2630has a skill or not, and it can tell you if the level is high enough.
2631
2632Example 1:
2633
2634 f (getskilllv(152)) goto L_HasSkillThrowStone;
2635 mes "You don't have Throw Stone";
2636 close;
2637 L_HasSkillThrowStone:
2638 mes "You have got the skill Throw Stone";
2639 close;
2640
2641Example 2:
2642
2643 if (getskilllv(28) >= 5) goto L_HasSkillHeallvl5orMore;
2644 if (getskilllv(28) == 10) goto L_HasSkillHealMaxed;
2645 mes "You heal skill is below lvl 5";
2646 close;
2647 L_HasSkillHeallvl6orMore:
2648 mes "Your heal lvl is 5 or more";
2649 close;
2650 L_HasSkillHealMaxed:
2651 mes "Your heal lvl has been maxed";
2652 close;
2653
2654---------------------------------------
2655
2656*getskilllist;
2657
2658This command sets a bunch of arrays with a complete list of skills the
2659invoking character has. Here's what you get:
2660
2661@skilllist_id[] - skill ids.
2662@skilllist_lv[] - skill levels.
2663@skilllist_flag[] - see 'skill' for the meaning of skill flags.
2664@skilllist_count - number of skills in the above arrays.
2665
2666While 'getskillv' is probably more useful for most situations, this is the
2667easiest way to store all the skills and make the character something else for a
2668while. Advanced job for a day? :) This could also be useful to see how many
2669skills a character has.
2670
2671---------------------------------------
2672
2673*getpetinfo(<類型>)
2674
2675該功能返回關聯角色的寵物信息,有效的類型有:
2676
2677 0 - 寵物在角色服務器中儲存的唯一ID。
2678 1 - 寵物在 'db/pet_db.txt' 中的類型 。
2679 2 - 寵物名字。如果沒有寵物返回null
2680 3 - 寵物親密度。1000表示忠誠
2681 4 - 寵物飢餓度。100表示吃飽
2682 5 - 寵物是否改過名字。0表示沒有
2683 6 - 寵物是否裝備了裝備。0表示沒有裝備
2684 7 - 寵物等級
2685---------------------------------------
2686
2687*gethominfo(<類型>)
2688
2689This function works as a direct counterpart of 'getpetinfo':
2690 0 - Homunculus unique ID
2691 1 - Homunculus Class
2692 2 - Name
2693 3 - Friendly level (intimacy score). 100000 is full loyalty.
2694 4 - Hungry level. 100 is completely full.
2695 5 - Rename flag. 0 means this homunculus has not been named yet.
2696 6 - Homunculus level
2697---------------------------------------
2698
2699
2700*petstat(<標記>)
2701
2702Returns current pet status, all are integers except name.
2703Returns 0 or "" if the player doesn't have pets.
2704
2705Flags usable >>
2706PET_CLASS
2707PET_NAME
2708PET_LEVEL
2709PET_HUNGRY
2710PET_INTIMATE
2711
2712舉例:
2713set @i, petstat(PET_CLASS);
2714
2715
2716---------------------------------------
2717
2718*getmonsterinfo(<mob ID>,<類型>)
2719
2720This function will look up the monster with the specified ID number in the
2721mob database and return the info set by TYPE argument.
2722It will return -1 if there is no such monster (or the type value is invalid),
2723or "null" if you requested the monster's name.
2724
2725Valid types are listed in const.txt:
2726 MOB_NAME 0 MOB_LV 1
2727 MOB_MAXHP 2 MOB_BASEEXP 3
2728 MOB_JOBEXP 4 MOB_ATK1 5
2729 MOB_ATK2 6 MOB_DEF 7
2730 MOB_MDEF 8 MOB_STR 9
2731 MOB_AGI 10 MOB_VIT 11
2732 MOB_INT 12 JOB_DEX 13
2733 MOB_LUK 14 MOB_RANGE 15
2734 MOB_RANGE2 16 MOB_RANGE3 17
2735 MOB_SIZE 18 MOB_RACE 19
2736 MOB_ELEMENT 20 MOB_MODE 21
2737 MVP_EXP 22
2738
2739Check sample in nps\sample\getmonsterinfo.txt
2740
2741---------------------------------------
2742
2743*getmobdrops(<魔物 id>)
2744
2745This command will find all drops of the specified mob and return the item IDs
2746and drop percentages into arrays of temporary global variables.
2747'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
2748
2749Upon executing this,
2750
2751$@MobDrop_item[] 魔物掉落的物品id數列
2752
2753$@MobDrop_rate[] 魔物掉落的物品的幾率數列 (1 = .01%)
2754
2755$@MobDrop_count 魔物掉落的物品數量
2756
2757Be sure to use $@MobDrop_count to go through the arrays, and not
2758'getarraysize', because the temporary global arrays are not cleared between
2759runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
2760have 7 elements. But if another mob is looked up and it only has 5 item drops,
2761the server will not clear the arrays for you, overwriting the values instead. So
2762in addition to returning the 5 item drops, the 6th and 7th elements from the
2763last call remain, and you will get 5+2 item drops, of which the last 2 don't
2764belong to the new mob. $@MobDrop_count will always contain the correct number
2765(5), unlike 'getarraysize()' which would return 7 in this case.
2766
2767舉例:
2768
2769 // get a Mob ID from the user
2770 input .@mob_id;
2771
2772 if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
2773 // immediately copy global temporary variables into scope variables,
2774 // since we don't know when 'getmobdrops' will get called again for
2775 // another mob, overwriting your global temporary variables
2776 set .@count, $@MobDrop_count;
2777 copyarray .@item[0],$@MobDrop_item[0],.@count;
2778 copyarray .@rate[0],$@MobDrop_rate[0],.@count;
2779
2780 mes getmonsterinfo(.@mob_id,MOB_NAME) + " - " + .@count + " drops found:";
2781 for( set .@i,0; .@i < .@count; set .@i,.@i +1 ) {
2782 mes .@item[.@i] + " (" + getitemname(.@item[.@i]) + ") " + .@rate[.@i]/100 + ((.@rate[.@i]%100 < 10) ? ".0":".") + .@rate[.@i]%100 + "%";
2783 }
2784 } else {
2785 mes "Unknown monster ID.";
2786 }
2787 close;
2788
2789---------------------------------------
2790
2791*getmapmobs("<地圖名>")
2792*getareamobs("<地圖名>",<x0>,<y0>,<x1>,<y1>)
2793
2794This function will return the total count of monsters currently located on the
2795specified map. If the map name is given as "this", the map the invoking
2796character is on will be used. If the map is not found, or the invoker is not a
2797character while the map is "this", it will return -1.
2798
2799---------------------------------------
2800
2801*getstrlen("<string>")
2802
2803This function will return the length of the string given as an argument. It is
2804useful to check if anything input by the player exceeds name length limits and
2805other length limits and asking them to try to input something else.
2806
2807---------------------------------------
2808
2809*skillpointcount;
2810
2811Returns the total amount of skill points a character posesses (SkillPoint+SP's used in skills)
2812This command can be used to check the currently attached characters total amount of skillpoints.
2813This means the skillpoints used in skill are counted, and added to SkillPoints (number of skill points not used).
2814
2815舉例:
2816
2817//This will set the temp character variable @skillPoints to the amount of skillpoints,
2818//and then tell the player the value.
2819 set @skillPoints, skillPointCount();
2820 mes "You have "+@skillPoints+" skillpoints in total!";
2821
2822//Self-explanatory... :P
2823 if (skillPointCount() > 20)
2824 mes "Wow, you have more then 20 Skill Points in total!";
2825
2826---------------------------------------
2827
2828*getscrate(<effect type>,<base rate>{,<target ID number>})
2829
2830This function will return the chance of a status effect affecting the invoking
2831character, in percent, modified by the their current defense against said
2832status. The 'base rate' is the base chance of the status effect being inflicted,
2833in percent.
2834
2835 if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
2836
2837You can see the full list of available effect types you can possibly inflict in
2838'db/const.txt' under 'Eff_'.
2839
2840It is pretty certain that addressing the target by an ID number will not
2841currently work due to a bug.
2842
2843---------------------------------------
2844
2845========================
2846|3.- Checking commands.|
2847========================
2848-------------------------
2849
2850*playerattached;
2851*mobattached;
2852
2853返回關聯當前腳本的玩家AID/魔物GID. 如果沒人關聯會返回0.
2854
2855-------------------------
2856
2857*isloggedin(<account id>{,<角色ID>});
2858
2859This function returns 1 if the specified account is logged in and 0 if they
2860aren't. You can also pass the char_id to check for both account and char id.
2861
2862會返回2,如果該玩家是離線掛店;返回3,如果玩家使用了@offline指令; 返回4,如果該角色由指令創建。
2863
2864---------------------------------------
2865
2866*checkweight(<item id>,<amount>{,<標籤>})
2867*checkweight("<item name>",<amount>{,<標籤>})
2868
2869This function will compute and return 1 if the total weight of a specified
2870number of specific items does not exceed the invoking character's carrying
2871capacity, and 0 otherwise. It is important to see if a player can carry the
2872items you expect to give them, failing to do that may open your script up to
2873abuse or create some very unfair errors.
2874
2875This function, in addition to checking to see if the player is capable of
2876holding a set amount of items, also ensures the player has room in their
2877inventory for the item(s) they will be receciving.
2878
2879Like 'getitem', this function will also accept an 'english name' from the
2880database as an argument.
2881
2882 checkweight(502,10) // 10 apples
2883
2884 if (checkweight(502,10) == 0 ) goto L_OverWeight;
2885 getitem 502,10;
2886 close;
2887 L_OverWeight:
2888 mes "Sorry you cannot hold this ammount of apples";
2889 close;
2890
2891Or to put this another way:
2892
2893 if (checkweight("APPLE",10)) goto L_Getapples;
2894 mes "Sorry you cannot hold this ammount of apples";
2895 close;
2896 L_Getapples:
2897 getitem 502,10;
2898 close;
2899
2900Both these examples have the same effect.
2901
2902標籤:
2903&1 顯示失敗原因信息
2904&2 檢查負重超過90%時即返回超重不再檢測是否可以獲得(寶箱類物品獲得時有此限制)
2905
2906&1時會顯示失敗原因時超重、或格數不夠,或無法堆疊。
2907新版本在從道具獲得道具時,會檢測是否可以獲得。
2908檢測時按照腳本指令順序進行,任何一個腳本指令成功運行,則道具會被消耗。
2909例如:
2910下面的腳本,直接運行時
2911 rentitem 501,1209600,1;
2912 getitem 901,1;
2913 如果身上有99個物品,只有1個空位,那901不會獲得,道具會被消耗。
2914
2915應該有下面的方法檢測:
2916 if( !checkweight(2201,2,3) ) { processhalt; end; } //檢測空位
2917 if( !checkweight(501,2,3) ) { processhalt; end; } //檢測負重,501比901重。
2918 if( !checkweight(901,1,3) ) { processhalt; end; } //檢測901堆疊,501為租賃物品所以無需檢測堆疊。
2919 rentitem 501,1209600,1;
2920 getitem 901,1;
2921
2922---------------------------------------
2923
2924*basicskillcheck()
2925
2926This function will return the state of the configuration option
2927'basic_skill_check' in 'battle_athena.conf'. It returns 1 if the option is
2928enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
2929it is by default, characters must have a certain number of basic skill levels to
2930sit, request a trade, use emoticons, etc. Making your script behave differently
2931depending on whether the characters must actually have the skill to do all these
2932things might in some cases be required.
2933
2934---------------------------------------
2935
2936*checkoption(<option number>)
2937*checkoption1(<option number>)
2938*checkoption2(<option number>)
2939*setoption <option number>{,<標記>};
2940
2941The 'setoption' series of functions check for a so-called option that is set on
2942the invoking character. 'Options' are used to store status conditions and a lot
2943of other non-permanent character data of the yes-no kind. For most common cases,
2944it is better to use 'checkcart','checkfalcon','checkpeco' and other similar
2945functions, but there are some options which you cannot get at this way. They
2946return 1 if the option is set and 0 if the option is not set.
2947
2948Option numbers valid for the first (option) version of this command are:
2949
29500x1 - Sight in effect.
29510x2 - Hide in effect.
29520x4 - Cloaking in effect.
29530x8 - Cart number 1 present.
29540x10 - Falcon present.
29550x20 - Peco Peco present.
29560x40 - GM Perfect Hide in effect.
29570x80 - Cart number 2 present.
29580x100 - Cart number 3 present.
29590x200 - Cart number 4 present.
29600x400 - Cart number 5 present.
29610x800 - Orc head present.
29620x1000 - The character is wearing a wedding sprite.
29630x2000 - Ruwach is in effect.
29640x4000 - Chasewalk in effect.
29650x8000 - Flying or Xmas suit.
29660x10000 - Sighttrasher.
2967
2968Option numbers valid for the second version (opt1) of this command are:
2969
29701 - Petrified.
29712 - Frozen.
29723 - Stunned.
29734 - Sleeping.
29746 - Petrifying (the state where you can still walk)
2975
2976Option numbers valid for the third version (opt2) of this command are:
2977
29780x1 - Poisoned.
29790x2 - Cursed.
29800x4 - Silenced.
29810x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
29820x10 - Blinded.
29830x80 - Deadly poisoned.
2984
2985Option numbers (except for opt1) are bitmasks - you can add them up to check
2986 for several states, but the functions will return true if at least one of them
2987 is in effect.
2988
2989'setoption' will set options on the invoking character. There are no second and
2990third versions of this command, so you can only change the values in the first
2991list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
2992the option will be added to what the character currently has; if 0, the option is removed.
2993
2994This is definitely not a complete list of available option flag numbers. Ask a
2995core developer (or read the source: src/map/status.h) for the full list.
2996
2997---------------------------------------
2998
2999*setcart {<類型>};
3000*checkcart()
3001
3002If <類型> is 0 this command will remove the cart from the character.
3003Otherwise it gives the invoking character a cart. The cart given will be
3004cart number <類型> and will work regardless of whether the character is a
3005merchant class or not.
3006Note: the character needs to have the skill MC_PUSHCART to gain a cart
3007
3008The accompanying function will return 1 if the invoking character has a cart
3009(any kind of cart) and 0 if they don't.
3010
3011 if (checkcart()) mes "But you already have a cart!";
3012
3013---------------------------------------
3014
3015*setfalcon {<標記>};
3016*checkfalcon()
3017
3018If <標記> is 0 this command will remove the falcon from the character.
3019Otherwise it gives the invoking character a falcon. The falcon will be there
3020regardless of whether the character is a hunter or not. It will (probably) not
3021have any useful effects for non-hunters though.
3022Note: the character needs to have the skill HT_FALCON to gain a falcon
3023
3024The accompanying function will return 1 if the invoking character has a falcon
3025and 0 if they don't.
3026
3027 if (checkfalcon()) mes "But you already have a falcon!";
3028
3029---------------------------------------
3030
3031*setwarg {<標記>};
3032*checkwarg()
3033
3034If <標記> is 0 this command will remove the warg from the character.
3035Otherwise it gives the invoking character a warg. The warg will be there
3036regardless of whether the character is a ranger or not. It will (probably) not
3037have any useful effects for non-rangers though.
3038Note: the character needs to have the skill 狼訓練 to gain a warg
3039
3040The accompanying function will return 1 if the invoking character has a warg
3041and 0 if they don't.
3042
3043 if (checkwarg()) mes "But you already have a warg!";
3044
3045---------------------------------------
3046
3047*setriding {<標記>};
3048*checkriding()
3049
3050If <標記> is 0 this command will remove the mount from the character.
3051Otherwise it give the invoking character a PecoPeco (if they are a Knight
3052series class) or a GrandPeco (if they are a Crusader seriesclass). Unlike
3053'setfalcon' and 'setcart' this will not work at all if they aren't of a class
3054which can ride.
3055Note: the character needs to have the skill KN_RIDING to gain a mount
3056
3057The accompanying function will return 1 if the invoking character is riding a
3058bird and 0 if they don't.
3059
3060 if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
3061
3062---------------------------------------
3063
3064*checkvending ({"<player name>"})
3065*checkchatting ({"<Player Name>"})
3066
3067If the player's name is given, this command checks for that player
3068to be online and wether he/she is chatting or vending.
3069When no name is given, the attached player is used for checking.
3070Returns true or false (1 or 0) when the player is chatting/vending or not.
3071
3072Example(s):
3073if (checkVending("Aaron")) mes "Aaron is currently vending!";
3074 //This will check if Aaron is vending, and if so, put a message in front
3075 //of the attached player saying Aaron is vending.
3076
3077if (checkChatting()) mes "You are currently chatting!";
3078 //This will check if you're in a chat room or not
3079
3080---------------------------------------
3081
3082*agitcheck()
3083*agitcheck2()
3084*agitcheck3()
3085
3086This function will let you check whether the server is currently in WoE mode.
3087It will return 1 if the War of Emperium is on and 0 if it isn't.
3088
3089---------------------------------------
3090
3091*isnight()
3092*isday()
3093
3094These functions will return 1 or 0 depending on whether the server is in night
3095mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
3096the other way around. They can be used interchangeably, pick the one you like
3097more:
3098
3099 // These two are equivalent:
3100 if (isday()) mes "I only prowl in the night.";
3101 if (isnight()!=1) mes "I only prowl in the night.";
3102
3103---------------------------------------
3104\\
31053,1.- Item-related commands
3106\\
3107---------------------------------------
3108*isequipped(<id>{,<id>{,<id>{,<id>}}})
3109
3110This function will return 1 if the invoking character has all of the item
3111IDs given equipped (if card IDs are passed, then it checks if the cards are
3112inserted into slots in the equipment they are currently wearing). Theorically
3113there is no limit to the number of items that may be tested for at the same time.
3114If even one of the items given is not equipped, 0 will be returned.
3115
3116 // (Poring,Santa Poring,Poporing,Marin)
3117 if (isequipped(4001,4005,4033,4196)) mes "Wow! You're wearing a full complement of possible poring cards!";
3118 // (Poring)
3119 if (isequipped(4001)) mes "A poring card is useful, don't you think?";
3120
3121The function was meant for item scripts to support the cards released by Gravity
3122in February 2005, but it will work just fine in normal NPC scripts.
3123
3124---------------------------------------
3125
3126*isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
3127
3128This function is similar to 'isequipped', but instead of 1 or 0, it will return
3129the number of cards in the list given that were found on the invoking character.
3130
3131 if (isequippedcnt(4001,4005,4033,4196)=4) mes "Finally got all four poring cards?";
3132
3133---------------------------------------
3134
3135*checkequipedcard(<card id>)
3136
3137This function will return 1 if the card specified by it's item ID number is
3138inserted into any equipment they have in their inventory, currently equipped or
3139not.
3140
3141---------------------------------------
3142
3143*getequipisidentify(<equipment slot>)
3144
3145This function will return 1 if an item in the specified equipment slot is
3146identified and 0 if it isn't. Since you can't even equip unidentified equipment,
3147there's a question of whether it can actually end up there, and it will normally
3148return 1 all the time if there is an item in this equipment slot.
3149Which is kinda pointless.
3150For a list of equipment slots see 'getequipid'.
3151
3152---------------------------------------
3153//
31543,1.- End of item-related commands
3155//
3156---------------------------------------
3157
3158==============================
3159|4.- Player-related commands.|
3160==============================
3161-------------------------
3162
3163*attachrid(<account ID>)
3164*mobattachrid(<GID>) 上面指令的魔物版本
3165*detachrid;
3166
3167A 'RID' is an ID of a character who caused the NPC script to run, as has been
3168explained above in the introduction section. Quite a bit of commands want a RID
3169to work, since they wouldn't know where to send information otherwise. And in
3170quite a few cases the script gets invoked with a RID of zero (like through
3171OnTime special labels). If an NPC script needs this, it can attach a specified
3172character's id to itself. by calling the 'attachrid' function.
3173
3174'attachrid' returns 1 if the character was found online and 0 if it wasn't.
3175
3176This could also be used, while running in a script invoked by a character
3177through talking to an NPC, to mess with other characters.
3178Detaching the RID will make the RID of the script zero.
3179
3180warp_nodetach標識瞬間移動之後不會解除玩家關聯,參數為0或1,
3181設1之後所有傳送都不會解除玩家關聯,直到重設0為止。(官方表現為不解除)
3182warp_nodetach針對全服設置。
3183
3184---------------------------------------
3185
3186*rid2name(<rid>)
3187
3188Converts rid to name. Note: The player/monster/NPC must be online/enabled.
3189Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
3190
3191Note: rid2name may not produce correct character names since rid = account id.
3192 It will return the current online character of the account only.
3193
3194---------------------------------------
3195
3196*message "<character name>","<message>"{,"<類型或密語名>"};
3197
3198That command will send a message to the chat window of the character specified
3199by name. The text will also appear above the head of that character. It will not
3200be seen by anyone else.
3201
3202類型:
32030: 對自己顯示
32041: 公共聊天
32052: 組隊聊天
32063: 公會聊天
3207指定密語名,則為悄悄話,密語名支持頻道名。
3208
3209---------------------------------------
3210
3211*dispbottom "<message>"{,<顏色>};
3212
3213This command will send the given message into the invoking character's chat
3214window.
3215
3216---------------------------------------
3217
3218*warp "<地圖名>",<x>,<y>;
3219
3220This command will take the invoking character to the specifed map, and if
3221wanted, specified coordinates too, but these can be random.
3222
3223 warp "place",50,55;
3224
3225This would take them to X 50 Y 55 on the map called "place". If your X and Y
3226coordinates land on an unwalkable map square, it will send the warped character
3227to a random place. Same will happen if they are both zero:
3228
3229 warp "place",0,0;
3230
3231Notice that while warping people to coordinates 0,0 will normally get them into
3232a random place, it's not certain to always be so. Darned if I know where this is
3233actually coded, it might be that this happens because square 0,0 is unwalkable
3234on all official maps. If you're using custom maps, beware.
3235
3236There are also three special 'map names' you can use.
3237
3238"Random" will warp the player randomly on the current map.
3239"Save" and "SavePoint" will warp the player back to their savepoint.
3240
3241---------------------------------------
3242
3243*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
3244
3245This command is similar to 'warp', however, it will not refer to the invoking
3246character, but instead, all characters within a specified area, defined by the
3247x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
3248including the activating character, if they are outside the area.
3249
3250 areawarp "place",10,10,120,120,"place2",150,150;
3251
3252Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
3253shape, on the map called "place", will be affected, and warped to "place2" X 150
3254Y 150
3255
3256 areawarp "place",10,10,120,120,"place2",0,0;
3257
3258By using ,0,0; as the destination coordinates it will take all the characters in
3259the affected area to a random set of co-ordinates on "place2".
3260
3261Like 'warp', areawarp will also explicitly warp characters randomly into the
3262current map if you give the 'to map name' as "Random".
3263
3264 如果有x4,y4,則傳送套x3,x4,y3,y4組成的區域裡。
3265
3266See also 'warp'.
3267
3268---------------------------------------
3269
3270*warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"{,<x偏移量>{,<y偏移量>}}};
3271
3272Warps a party to specified map and coordinate given the party ID, which you can get with
3273getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
3274
3275You can use the following "map names" for special warping behaviour:
3276Random: All party members are randomly warped in their current map (as if they
3277 all used a fly wing)
3278SavePointAll: All party members are warped to their respective save point.
3279SavePoint: All party members are warped to the save point of the currently
3280 attached player (will fail if there's no player attached).
3281Leader: All party members are warped to the leader's position. The leader must
3282 be online and in the current map-server for this to work.
3283
3284If you specify a from_mapname, warpparty will only affect those on that map.
3285
3286舉例:
3287mes "[Party Warper]";
3288mes "Here you go!";
3289close2;
3290set @id,getcharid(1);
3291warpparty "prontera",150,100,@id;
3292close;
3293
3294偏移量表示在目的地坐標周圍隨機的範圍。
3295
3296---------------------------------------
3297
3298*warpchar "<mapname>",<x>,<y>,<char_id>;
3299
3300Warps another player to specified map and coordinate given the char id, which you can get with
3301getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
3302is executing this script, unless it's some kind of "chosen" script.
3303
3304舉例:
3305
3306warpchar "prontera",150,100,20000001;
3307
3308---------------------------------------
3309
3310*warpguild "<mapname>",<x>,<y>,<guild_id>;
3311
3312Warps a guild to specified map and coordinate given the guild id, which you can get with
3313getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
3314
3315舉例:
3316
3317warpguild "prontera",x,y,Guild_ID;
3318
3319---------------------------------------
3320
3321*warppartner("<地圖名>",<x>,<y>);
3322
3323This function will find the invoking character's marriage partner, if any, and
3324warp them to the map and coordinates given. Go kidnap that spouse. :) It will
3325return 1 upon success and 0 if the partner is not online, the character is not
3326married, or if there's no invoking character (no RID). 0,0 will, as usual,
3327normally translate to random coordinates.
3328
3329---------------------------------------
3330
3331*savepoint "<地圖名>",<x>,<y>;
3332*save "<地圖名>",<x>,<y>;
3333
3334This command saves where the invoking character will return to upon
3335'return to save point', if dead or in some other cases. The two versions are
3336equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious.
3337This ignores any and all map flags, and can make a character respawn where no
3338teleportation is otherwise possible.
3339
3340 savepoint "place",350,75;
3341
3342---------------------------------------
3343
3344*heal <hp>,<sp>;
3345
3346This command will heal a set amount of HP and/or SP on the invoking character.
3347
3348 heal 30000,0; // This will heal 30,000 HP
3349 heal 0,30000; // This will heal 30,000 SP
3350 heal 300,300; // This will heal 300 HP and 300 SP
3351
3352This command just alters the hit points and spell points of the invoking
3353character and produces no other output whatsoever.
3354
3355---------------------------------------
3356
3357*itemheal <hp>,<sp>;
3358
3359This command works on the invoking character like 'heal', however, it is not
3360normally used in NPC scripts and will not work as expected there, but is used
3361all over in item scripts.
3362
3363Unlike 'heal', which just alters hp/sp and doesn't do anything else at all, this
3364command also shows healing animations for potions and other stuff, checks
3365whether the potion was made by a famous alchemist and alters the amount healed,
3366etc, etc. Since which kind of effect is shown depends on what item was used,
3367using it in an NPC script will not have a desired effect.
3368
3369There is also a nice example on using this with the 'rand' function, to give you
3370a random ammount of healing.
3371
3372 // This will heal anything thing from 100 to 150 HP and no SP
3373 itemheal rand(100,150),0;
3374
3375---------------------------------------
3376
3377*percentheal <hp>,<sp>;
3378
3379This command will heal the invoking character. It heals the character, but not
3380by a set value - it adds percent of their maximum HP/SP.
3381
3382 percentheal 100,0; // This will heal 100% HP
3383 percentheal 0,100; // This will heal 100% SP
3384 percentheal 50,50; // This will heal 50% HP and 50% SP
3385
3386So the amount that this will heal will depend on the total ammount of HP or SP
3387you have maximum. Like 'heal', this will not call up any animations or effects.
3388
3389---------------------------------------
3390
3391*recovery;
3392
3393This command will revive and restore full HP and SP to all characters currently
3394connected to the server.
3395
3396---------------------------------------
3397
3398*jobchange <job number>{,<upper flag>};
3399
3400This command will change the job class of the invoking character.
3401
3402 jobchange 1; // This would change your player into a Swordman
3403 jobchange 4002; // This would change your player into a Swordman High
3404
3405This command does work with numbers, but you can also use job names. The full
3406list of job names and the numbers they correspond to can be found in
3407'db/const.txt'.
3408
3409 // This would change your player into a Swordman
3410 jobchange Job_Swordman;
3411 // This would change your player into a Swordman High
3412 jobchange Job_Swordman_High;
3413
3414'upper flag' can alternatively be used to specify the type of job one changes
3415to. For example, jobchange Job_Swordman,1; will change the character to a high
3416swordsman. The upper values are:
3417-1 (or when omitted): preserves the current job type.
34180: Normal/standard classes
34191: High/Advanced classes
34202: Baby classes
3421
3422This command will also set a permanent character-based variable
3423'jobchange_level' which will contain the job level at the time right before
3424changing jobs, which can be checked for later in scripts.
3425
3426---------------------------------------
3427
3428*jobname (<job number>)
3429
3430This command retrieves the name of the given job using the msg_athena entries 550->650.
3431
3432 mes "[Kid]";
3433 mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
3434 close;
3435
3436---------------------------------------
3437
3438*eaclass ({<job number>})
3439
3440This commands returns the "eA job-number" corresponding to the given class (if none is given, it returns uses
3441the invoking player's class as argument). The eA job-number is also a class number system, but it's one that
3442comes with constants which make it easy to convert among classes. The command will return -1 if you pass it a
3443job number which doesn't has a eA Job value equivalent.
3444
3445 set @eac, eaclass();
3446 if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
3447 mes "You must be a swordman, knight, crusader, paladin, high swordman, lord knight, baby swordman,";
3448 mes "baby knight or baby crusader.";
3449 if (@eac&EAJL_UPPER)
3450 mes "You are a rebirth job.";
3451 if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
3452 mes "You must be a Swordman, Baby Swordman or High Swordman.";
3453
3454For more information on the eA Job System, see the docs/ea_job_system.txt file.
3455
3456---------------------------------------
3457*roclass <job number> {,<gender>}
3458
3459Does the opposite of eaclass. That is, given a eA Job class, it returns which is the corresponding RO class number.
3460A gender is required because both Bard and Dancers share the same eA Job value (EAJ_BARDDANCER), if it isn't given, the
3461gender of the executing player is taken (if there's no player running the script, male will be used by default).
3462The command returns -1 when there isn't a valid class to represent the required job (for example, if you try to get the
3463baby version of a Taekwon class).
3464
3465 set @eac, eaclass();
3466 //Check if class is already rebirth
3467 if (@eac&EAJL_UPPER) {
3468 mes "You look strong.";
3469 close;
3470 }
3471 set @eac, roclass(@eac|EAJL_UPPER);
3472 //Check if class has a rebirth version
3473 if (@eac != -1) {
3474 mes "Bet you can't wait to become a "+jobname(@eac)+"!";
3475 close;
3476 }
3477
3478---------------------------------------
3479
3480*changebase <job ID number>;
3481
3482This will change the appearance of the invoking character to that of a specified
3483job class. Nothing but appearance will change. This command is used in item
3484scripts for "Wedding Dress" and "Tuxedo" so the character like job 22, which is
3485the job number of the wedding sprites.
3486
3487It would be entered in the equip bonus section of an item
3488
34892338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,119529470,7,0,16,,0,1,0,{ bonus bMdef,15; changebase 22; }
3490
3491This command only works when inside item scripts.
3492
3493---------------------------------------
3494
3495*classchange <view id>{,"<NPC名>"{,<範圍>}};
3496*classchange <view id>{,<魔物GID>{,<範圍>}};
3497
3498NPC/魔物形象變換。
3499NPC名未指定時為當前關聯NPC
3500<view id>: 不對玩家viewID有效
3501<範圍>:
3502 bc_area - npc為中心的可見範圍
3503 bc_self - 關聯npc的玩家
3504
3505---------------------------------------
3506
3507*changesex;
3508
3509This command will change the gender for the attached character's account. If it
3510was male, it will become female, if it was female, it will become male. The
3511change will be written to the character server, the player will receive the
3512message: "Need disconnection to perform change-sex request..." and the player
3513will be immediately kicked to the login screen. When they log back in, they will
3514be the opposite sex.
3515
3516If there are any Dancer/Gypsy or Bard/Clown characters on the account,
3517they will also have their skills reset upon 'changesex'.
3518
3519---------------------------------------
3520
3521*getexp <base xp>,<job xp>;
3522
3523This command will give the invoking character a specified number of base and job
3524experience points. Can be used as a quest reward. Negative values won't work.
3525
3526 getexp 10000,5000;
3527
3528You can also use the "set" command with the constants defined in 'db/const.txt':
3529
3530 // These 2 combined has the same effect as the above command
3531 set BaseExp,BaseExp+10000;
3532 set JobExp,JobExp+5000;
3533
3534You can also reduce the ammount of experience points:
3535
3536 set BaseExp,BaseExp-10000;
3537
3538Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which
3539adjusts the gained value. If you want to bypass this, use the 'set' method.
3540
3541如果經驗值小於0,則會顯示獲得0點經驗。此選項只對20091027之後客戶端有效。
3542
3543---------------------------------------
3544
3545*setlook <look type>,<look value>;
3546*changelook <look type>,<look value>;
3547
3548'setlook' will alter the look data for the invoking character. It is used
3549mainly for changing the palette used on hair and clothes: you specify which look
3550type you want to change, then the palette you want to use. Make sure you specify
3551a palette number that exists/is usable by the client you use.
3552'changelook' works the same, but is only client side (it doesn't save the look value).
3553
3554 // This will change your hair(6), so that it uses palette 8, what ever your
3555 // palette 8 is, your hair will use that colour
3556
3557 setlook 6,8;
3558
3559 // This will change your clothes(7), so they are using palette 1, whatever
3560 // your palette 1 is, your clothes will then use that set of colours.
3561
3562 setlook 7,1;
3563
3564Here are the possible look types:
3565
3566 0 - 職業
3567 1 - 髮型
3568 2 - 武器
3569 3 - 頭下
3570 4 - 頭上
3571 5 - 頭中
3572 6 - 頭髮顏色
3573 7 - 衣服顏色
3574 8 - 盾
3575 9 - 鞋子
3576 12 - 披肩
3577 13 - 衣服
3578
3579Whatever 'shoes' means is anybody's guess, ask Gravity - the client does nothing
3580with this value. It still wants it from the server though, so it is kept, but
3581normally doesn't do a thing.
3582
3583Only the look data for hairstyle, hair color and clothes color are saved to the
3584char server's database and will persist. The rest freely change as the character
3585puts on and removes equipment, changes maps, logs in and out and otherwise you
3586should not expect to set them. In fact, messing with them is generally
3587hazardous, do it at your own risk, it is not tested what will this actually do -
3588it won't cause database corruption and probably won't cause a server crash, but
3589it's easy to crash the client with just about anything unusual.
3590
3591However, it might be an easy way to quickly check for empty view IDs for
3592sprites, which is essential for making custom headgear.
3593
3594Since a lot of people have different palettes for hair and clothes, it's
3595impossible to tell you what all the colour numbers are. If you want a serious
3596example, there is a Stylist script inside the default eAthena installation that
3597you can look at, this may help you create a Stylist of your own:
3598'custom\dye.txt'
3599
3600---------------------------------------
3601\\
36024,1.- Item-related commands
3603\\
3604---------------------------------------
3605
3606*getitem <item id>,<amount>{,<account ID>};
3607*getitem "<item name>",<amount>{,<account ID>};
3608
3609This command will give a specific amount of specified items to the target
3610character. If the character is not online, nothing will happen.
3611If <character ID> is not specified, items will be created in the invoking
3612character inventory instead.
3613
3614In the first and most commonly used version of this command, items are
3615referred to by their database ID number found inside 'db/item_db.txt'.
3616
3617 getitem 502,10 // The person will receive 10 apples
3618 getitem 617,1 // The person will receive 1 Old Violet Box
3619
3620Giving an item ID of -1 will give a specified number of random items from the
3621list of those that fall out of Old Blue Box. Unlike in all other cases, these
3622will be unidentified, if they turn out to be equipment. This is exactly what's
3623written in the Old Blue Box's item script.
3624
3625Other negative IDs also correspond to other random item generating item tables:
3626
3627Giving an item ID of -2 will produce the effects of Old Violet Box.
3628Giving an item ID of -3 will produce the effects of Old Card Album.
3629Giving an item ID of -4 will produce the effects of Gift Box.
3630Giving an item ID of -5 will produce the effects of Worn Out Scroll, which, in
3631current SVN, drops only Jellopies anyway.
3632
3633This transaction is logged if the log script generated transactions option is
3634enabled.
3635
3636You may also create an item by it's name in the 'english name' field in the
3637item database:
3638
3639 getitem "RED_POTION",10;
3640
3641Which will do what you'd expect. If it can't find that name in the database,
3642apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
3643
3644This is used in pretty much all NPC scripts that have to do with items and
3645quite a few item scripts. For more examples check just about any official script.
3646
3647---------------------------------------
3648
3649*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
3650*getitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
3651*getitem3 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
3652*getitem3 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>{,<account ID>};
3653
3654This command will give an amount of specified items to the invoking character.
3655If an optional character ID is specified, and that character is currently
3656online, items will be created in their inventory instead. If they are not
3657online, nothing will happen. It works essentially the same as 'getitem' (it even
3658works for negative ID numbers the same way, which is kinda silly) but is a lot
3659more flexible, since it allows you to give the player an item altered with it's
3660specific properties.
3661
3662Those parameters that are different from 'getitem' are:
3663
3664identify - Whether you want the item to be identified or not, 0 unidentified,
3665 1 identified.
3666refine - For how many plusses will it be refined.
3667 It will not let you refine an item higher than +10, if you
3668 specify more it'll still be 10.
3669attribute - Whether the item is broken (1) or not (0) and NOT an elemental
3670 attribute.
3671card1,2,3,4 - If you want a card compound to it, place the card ID number into
3672 the specific card slot. Card ID numbers also found in
3673 'db/item_db.txt'
3674
3675Card1-card4 values are also used to store name information for named items, as
3676well as the elemental property of weapons and armor. You can create a named item
3677in this manner, however, if you just need a named piece of standard equipment,
3678it is much easier to the 'getnameditem' function instead.
3679
3680You will need to keep these values if you want to destroy and then perfectly
3681recreate a named item, for this see 'getinventorylist'.
3682
3683If you still want to try creating a named item with this command because
3684'getnameditem' won't do it for you cause it's too limited, you can do it like
3685this. Careful, minor magic ahead.
3686
3687 // First, let's get an ID of a character who's name will be on the item.
3688 // Only an existing character's name may be there.
3689 // Let's assume our character is 'Adam' and find his ID.
3690
3691 set @charid,getcharid(0,"Adam");
3692
3693 // Now we split the character ID number into two portions with a binary
3694 // shift operation. If you don't understand what this does, just copy it.
3695
3696 set @card3, @charid & 65535;
3697 set @card4, @charid >> 16;
3698
3699 // If you're inscribing non-equipment, @card1 must be 254.
3700 // Arrows are also not equipment. :)
3701 set @card1,254;
3702
3703 // For named equipment, card2 means the Star Crumbs and elemental
3704 // crystals used to make this equipment. For everything else, it's 0.
3705
3706 set @card2,0;
3707
3708 // Now, let's give the character who invoked the script some
3709 // Adam's Apples:
3710
3711 getitem2 512,1,1,0,0,@card1,@card2,@card3,@card4;
3712
3713This wasn't tested with all possible items, so I can't give any promises,
3714experiment first before relying on it.
3715
3716To create equipment, continue this example it like this:
3717
3718 // We've already have card3 and card4 loaded with correct
3719 // values so we'll just set up card1 and card2 with data
3720 // for an Ice Stiletto.
3721
3722 // If you're inscribing equipment, @card1 must be 255.
3723 set @card1,255;
3724
3725 // That's the number of star crumbs in a weapon.
3726 set @sc,2;
3727
3728 // That's the number of elemental property of the weapon.
3729 set @ele,1;
3730
3731 // And that's the wacky formula that makes them into
3732 // a single number.
3733 set @card2,@ele+((@sc*5)<<8);
3734
3735 // That will make us an Adam's +2 VVS Ice Stiletto:
3736
3737 getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
3738
3739Experiment with the number of star crumbs - I'm not certain just how much will
3740work most and what it depends on. The valid element numbers are:
3741
3742 1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
3743
3744You can, apparently, even create duplicates of the same pet egg with this
3745command, creating a pet which is the same, but simultaneously exists in two
3746eggs, and may hatch from either, although, I'm not sure what kind of a mess will
3747this really cause.
3748
3749'getitem3' is advance version of 'getitem2' that also use Item Random Option as additional values.
3750<RandomIDArray> : Array variable of ID for item random option, see db/[pre-]re/item_randomopt_db.txt
3751<RandomValueArray> : Array variable of item random option's value.
3752<RandomParamArray> : Array variable of item random option's param.
3753
3754Example to get Crimson Weapon with Ghost property:
3755 // +9 Crimson Dagger [2]
3756 setarray .@OptID[0],RDMOPT_WEAPON_ATTR_TELEKINESIS;
3757 setarray .@OptVal[0],0;
3758 setarray .@OptParam[0],0;
3759 getitem3 28705,1,1,9,0,0,0,0,0,.@OptID,.@OptVal,.@OptParam;
3760
3761---------------------------------------
3762
3763* getnameditem <item name|item id>,<Character name|character ID>;
3764
3765-Note: there's a total of 4 possible combinations of this command.
3766E.g: item name and character name, or with character id, etc...
3767
3768Create a item signed with the given character's name.
3769This is the same as using the hard(ly) explained way with getitem2.
3770
3771The command returns 1 when the item is created succesfully, or 0 when failed.
3772Failure occurs when there is:
3773- no player attached
3774- Item name or ID is not valid
3775- The given character ID/name is offline.
3776
3777舉例:
3778
3779//This will give the currently attached player a Aaron's Apple (if Aaron is online).
3780 getnameditem "Apple","Aaron";
3781
3782//Self-explanatory (I hope).
3783 if (getnameitem("Apple,"Aaron")) {
3784 mes "You now have a Aaron's Apple!";
3785 }
3786
3787---------------------------------------
3788
3789*rentitem <item id>,<time>{,<會消耗>{,<數量>}};
3790*rentitem "<item name>",<time>{,<會消耗>{,<數量>}};
3791
3792Creates a rental item in the attached character's inventory. The item will expire
3793in <time> seconds and be automatically deleted. When receiving a rental item,
3794the character will receive a message in their chat window. The character will
3795also receive warning messages in their chat window before the item disappears.
3796
3797This command can not be used to rent stackable items. Rental items cannot be
3798removed from the character's inventory. (i.e. trade mask 123 in ../db/item_trade.txt)
3799Note: 'delitem' in an NPC script can still remove rental items.
3800
3801如果<會消耗>為1,則租賃的可消耗物品在使用後即消失。
3802<數量>和<會消耗>,僅對可疊加物品有效。
3803
3804---------------------------------------
3805
3806*renttradableitem <道具id>,<毫秒>;
3807*renttradableitem "<道具名>",<毫秒>;
3808
3809同rentitem,不同點在於租賃的物品可以交易。
3810
3811---------------------------------------
3812
3813*makeitem <item id>,<amount>,"<地圖名>",<X>,<Y>{,<時間>};
3814*makeitem "<item name>",<amount>,"<地圖名>",<X>,<Y>{,<時間>};
3815
3816This command will create an item lying around on a specified map in the
3817specified location.
3818
3819 itemid - Found in 'db/item_db.txt'
3820 amount - Amount you want produced
3821 map name - The map name
3822 X - The X coordinate
3823 Y - The Y coordinate.
3824 時間 - 過多久會在地面清除,單位毫秒
3825
3826This item will still disappear just like any other dropped item. Like 'getitem',
3827it also accepts an 'english name' field from the database and creates apples if
3828the name isn't found.
3829If the map name is given as "this", the map the invoking character is on will be used.
3830
3831---------------------------------------
3832
3833*makeitem2 <item id>,<amount>,"<地圖名>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<時間>{,<優先人>{,<掉落者>}}};
3834*makeitem2 "<item name>",<amount>,"<地圖名>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<時間>{,<優先人>{,<掉落者>}}};
3835
3836This command will create an item lying around on a specified map in the
3837specified location.
3838
3839 itemid - Found in 'db/item_db.txt'
3840 amount - Amount you want produced
3841 map name - The map name
3842 X - The X coordinate
3843 Y - The Y coordinate.
3844 時間 - 過多久會在地面清除,單位毫秒
3845 優先人 - 有優先獲取權限的角色ID
3846 掉落者 - 魔物ID,有此標識會觸發item_announce
3847
3848This item will still disappear just like any other dropped item. Like 'getitem',
3849it also accepts an 'english name' field from the database and creates apples if
3850the name isn't found.
3851If the map name is given as "this", the map the invoking character is on will be used.
3852nameid為-X時,代表從X道具組隨機一個物品。
3853
3854---------------------------------------
3855
3856*searchitem <array name>,"<item name>";
3857
3858This command will fill the given array with the ID of items whose name matches the given one. It returns the number of items found. For performance reasons, the results array is limited to 10 items.
3859
3860 mes "What item are you looking for?";
3861 input @name$;
3862 set @qty, searchitem(@matches[0],@name$);
3863 mes "I found "+@qty+" items:";
3864 for (set @i, 0; @i < @qty; set @i, @i+1)
3865 //Display name (eg: "Apple[0]")
3866 mes getitemname(@matches[@i])+"["+getitemslots(@matches[@i])+"]";
3867
3868---------------------------------------
3869
3870*delitem <item id>,<amount>{,<account ID>};
3871*delitem "<item name>",<amount>{,<account ID>};
3872*delcartitem <item id>,<amount>{,<account ID>};
3873*delcartitem "<item name>",<amount>{,<account ID>};
3874*delstorageitem <item id>,<amount>{,<account ID>};
3875*delstorageitem "<item name>",<amount>{,<account ID>};
3876
3877This command will take a specified amount of items from the invoking character.
3878As all the item commands, this one uses the ID of the item found inside
3879'db/item_db.txt'. The items are destroyed - there is no way an NPC can simply
3880own items and have an inventory of them, other as by destroying and recreating
3881them when needed.
3882
3883 delitem 502,10 // The person will lose 10 apples
3884 delitem 617,1 // The person will lose 1 Old Violet Box
3885
3886It is always a good idea to to check if the player actually has the item before
3887you take it from them, Otherwise, you could try to delete items which the
3888players don't actually have, which won't fail and won't give an error message,
3889but might open up ways to exploit your script.
3890
3891Like 'getitem' this command will also accept an 'english name' field from the
3892database. If the name is not found, nothing will be deleted.
3893
3894---------------------------------------
3895
3896*delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
3897*delitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
3898
3899This command will take a specified amount of items from the invoking character.
3900Check 'getitem2' to understand its expanded parameters.
3901
3902---------------------------------------
3903
3904*countitem(<item id>)
3905*countitem("<item name>")
3906*countcartitem(<item id>)
3907*countcartitem("<item name>")
3908*countstorageitem(<item id>)
3909*countstorageitem("<item name>")
3910
3911This function will return the number of items for the specified item ID that the
3912invoking character has in the inventory.
3913
3914 mes "[Item Checker]";
3915 mes "Hmmm, it seems you have "+countitem(502)+" apples";
3916 close;
3917
3918Like 'getitem', this function will also accept an 'english name' from the
3919database as an argument.
3920
3921If you want to state the number at the end of a sentence, you can do it by
3922adding up strings:
3923
3924 mes "[Item Checker]";
3925 mes "Hmmm, the total number of apples you are holding is "+countitem("APPLE");
3926 close;
3927
3928---------------------------------------
3929
3930*countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
3931*countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
3932
3933Expanded version of 'countitem' function, used for created/carded/forged items.
3934
3935This function will return the number of items for the specified item ID and
3936other parameters that the invoking character has in the inventory.
3937Check 'getitem2' to understand the arguments of the function.
3938
3939---------------------------------------
3940
3941*groupranditem <group id>{, <sub_group>};
3942
3943Returns the item_id of a random item picked from the group specified. The
3944different groups and their group number are specified in db/item_group_db.txt
3945
3946When used in conjunction with other functions, you can get a random item. For
3947example, for a random pet lure:
3948
3949getitem groupranditem(15),1;
3950
3951---------------------------------------
3952
3953*enable_items;
3954*disable_items;
3955
3956These commands enable item usage while an npc is running. When enable_items is
3957run, items can be used during scripts until disable_items is called.
3958To avoid possible exploits, when enable_items is invoked, it will only enable
3959item usage while running that script in particular. Note that if a different
3960script also calls enable_items, it will override the last call (so you may
3961want to call this command at the start of your script without assuming the
3962effect is still in effect).
3963
3964---------------------------------------
3965
3966*itemskill <skill id>,<skill level>;
3967*itemskill "<skill name>",<skill level>;
3968
3969This is a command meant for item scripts to replicate single-use skills. It will
3970not work properly in NPC scripts a lot of the time because casting a skill is
3971not allowed when there is a message window or menu on screen. If there isn't one
3972cause you've made sure to run this when they already closed it, it should work
3973just fine and even show a targeting pointer if this is a targeting skill.
3974
3975// When you use Anodyne, you will cast Endure(8) level 1,
3976// and "Endure" will appear above your head as you use it.
3977605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
3978
3979
3980---------------------------------------
3981
3982*produce <item level>;
3983
3984This command will open a crafting window on the client connected to the invoking
3985character. The 'item level' is a number which determines what kind of a crafting
3986window will pop-up. You can see the full list of such item levels in
3987'db/produce_db.txt' which determines what can actually be produced.
3988The window will not be empty only if the invoking character can actually produce
3989the items of that type and has the appropriate raw materials in their inventory.
3990
3991Valid item levels are:
3992
3993 1 - Level 1 Weapons
3994 2 - Level 2 Weapons
3995 3 - Level 3 Weapons
3996 21 - Blacksmith's Stones and Metals
3997 22 - Alchemist's Potions, Holy Water, Assassin Cross's Deadly Poison
3998 23 - Elemental Converters
3999
4000---------------------------------------
4001
4002*cooking <dish level>;
4003
4004This command will open a produce window on the client connected to the invoking
4005character. The 'dish level' is the number which determines what kind of dish
4006level you can produce. You can see the full list of dishes that can be produced in
4007'db/produce_db.txt'.
4008
4009The window will be shown empty if the invoking character does not have enough of
4010the required incredients to cook a dish.
4011
4012Valid dish levels are:
4013
401411 - Level 1 Dish
401512 - Level 2 Dish
401613 - Level 3 Dish
401714 - Level 4 Dish
401815 - Level 5 Dish
401916 - Level 6 Dish
402017 - Level 7 Dish
402118 - Level 8 Dish
402219 - Level 9 Dish
402320 - Level 10 Dish
4024
4025Altough it's required to set a dish level, it doesn't matter if you set it to 1
4026and you want to cook a level 10 dish, as long as you got the required incredients
4027to cook the dish the command works.
4028
4029---------------------------------------
4030
4031*successremovecards <equipment slot>;
4032
4033This command will remove all cards from the item found in the specified
4034equipment slot of the invoking character, create new card items and give them to
4035the character. If any cards were removed in this manner, it will also show a
4036success effect.
4037
4038---------------------------------------
4039
4040*failedremovecards <equipment slot>,<類型>;
4041
4042This command will remove all cards from the item found in the specified
4043equipment slot of the invoking character. 'type' determines what happens to the
4044item and the cards:
4045
4046 0 - will destroy both the item and the cards.
4047 1 - will keep the item, but destroy the cards.
4048 2 - will keep the cards, but destroy the item.
4049
4050Whatever the type is, it will also show a failure effect on screen.
4051
4052---------------------------------------
4053
4054*repair <broken item number>;
4055
4056This command repairs a broken peice of equipment, using the same list of broken
4057items as available through 'getbrokenid'.
4058
4059The official scripts seem to use the repair command as a function instead:
4060'repair(<number>)' but it returns nothing on the stack. Probably only Valaris,
4061who made it, can answer why is it so.
4062
4063---------------------------------------
4064
4065*successrefitem <equipment slot>{, <增加精煉值>};
4066
4067This command will refine an item in the specified equipment slot of the invoking
4068character by +1. For a list of equipment slots see 'getequipid'. This command
4069will not only add the +1, but also display a 'refine success' effect on the
4070character and put appropriate messages into their chat window. It will also give
4071the character fame points if a weapon reached +10 this way, even though these
4072will only take effect for blacksmith who will later forge a weapon.
4073
4074The official scripts seem to use the 'successrefitem' command as a function
4075instead: 'successrefitem(<number>)' but it returns nothing on the stack.
4076This is since jAthena, so probably nobody knows for sure why is it so.
4077
4078<增加精煉值>默認為1;
4079
4080---------------------------------------
4081
4082*failedrefitem <equipment slot>;
4083
4084This command will fail to refine an item in the specified equipment slot of the
4085invoking character. The item will be destroyed. This will also display a 'refine
4086failure' effect on the character and put appropriate messages into their chat
4087window.
4088
4089The official scripts seem to use the 'failedrefitem' command as a function
4090instead: 'failedrefitem(<number>)' but it returns nothing on the stack. This is
4091since jAthena, so probably nobody knows for sure why is it so.
4092
4093---------------------------------------
4094
4095*failedrefitem2 <裝備位置>,<精煉值>;
4096
4097This command will fail to refine an item in the specified equipment slot of the
4098invoking character. 道具精煉值會根據指定值減少. This will also display a 'refine
4099failure' effect on the character and put appropriate messages into their chat
4100window.
4101
4102---------------------------------------
4103
4104*unequip(<裝備位置>);
4105
4106This command will unequip whatever is currently equipped in the invoking
4107character's specified equipment slot. For a full list of possible equipment
4108slots see 'getequipid'.
4109
4110If an item occupies several equipment slots, it will get unequipped from all of
4111them. (Which is a good thing.)
4112
4113返回值可用以delinventory等inventory系列指令。
4114
4115---------------------------------------
4116
4117*clearitem;
4118
4119This command will destroy all items the invoking character has in their
4120inventory. (that includes equipped items) It will not affect anything else, like
4121storage or cart.
4122
4123---------------------------------------
4124
4125*equip <item id>;
4126*autoEquip <item id>,<option>;
4127
4128These commands are to equip a equipment on the attached character.
4129The equip function will equip the item ID given when the player has
4130this item in his/her inventory, while the autoequip function will
4131equip the given item ID when this is looted. The option parameter of
4132the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
4133
4134Example(s):
4135
4136//This will equip a 1104 (falchion) on the character if this is in the inventory.
4137 equip 1104;
4138
4139//The invoked character will now automatically equip a falchion when it's looted.
4140 autoequip 1104,1;
4141
4142//The invoked character will no longer automatically equip a falchion.
4143 autoequip 1104,0;
4144
4145---------------------------------------
4146//
41474,1.- End of item-related commands
4148//
4149---------------------------------------
4150
4151*openstorage{ "<倉庫顯示名字>"{,<倉庫序號>}};
4152
4153This will open a character's Kafra storage window on the client connected to the
4154invoking character. It does not check wherever it is run from, so you can allow
4155any feasible NPC to open a kafra storage. (It's not certain whether this works
4156in item scripts, but if it does, it could be interesting.)
4157
4158The storage window might not open if a message box or a trade deal is present on
4159screen already, so you should at least make sure the message box is closed
4160before you open storage.
4161
4162 mes "I will now open your stash for you";
4163 close2;
4164 openstorage;
4165 end;
4166
4167倉庫序號不輸入默認為0
4168倉庫序號範圍為0~(sub_storage-1)
4169
4170倉庫名字默認玩家姓名
4171
4172---------------------------------------
4173
4174*openmail;
4175
4176This will open a character's Mail window on the client connected to the
4177invoking character.
4178
4179 mes "Close this window to open your mail inbox.";
4180 close2;
4181 openmail;
4182 end;
4183
4184---------------------------------------
4185
4186*openauction;
4187
4188This will open the Auction window on the client connected to the invoking character.
4189
4190 mes "Close this window to open the Auction window.";
4191 close2;
4192 openauction;
4193 end;
4194
4195---------------------------------------
4196\\
41974,2.- Guild-related commands
4198\\
4199---------------------------------------
4200
4201*guildopenstorage({<參數>})
4202
4203This function works the same as 'openstorage' but will open a guild storage
4204window instead for the guild storage of the guild the invoking character belongs
4205to. This is a function because it returns a value
4206- 0 如果打開成功
4207- 1 如果不成功,例如已經有人打開了公會倉庫時
4208- 2 如果角色沒有公會
4209
4210如果設置了參數(可以是任何值),則檢查公會倉庫權限設置
4211如果沒有權限,則返回
4212- 3 如果角色的公會等級不能打開公會倉庫
4213
4214---------------------------------------
4215
4216*guildchangegm(<guild id>,<new master's name>)
4217
4218This function will change the Guild Master of a guild. The ID is the guild's
4219id, and the new guildmaster's name must be passed.
4220
4221Returns 1 on success, 0 otherwise.
4222
4223---------------------------------------
4224
4225*guildgetexp <amount>;
4226
4227This will give the specified amount of guild experience points to the guild the
4228invoking character belongs to. It will silently fail if they do not belong to
4229any guild.
4230
4231---------------------------------------
4232
4233*guildskill <skill id>,<level>
4234*guildskill "<skill name>",<level>
4235
4236This command will bump up the specified guild skill by the specified number of
4237levels. This refers to the invoking character and will only work if the invoking
4238character is a member of a guild AND it's guildmaster, otherwise no failure
4239message will be given and no error will occur, but nothing will happen - same
4240about the guild skill trying to exceed the possible maximum. The full list of
4241guild skills is available in 'db/skill_db.txt', these are all the GD_ skills at
4242the end.
4243
4244The flag parameter is currently not functional and it's a mystery of what it
4245would actually do. (Though probably, like for character skills, it would allow
4246temporary bumping.) Using this command will bump the guild skill up permanently.
4247
4248// This would give your character's guild one level of Approval (GD_APPROVAL ID
4249// 10000). Notice that if you try to add two levels of Approval, or add
4250// Approval when the guild already has it, it will only have one level of
4251// Approval afterwards.
4252 guildskill 10000,1,0;
4253
4254You might want to make a quest for getting a certain guild skill, make it hard
4255enough that all the guild needs to help or something. Doing this for the Glory
4256of the Guild skill, which allows your guild to use an emblem, is a good idea for
4257a fun quest. (Wasting a level point on that is really annoying :D)
4258
4259---------------------------------------
4260//
42614,2 End of guild-related commands.
4262//
4263---------------------------------------
4264
4265*resetlvl <action type>;
4266
4267This is a character reset command, meant mostly for rebirth script supporting
4268Advanced jobs, which will reset the invoking character's stats and level
4269depending on the action type given. Valid action types are:
4270
4271 1 - Base level 1, Job level 1, 0 skill points, 0 base xp, 0 job xp, wipes the
4272 status effects (only the ones settable by 'setoption'), sets all stats to 1.
4273 If the new job is 'Novice High', give 100 status points, give First Aid and
4274 Play Dead skills.
4275 2 - Base level 1, Job level 1, 0 skill points, 0 base xp, 0 job xp.
4276 Skills and attribute values are not altered.
4277 3 - Base level 1, base xp 0. Nothing else is changed.
4278 4 - Job level 1, job xp 0. Nothing else is changed.
4279
4280In all cases it will also unequip everything the character has on.
4281
4282Even though it doesn't return a value, it is used as a function in the official
4283rebirth scripts. Ask AppleGirl why.
4284
4285---------------------------------------
4286
4287*resetstatus;
4288
4289This is a character reset command, which will reset the stats on the invoking
4290character and give back all the stat points used to raise them previously.
4291Nothing will happen to any other numbers about the character.
4292
4293Used in reset NPC's (duh!)
4294
4295---------------------------------------
4296
4297*resetskill;
4298
4299This command takes off all the skill points on the invoking character, so they
4300only have Basic Skill blanked out (lvl 0) left, and returns the points for them
4301to spend again. Nothing else will change but the skills. Quest skills will also
4302reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
4303the 'quest_skill_learn' option is set in there, the points in the quest skills
4304will also count towards the total.
4305
4306Used in reset NPC's (duh!)
4307
4308---------------------------------------
4309
4310*sc_start <effect type>,<ticks>,<extra argument>{,<rate>{,<flag>{,<GID>}}};
4311*sc_start2 <effect type>,<ticks>,<extra argument>,<percent chance>{,<flag>{,<GID>}};
4312*sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>{,<flag>{,<GID>}}};
4313*sc_end <effect type>{,<target ID number>};
4314
4315 !!禁止用在裝備中,可以用在OnEquip OnUnequip欄裡。
4316These command bestow a status effect on the invoking character. This command is
4317used a lot in the item scripts.
4318
4319 // This would poison them for 10 min
4320 sc_start SC_Poison,600000,0;
4321
4322Effect type is a number of effect, 'db/const.txt' lists the common (mostly
4323negative) status effect types as constants, starting with 'SC_'. You can also
4324use this to give someone an effect of a player-cast spell:
4325
4326 // This will bless someone as if with Bless 10:
4327 sc_start 10,240000,10;
4328
4329Extra argument's meaning differs depending on the effect type, for most effects
4330caused by a player skill the extra argument means the level of the skill that
4331would have been used to create that effect, for others it might have no meaning
4332whatsoever. You can actually bless someone with a 0 bless spell level this way,
4333which is fun, but weird.
4334
4335The target ID number, if given, will cause the status effect to appear on a
4336specified character, instead of the one attached to the running script. This has
4337not been properly tested.
4338
4339'sc_start2' is perfectly equivalent, but unlike 'sc_start', a status change
4340effect will only occur with a specified percentage chance. 10000 given as the
4341chance is equivalent to a 100% chance, 0 is a zero.
4342
4343'sc_start4' is just like sc_start, however it takes four parameters for the
4344status change instead of one. What these values are depends on the status
4345change in question. For example, elemental armor defense takes the following
4346four values:
4347- val1 is the first element, val2 is the resistance to the element val1.
4348- val3 is the second element, val4 is the resistance to said element.
4349eg: sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
4350
4351'sc_end' will remove a specified status effect. If SC_All is used (-1), it will
4352do a complete removal of all statuses (although permanent ones will re-apply).
4353
4354You can see the full list of status effects caused by skills in
4355'src/map/status.h' - they are currently not fully documented, but most of that
4356should be rather obvious.
4357
4358---------------------------------------
4359
4360*skilleffect <skill id>,<number>;
4361*skilleffect "<skill name>",<number>;
4362
4363This command will display the visual and sound effects of a specified skill (see
4364'db/skill_db.txt' for a full list of skills) on the invoking character's sprite.
4365Nothing but the special effects and animation will happen. If the skill's normal
4366effect displays a floating number, the number given will float up.
4367
4368 // This will heal the character with 2000 hp, buff with
4369 // Bless 10 and Increase AGI 5, and display appropriate
4370 // effects.
4371 mes "Blessed be!";
4372 skilleffect 28,2000;
4373 heal 2000,0;
4374 skilleffect 34,0;
4375 // That's bless 10.
4376 sc_start 10,240000,10;
4377 skilleffect 29,0;
4378 // That's agi 5
4379 sc_start 12,140000,5;
4380
4381---------------------------------------
4382
4383*npcskilleffect <skill id>,<number>,<x>,<y>;
4384*npcskilleffect "<skill name>",<number>,<x>,<y>;
4385
4386This command behaves identically to 'skilleffect', however, the effect will not
4387be centered on the invoking character's sprite, nor on the NPC sprite, if any,
4388but will be centered at map coordinates given on the same map as the invoking
4389character.
4390
4391---------------------------------------
4392
4393*specialeffect <效果編號>{,<發送目標>{,"<NPC名>"}};
4394
4395該指令會在指定NPC的坐標上顯示指定編號的特殊效果。
4396編號列表請看'doc/effect_list.txt'。
4397有些效果編號在有些版本的客戶端裡無效。(可以看到,下雨效果從2005年4月後的客戶端都沒有)
4398
4399指定<NPC名> 會在其他NPC上顯示 <效果編號>。如果指定NPC不存在,支持不會有任何效果。
4400如果指定了NPC,<發送目標>也必須同時使用。對<發送目標>使用AREA值會保留默認效果。
4401
4402 // this will make the NPC "John Doe#1"
4403 // show the effect "EF_HIT1" specified by
4404 // Jane Doe. I wonder what John did...
4405 mes "[Jane Doe]";
4406 mes "Well, I never!";
4407 specialeffect EF_HIT1,AREA,"John Doe#1";
4408 close;
4409
4410---------------------------------------
4411
4412*specialeffect2 <效果編號>{,<發送目標>{,"<玩家名>"}};
4413*specialeffect2 <效果編號>{,<發送目標>{,<AID/GID>}};
4414
4415效果類似specialeffect,只是效果會顯示在腳本關聯對像頭上
4416
4417指定<玩家名>或<AID/GID>會在其他腳本關聯對像頭上顯示 <效果編號>。如果指定關聯對像不存在,
4418支持不會有任何效果。如果指定了關聯對象,<發送目標>也必須同時使用。
4419對<發送目標>使用AREA值會保留默認效果。
4420
4421---------------------------------------
4422
4423*misceffect <效果編號>;
4424
4425如果運行該命令的NPC有顯示,則效果會顯示在該NPC頭上. 否則則會顯示在關聯玩家身上.
4426如果是道具腳本則會顯示在玩家頭上。
4427
4428詳細效果見 'doc/effect_list.txt'.
4429
4430---------------------------------------
4431
4432*misceffect2 <效果編號>;
4433
4434如果運行該命令的NPC有顯示,則效果會顯示在該NPC頭上. 否則則會顯示在關聯玩家身上.
4435如果是道具腳本則會顯示在玩家頭上。
4436
4437詳細效果為0x19b的效果而非 'doc/effect_list.txt'裡的效果.
4438
4439---------------------------------------
4440
4441*statusup <stat>;
4442
4443This command will bump a specified stat of the invoking character up by one
4444permanently. Stats are to be given as number, but you can use these constants to
4445replace them:
4446
4447bStr - Strength
4448bVit - Vitality
4449bInt - Intelligence
4450bAgi - Agility
4451bDex - Dexterity
4452bLuk - Luck
4453
4454---------------------------------------
4455
4456*statusup2 <stat>,<amount>;
4457
4458This command will bump a specified stat of the invoking character up by the
4459specified amount permanently. The amount can be negative. See 'statusup'.
4460
4461 // This will decrease a character's Vit forever.
4462 statusup bVit,-1;
4463
4464---------------------------------------
4465
4466*bonus <bonus type>,<val1>;
4467*bonus2 <bonus type>,<val1>,<val2>;
4468*bonus3 <bonus type>,<val1>,<val2>,<val3>;
4469*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
4470*bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
4471
4472These commands are meant to be used in item scripts. They will probably work
4473outside item scripts, but the bonus will not persist for long. They, as
4474expected, refer only to an invoking character.
4475
4476You can find the full list of possible bonuses and which command to use for each
4477kind in 'doc/item_bonus.txt'.
4478
4479---------------------------------------
4480
4481*autobonus "<獎勵腳本>",<rate>,<duration>{,<flag>,{"<激活腳本>"}};
4482*autobonus2 "<獎勵腳本>",<rate>,<duration>{,<flag>,{"<激活腳本>"}};
4483*autobonus3 "<獎勵腳本>",<rate>,<duration>,<skill id>,{"<激活腳本>"};
4484*autobonus3 "<獎勵腳本>",<rate>,<duration>,"<skill name>",{"<激活腳本>"};
4485
4486這些指令是設計成在道具腳本中使用的,在其他腳本中部分指令可能有效。
4487
4488What these commands do is 'attach' a script to the player which will get
4489executed on attack (or when attacked in the case of autobonus2).
4490
4491Rate是觸發幾率(1000 = 100%).
4492
4493Duration 是獎勵腳本的持續時間
4494
4495The optional argument 'flag' is used to classify the type of attack where the script
4496can trigger (it shares the same flags as the bAutoSpell bonus script):
4497
4498Range criteria:
4499 BF_SHORT: Trigger on melee attack
4500 BF_LONG: Trigger on ranged attack
4501 Default: BF_SHORT+BF_LONG
4502Attack type criteria:
4503 BF_WEAPON: Trigger on weapon skills
4504 BF_MAGIC: Trigger on magic skills
4505 BF_MISC: Trigger on misc skills
4506 Default: BF_WEAPON
4507Skill criteria:
4508 BF_NORMAL: Trigger on normal attacks
4509 BF_SKILL: Trigger on skills
4510 default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
4511 otherwise BF_SKILL+BF_NORMAL is used.
4512
4513獎勵腳本和激活腳本的區別是,激活腳本只在首次激活時觸發,而腳本腳本在
4514每次重新計算狀態時都會觸發,以保證獎勵持續。腳本腳本一般只接受bonus指令。
4515一般激活腳本只用來顯示視覺效果。
4516
4517In all cases, when the script triggers, the attached player will be the one
4518who holds the bonus. There is currently no way of knowing within this script
4519who was the other character (the attacker in autobonus2, or the target in
4520autobonus and autobonus3).
4521
4522//Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
4523//using weapon or misc attacks (both melee and ranged skills) and shows a special
4524//effect when the bonus is active.
4525 autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
4526
4527一個道具可以擁有多個autobonus,每個autobonus都有幾率激活,但每個道具id同時只能激活一個。
4528卡片、附魔等擁有相同來源道具id的autobonus在裝備中觸發幾率疊加,其他不變,其裝備位置只計為EQI較小的那個。
4529
4530---------------------------------------
4531
4532*itembonus <持續時間>,狀態編號(或{<腳本>}){,<組>{,<圖標>{,<值>}}}
4533
4534 !!禁止用在裝備中,可以用在OnEquip OnUnequip欄裡。
4535作用類似於autobonus,但僅適用於消耗類道具。
45362個itembonus擁有相同組時,先使用者會被覆蓋。
4537
4538---------------------------------------
4539
4540*skill <技能ID>,<等級>{,<標記>};
4541*skill "<技能名>",<等級>{,<標記>};
4542*addtoskill <技能ID>,<等級>{,<標記>};
4543*addtoskill "<技能名>",<等級>{,<標記>};
4544
4545這些指令可以給予角色指定技能。
4546
4547標記0: 永久獲得的技能。
4548 此技能必須不在skill_tree裡定義,否則重登後不會顯示。
4549 此方法獲得技能與正常升級得到的技能一致,重置時會給與技能點數。
4550標記3: 永久獲得的獎勵技能。
4551 此技能可以不在skill_tree裡定義。
4552 該方法獲得的技能不會被重置,也不會獲得技能點數。
4553標記1: 臨時獲得技能。
4554 一般用在道具上,在道具以外使用時,需要穿戴一次任意道具後才能顯示。
4555 如果已經有該技能,則只有當此技能不是複製或標記3獲得的技能,且等級小於該指令指定等級時才有效。
4556 該方法獲得的技能不會被重置,也不會獲得技能點數。
4557標記2: 在當前技能等級上,臨時獲得額外的等級。
4558 一般用在道具上,在道具以外使用時,需要穿戴一次任意道具後才能顯示。
4559 如果已經有該技能,則只有當此技能不是複製或標記3獲得的技能,且等級小於該指令指定等級時才有效。
4560 該方法獲得的技能不會被重置,也不會獲得技能點數。
4561
4562
4563標記是可選的,如果不設置,那skill指令默認1,而addtoskill默認2
4564
4565// This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
4566// level 1.
4567 skill 152,1,0;
4568
4569---------------------------------------
4570
4571*nude;
4572
4573This command will unequip anything equipped on the invoking character.
4574
4575It is not required to do this when changing jobs since 'jobchange' will unequip
4576everything not equippable by the new job class anyway.
4577
4578---------------------------------------
4579
4580*disguise <Monster ID>;
4581*undisguise;
4582
4583This command disguises the current player with a monster sprite.
4584The disguise lasts until 'undisguise' is issued or the player logs out.
4585
4586舉例:
4587
4588disquise 1002; //Yay! You're a Poring!!!
4589next;
4590undisguise; //Yay!!!! You're a human again!!
4591
4592---------------------------------------
4593
4594*montransform <魔物id>;
4595
4596This command disguises the current player with a monster sprite.
4597The disguise lasts until 'montransform 0' is issued or the player logs out.
4598
4599舉例:
4600
4601montransform 1002; //Yay! You're a Poring!!!
4602next;
4603montransform 0; //Yay!!!! You're a human again!!
4604
4605---------------------------------------
4606\\
46074,3 Marriage-related commands
4608\\
4609---------------------------------------
4610*marriage("<spouse name>");
4611
4612This function will marry two characters, the invoking character and the one
4613referred to by name given, together, setting them up as each other's marriage
4614partner. No second function call has to be issued (in current SVN at least) to
4615make sure the marriage works both ways. The function returns 1 upon success, or
46160 if the marriage could not be completed, either because the other character
4617wasn't found or because one of the two characters is already married.
4618
4619This will do nothing else for the marriage except setting up the spouse ID for
4620both of these characters. No rings will be given and no effects will be shown.
4621
4622---------------------------------------
4623
4624*wedding;
4625
4626This command will call up wedding effects - the music and confetti - centered on
4627the invoking character. Example can be found in the wedding script.
4628
4629---------------------------------------
4630
4631*divorce()
4632
4633This function will un-marry the invoking character from whoever they were
4634married to. Both will no longer be each other's marriage partner, (at least in
4635current SVN, which prevents the cases of multi-spouse problems). It will return
46361 upon success or 0 if the character was not married at all.
4637
4638This function will also destroy both wedding rings and send a message to both
4639players, telling them they are now divorced.
4640
4641---------------------------------------
4642
4643*adopt "<parent name>","<parent name>","<novice name>";
4644*adopt("<parent name>","<parent name>","<novice name>")
4645
4646This command will set up a novice as a baby of a married couple. All three are
4647referred to by character name. The correct variables are set on all three
4648characters in the same call. The command will unequip anything the novice has
4649equipped and make them a Job_Baby class, as well as send them a 'your job has
4650been changed' message.
4651
4652Beware of calling this from inside a 'callfunc' function, cause upon successful
4653adoption, this command returns a zero, as if it were a function. This is likely
4654to screw up execution of a 'return' command. You may try to call it as a
4655function instead, but it doesn't return anything upon an error, which may also
4656cause script execution to throw up errors.
4657
4658Nothing will happen (and nothing will be returned either) if either future
4659parent is below base level 70 and/or if any of the three characters is not found
4660online.
4661
4662---------------------------------------
4663//
46644,3.- End of marriage-related commands
4665//
4666---------------------------------------
4667
4668*pcfollow <id>,<target id>;
4669*pcstopfollow <id>;
4670
4671Makes a character follow or stop following someone. This command does the same as the @follow command.
4672The main difference is that @follow can use character names, and this commands needs the Account ID for the target.
4673
4674Example(s):
4675
4676//This will make Aaron follow Bullah, when both of these characters are online.
4677 PCFollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
4678
4679//Makes Aaron stop following whoever he is following.
4680 PCStopFollow getCharID(3,"Aaron");
4681
4682---------------------------------------
4683
4684* pcblockmove <id>,<option>;
4685
4686Prevents the given ID from moving when the option != 0, 0 enables the ID to move again.
4687ID should be able to be AID from a character.
4688
4689Example(s):
4690
4691//prevents the current char from moving away;
4692 pcblockmove getcharid(3),1;
4693
4694//enables the current char to move again.
4695 pcblockmove getcharid(3),0;
4696
4697---------------------------------------
4698
4699* pcblockskill <id>,<option>;
4700
4701Prevents the given ID from using skill when the option != 0, 0 enables the ID to use again.
4702ID should be able to be AID from a character.
4703
4704---------------------------------------
4705
4706==================================
4707|5.- Mob / NPC -related commands.|
4708==================================
4709---------------------------------------
4710
4711*monster "<地圖名>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"};
4712*areamonster "<地圖名>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>"};
4713
4714This command will spawn a monster on the specified coordinates on the specified
4715map. If the script is invoked by a character, a special map name, "this", will
4716be recognised to mean the name of the map the invoking character is located at.
4717This command works fine in the item scripts.
4718
4719The same command arguments mean the same things as described above in the
4720beginning of this document when talking about permanent monster spawns. Monsters
4721spawned in this manner will not respawn upon being killed.
4722
4723Unlike the permanent monster spawns, if the mob id is -1, a random monster will
4724be picked from the entire database according to the rules configured in the
4725server for dead branches. This will work for all other kinds of non-permanent
4726monster spawns.
4727
4728The only very special thing about this command is an event label, which is an
4729optional parameter. This label is written like '<NPC object name>::<label name>'
4730and upon the monster being killed, it will execute the script inside of the
4731specified NPC object starting from the label given. The RID of the player
4732attached at this execution will be the RID of the killing character.
4733
4734 monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
4735
4736The coordinates of 0,0 will spawn the monster on a random place on the map.
4737
4738The 'areamonster' command works much like the 'monster' command and is not
4739significantly different, but spawns the monsters within a square defined by
4740x1/y1-x2/y2.
4741
4742Simple monster killing script:
4743
4744 <Normal NPC object definition. Let's assume you called him NPCNAME.>
4745 mes "[Summon Man]";
4746 mes "Want to start the kill?";
4747 next;
4748 menu "Yes",L_Yes,"No",-;
4749 mes "[Summon Man]";
4750 mes "Come back later";
4751 close;
4752 L_Yes:
4753 monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
4754 // By using 0,0 it will spawn them in a random place.
4755 mes "[Summon Man]";
4756 mes "Now go and kill all the Poring I summoned";
4757 // He summoned ten.
4758 close;
4759 OnPoringKilled:
4760 set $PoringKilled,$PoringKilled+1;
4761 if ($PoringKilled==10) goto L_AllDead;
4762 end;
4763 L_AllDead:
4764 announce "Summon Man: Well done all the poring are dead",3;
4765 set $PoringKilled,0;
4766 end;
4767
4768For more good examples see just about any official 2-1 or 2-2 job quest script.
4769
4770---------------------------------------
4771
4772*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
4773*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
4774
4775This command will make all monsters of the specified mob ID in the specified
4776area use the specified skill. Map name, x, and y define the center of the area,
4777which extending <range> cells in each direction (ex: a range of 3 would create
4778a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
4779milliseconds (1000 = 1 second), and the rest should be self-explanatory.
4780
4781<target type> can be:
4782 0 = self
4783 1 = the mob's current target
4784 2 = the mob's master
4785 3 = random target
4786
4787Example:
4788
4789 // spawn 1 Shining Plant in the 5x5 area centered on (155,188)
4790 areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
4791 // make the plant cast level 10 Cold Bolt on a random target
4792 areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,e_gg,3;
4793
4794---------------------------------------
4795
4796* killmonster "<地圖>","<事件>"{,<標籤>};
4797* killmonsterall "<地圖>"{,<標籤>};
4798* areakillmonster "<地圖>",<x0>,<y0>,<x1>,<y1>,"<事件>"{,<標籤>};
4799* areakillmonsterall "<地圖>",<x0>,<y0>,<x1>,<y1>{,<標籤>};
4800 killmonsterall <mapname>,8;為殺死所有魔物,掉落經驗和物品。
4801 killmonsterall <mapname>,4;為殺死所有魔物,但不殺死WoE魔物。
4802 killmonsterall <mapname>,2;為殺死所有魔物,但不殺死玩家召喚魔物。
4803 killmonsterall <mapname>,1;為殺死所有魔物,觸發魔物死亡事件。
4804 killmonsterall <mapname>;為殺死所有魔物。
4805 killmonster <mapname>,<eventlabel>;為殺死會觸發<eventlabel>事件的魔物,且不觸發該事件。
4806 killmonster <mapname>,<eventlabel>,1;為殺死會觸發<eventlabel>事件的魔物,並觸發該事件。
4807 killmonster <mapname>,<eventlabel>,2;為殺死會觸發<eventlabel>事件的魔物,但不殺死玩家召喚魔物,但不觸發該事件。
4808 killmonster <mapname>,<eventlabel>,3;為殺死會觸發<eventlabel>事件的魔物,但不殺死玩家召喚魔物,並觸發該事件。
4809 killmonster <mapname>,"All";為殺死所有不會重生魔物,並不觸發任何事件。
4810 killmonster <mapname>,"All",1;為殺死所有不會重生魔物,並觸發死亡事件。
4811 killmonster <mapname>,"All",2;為殺死所有不會重生魔物,但不殺死玩家召喚魔物,並不觸發任何事件。
4812 killmonster <mapname>,"All",3;為殺死所有不會重生魔物,但不殺死玩家召喚魔物,且觸發死亡事件。
4813
4814---------------------------------------
4815
4816*strmobinfo(<類型>,<monster id>);
4817
4818This function will return information about a monster record in the database, as
4819per 'db/mob_db.txt'. Type is the kind of information returned. Valid types are:
4820
4821 1 - 'english name' field in the database, a string.
4822 2 - 'japanese name' field in the database, a string.
4823 All other returned values are numbers:
4824 3 - Level.
4825 4 - Maximum HP.
4826 5 - Maximum SP.
4827 6 - Experience reward.
4828 7 - Job experience reward.
4829
4830---------------------------------------
4831
4832*mobcount("<地圖名>","<event label>")
4833*areamobcount("<地圖名>",<x0>,<y0>,<x1>,<y1>,"<event label>")
4834
4835This function will count all the monsters on the specified map that have a given
4836event label and return the number or 0 if it can't find any. Naturally, only
4837monsters spawned with 'monster' and 'areamonster' script commands can be like
4838this.
4839
4840However, apparently, if you pass this function an empty string for the event
4841label, it should return the total count of normal permanently respawning
4842monsters instead. With the current dynamic mobs system, where mobs are not kept
4843in memory for maps with no actual people playing on them, this will return a 0
4844for any such map.
4845
4846---------------------------------------
4847
4848*clone "<地圖名>",<x>,<y>,"<event>",<角色ID>{,<master_id>{,<mode>{,<標記>,<duration>}}}
4849
4850This command creates a monster which is a copy of another player. The first
4851four arguments serve the same purpose as in the monster script command, The
4852<角色ID> is the character id of the player to clone (player must be online).
4853If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
4854must be a character id of another online player.
4855
4856The mode can be specified to determine the behaviour of the clone, it's
4857values are the same as the ones used for the mode field in the mob_db. The
4858default mode is aggressive, assists, can move, can attack.
4859
4860Flag can be either zero or one currently. If zero, the clone is a normal
4861monster that'll target players, if one, it is considered a summoned monster,
4862and as such, it'll target other monsters. Defaults to zero.
4863
4864The duration specifies how long the clone will live before it is auto-removed.
4865Specified in seconds, defaults to no limit (zero).
4866
4867Returned value is the monster ID of the spawned clone. If command fails,
4868returned value is zero.
4869
4870---------------------------------------
4871
4872*summon "Monster name",<monster id>{,<Time Out>{,"event label"}};
4873
4874This command will summon a monster. (see also 'monster') Unlike monsters spawned
4875with other commands, this one will set up the monster to fight to protect the
4876invoking character. Monster name and mob id obey the same rules as the one given
4877at the beginning of this document for permanent monster spawns with the
4878exceptions mentioned when describing 'monster' command.
4879
4880The effect for the skill 'Call Homonuculus' will be displayed centered on the
4881invoking character.
4882
4883Timeout is the time in milliseconds the summon lives, and is set default
4884to 60000 (1 minute). Note that also the value 0 will set the timer to default,
4885and it is not possible to create a spawn that lastst forever.
4886If an event label is given, upon the monster being killed, the event label will
4887run as if by 'donpcevent'.
4888
4889// Will summon a dead branch-style monster to fight for the character.
4890summon "--ja--",-1;
4891
4892---------------------------------------
4893
4894*homevolution;
4895
4896This command will try to evolve the current player's homunculus.
4897If it doesn't work, the /swt emoticon is shown.
4898
4899To evolve a homunculus, the invoking player must have a homunculus,
4900the homunculus must not be the last evolution and
4901the homunculus must be on at least 91000/100000 intimacy with it's owner.
4902
4903---------------------------------------
4904------------------------------------------------
4905//===========================================\\
4906|| Mob Control Suit Commands ||
4907\\===========================================//
4908------------------------------------------------
4909
4910---------------------------------------
4911
4912* mobspawn (<monster name>,<monster ID>,<mapname>,<x>,<y>)
4913* mobRemove <GID>;
4914
4915This is used to spawn a monster and return it's Game ID, to be used
4916in the unit/mobcontrol commands.
4917
4918Note, I will use the stuff here in the examples for the unitcontrol.
4919
4920Example(s):
4921
4922//Spawns a poring named poi poi and put's it's GID in .GID.
4923 set .GID,mobspawn("Poi Poi",1002,"prontera",160,180);
4924//would kill our poring.
4925 mobRemove .GID;
4926
4927---------------------------------------
4928
4929* getmobdata(<GID>,<arrayname>)
4930* setmobdata <GID>,<parameter>,<new value>;
4931* getunitdata(<GID>,<arrayname>)
4932* setunitdata <GID>,<parameter>,<new value>;
4933
4934This is used to get and set special data related to the monster.
4935With getmobdata, the array given will be filled with the current data. In setmobdata
4936the indexes in the array would be used to set that data on the monster.
4937Parameters (indexes) are: (getmobdata不支持48)(setmobdata不支持52-54、58)
4938
49390 = 魔物ID 7 = y 14 = 髮型 21 = 武器
49401 = 等級 8 = 移動速度 15 = 髮色 22 = 攻擊速度
49412 = HP 9 = mode (see doc/mob_db_mode_list.txt) 16 = 頭下 23 = 面朝方向
49423 = max HP 10 = special AI state 17 = 頭中 24 = killer state (1 or 0)
49434 = 主人 ID (aid of the master, summon) 11 = SC option 18 = 頭上 25 = callback flag
49445 = 地圖編號 12 = 性別 19 = 衣服顏色 26 = 禁止隨機移動 (1 or 0)
49456 = x 13 = 外觀ID (魔物 ID, Job ID) 20 = 盾
4946
494727 = 陣營 28 = 目的坐標x 29 = 目的坐標y 30 = 射程
494831 = atk1 32 = atk2 33 = amotion 34 = adelay
494935 = dmotion 36 = def 37 = mdef
495038 = str 39 = agi 40 = vit
495141 = int 42 = dex 43 = luk 44 = 體型
495245 = 種族 46 = 屬性 47 = 屬性等級 48 = 顯示名 (字符串)
495349 = 受到傷害增加比率(百分率,可為負數)
495451 = 無視(&1經驗,&2掉落)等級懲罰 52 = DB中的CLASS 53 = DB中的Attribute 54 = 剩餘重生延遲(毫秒)
495555 = MATK_MIN 56 = MATK_MAX 57 = 最小傷害 58 = DB中的Group
495659 = CLASS 60 = Attribute 61 = Group
4957
4958Example(s):
4959
4960//this will set all the mobdata in the @array variable. (@array[1] being level, @array[13] class etc)
4961 getmobdata .GID,@array;
4962
4963//set the max hp of our poring to 1000.
4964 setmobdata .GID,3,1000;
4965
4966getmobdata()指令返回值為0時,說明該魔物已經死亡。
4967
4968---------------------------------------
4969
4970* mobassist <GID>,<target id>;
4971This will make the monster assist the Target ID as if it was a summon of it.
4972Example(s):
4973
4974/this will make our poring assist the current attached player! >:3
4975 mobassist .GID,getcharid(3);
4976
4977---------------------------------------
4978
4979* mobattach <GID>{,"<NPC Name>"};
4980
4981GID is the GID of a monster, NPC or account id. The NPC running or
4982he NPC name given is used to attach the monster.
4983
4984By attaching a monster, the NPC to which it is attached is ran on special actions by the monster.
4985The system will set specific data in the .ai_action variable array on the NPC invoked.
4986The special AI actions types are set in the .ai_action at place AI_ACTION_TAR_TYPE
4987
4988More AI_ vars are set in const.txt, and you can also look at sample/monstercontroller.cpp:
4989
4990---------------------------------------
4991
4992* unitwalk <GID>,<x>,<y>{,<flag>};
4993* unitwalk <GID>,<mapid>;
4994* unitwalk "名字",<x>,<y>{,<flag>};
4995* unitwalk "名字",<mapid>;
4996
4997This is one command, but can be used in two ways. If only the first argument is given,
4998the unit whose GID is given will start walking towards the map with the given mapid
4999(we believe these are the mapindexes found in db/map_index.txt).
5000
5001flag值若存在只能為2,即強制走動。魔物或者玩家在不能行走的狀態下,例如暈眩、pcblockmove等狀態,可以使用該命令行走。
5002GID為魔物GID,或者玩家AID。
5003該命令主要用於遊戲腳本,即玩家不能控制走動,而系統可以控制其行走。
5004
5005When 2 arguments are passed, the given unit will walk to the given x,y coordinates on
5006the map where the unit currently is.
5007
5008Example(s):
5009
5010//Will move/walk the poring we made to the coordinates 150,150
5011 unitwalk .GID,150,150;
5012
5013//Will move the poring towards alberta (if my assumed mapindexes are correct).
5014 unitwalk .GID,3;
5015
5016名字只支持NPC和玩家,因為只有他們的名字是獨立的
5017
5018---------------------------------------
5019
5020* unitkill <GID>;
5021* unitwarp <GID>,<Mapname>,<x>,<y>;
5022* unitattack <GID>,<Target ID>;
5023* unitstop <GID>;
5024* unittalk <GID>,"<Text>"{,"<名字>"};
5025* unitemote <GID>,<Emote>;
5026* unitkill "名字";
5027* unitwarp "名字",<Mapname>,<x>,<y>;
5028* unitattack "名字",<Target ID>;
5029* unitstop "名字";
5030* unittalk "名字","<Text>"{,"<名字>"};
5031* unitemote "名字",<Emote>;
5032
5033Okay, these commands should be fairly self explaining.
5034For the emotions, you can look in db/const.txt for prefixes with e_
5035
5036GID為0表示腳本關聯的對象。
5037
5038名字只支持NPC和玩家,因為只有他們的名字是獨立的
5039
5040---------------------------------------
5041
5042*unitexists <GID>;
5043*unitexists "名字";
5044
5045Checks if the given Game ID exists. Returns 0 if the object doesn't exist, or 1 if
5046it does.
5047
5048名字只支持NPC和玩家,因為只有他們的名字是獨立的
5049
5050---------------------------------------
5051
5052*getunittype <GID>;
5053*unitexists "名字";
5054
5055Returns the type of object from the given Game ID.
5056
5057 UNITTYPE_UNKNOWN -1
5058 UNITTYPE_PC 0
5059 UNITTYPE_NPC 1
5060 UNITTYPE_PET 2
5061 UNITTYPE_MOB 3
5062 UNITTYPE_HOM 4
5063 UNITTYPE_MER 5
5064 UNITTYPE_ELEM 6
5065
5066名字只支持NPC和玩家,因為只有他們的名字是獨立的
5067
5068---------------------------------------
5069
5070*getunitname <GID>;
5071
5072Gets the name of the given unit. Supported types are monster, homunculus, pet, and NPC.
5073Mercenary and Elemental don't support custom names.
5074
5075Returns "未知"(msg_athena.conf:786) if unit is not found.
5076
5077---------------------------------------
5078
5079*setunitname <GID>,"<new name>";
5080
5081Changes the name of the given unit to the new name given. Supported types are monster,
5082homunculus, and pet. To change an NPC's name, see 'setnpcdata'. Mercenary and
5083Elemental don't support custom names.
5084
5085Changing a homunculus or pet name will be permanent.
5086
5087Returns "未知"(msg_athena.conf:786) if unit is not found.
5088
5089---------------------------------------
5090
5091------------------------------------------------
5092//===========================================\\
5093|| End of Mob Control Suit Commands ||
5094\\===========================================//
5095------------------------------------------------
5096---------------------------------------
5097
5098*npc_enable "NPC名",<參數>{,<對像ID>};
5099
5100啟用/禁用NPC。
5101參數:
5102 0x001 = 不顯示,不被探隱形
5103 0x002 = 取消0x1
5104 0x004 = 不顯示,隱匿動畫,可被探隱形
5105 0x008 = 取消0x4
5106 0x010 = 禁用,點擊無效,不觸發OnTouch,不觸發事件
5107 0x020 = 取消0x10
5108 0x040 = 禁用,點擊無效,不觸發OnTouch
5109 0x080 = 取消0x40
5110 0x100 = 不顯示,偽裝動畫,可被探隱形
5111 0x200 = 取消0x100
5112
5113對像ID為玩家AID,且只對0x105/0x20A有效,即只能對指定對像執行(或解除)隱匿、偽裝或隱身效果。
5114對像NPC為傳送點形象或旗幟時,效果為消失和顯現。顯現時將執行OnPlayerInSight標籤。
5115
5116---------------------------------------
5117
5118* npc_disabled("NPC名");
5119
5120返回
5121&1:禁用點擊和OnTouch,不觸發事件,
5122&2: GM隱身效果,
5123&4: 隱匿效果,
5124&8:禁用點擊和OnTouch,
5125&16: 偽裝效果
5126
5127---------------------------------------
5128
5129*disablenpc "<NPC object name>";
5130*enablenpc "<NPC object name>";
5131*hidedisablenpc "<NPC object name>";
5132*revealenablenpc "<NPC object name>";
5133
5134These two commands will disable and enable, respectively, an NPC object
5135specified by name. The disabled NPC will disappear from sight and will no longer
5136be triggerable in the normal way. It is not clear whether it will still be
5137accessible through 'donpcevent' and other triggering commands, but it probably
5138will be. You can disable even warp NPCs if you know their object names, which is
5139an easy way to make a map only accessible through walking half the time. Then
5140you 'enablenpc' them back.
5141
5142You can also use these commands to create the illusion of an NPC switching
5143between several locations, which is often better than actually moving the NPC -
5144create one NPC object with a visible and a hidden part to their name, make a few
5145copies, and then disable all except one.
5146
5147hidedisablenpc和disablenpc一樣都不會觸發腳本,只是客戶端效果不同,hidedisablenpc有一個隱匿效果。
5148revealenablenpc是hidedisablenpc的反指令。
5149
5150---------------------------------------
5151
5152*hideonnpc "<NPC object name>";
5153*hideoffnpc "<NPC object name>";
5154
5155These commands will make the NPC object specified display as hidden/visible,
5156even though not actually disabled per se. 但是不會運行OnTouch。 Hidden as in thief Hide skill, but
5157unfortunately, not detectable by Ruwach or Sight.
5158
5159---------------------------------------
5160
5161*doevent "<NPC object name>::<event label>";
5162
5163This command will start a new execution thread in a specified NPC object at the
5164specified label. The execution of the script running this command will not stop.
5165No parameters may be passed with a doevent call.
5166
5167The script of the NPC object invoked in this manner will run as if it's been
5168invoked by the RID that was active in the script that issued a 'doevent'.
5169
5170 place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
5171 mes "This is what you will see when you click me";
5172 close;
5173 Label:
5174 mes "This is what you will see if the doevent is activated";
5175 close;
5176 }
5177
5178 ....
5179
5180 doevent "NPC::Label";
5181
5182---------------------------------------
5183
5184*donpcevent "{NPC NAME}::<event label>";
5185
5186This command is kinda confusing cause it performs in two completely different
5187ways.
5188
5189If the event label is phrased like "::<label name>", all NPC objects that have a
5190specified label in them will be invoked as if by a 'doevent', but no RID
5191whatsoever will be attached while they execute.
5192
5193Otherwise, if the label is given as "<NPC name>::<label name>", a label within
5194the NPC object that runs this command will be called, but as if it was running
5195inside another, specified NPC object. No RID will be attached to it in this case
5196either.
5197
5198This can be used for making another NPC react to an action that you have done
5199with the NPC that has this command in it, i.e. show an emotion, or say
5200something.
5201
5202 place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
5203 mes "Hey NPC2 copy what I do";
5204 close2;
5205 set @emo, rand(1,30);
5206 donpcevent "NPC2::Emo";
5207 Emo:
5208 emotion @emo;
5209 end;
5210 }
5211
5212 place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
5213 mes "Hey NPC copy what I do";
5214 close2;
5215 set @emo, rand(1,30);
5216 donpcevent "NPC::Emo";
5217 Emo:
5218 emotion @emo;
5219 end;
5220 }
5221
5222This will make both NPC perform the same random emotion from 1 to 30, and the
5223emotion will appear above each of their heads.
5224
5225---------------------------------------
5226
5227*cmdothernpc "<npc name>","<command>";
5228
5229This is simply "donpcevent <npc name>::OnCommand<command>".
5230It is an approximation of official server script language's 'cmdothernpc'.
5231
5232---------------------------------------
5233
5234*npcmessage "<message>"{,"<npc名>"{,<flag>}};
5235
5236NPC說話。
5237如果沒有指定NPC名或指定NPC不存在,則是關聯NPC說話。
5238否則,則是指定NPC說話。
5239說話內容不會包括"NPC名 : "。
5240flag接受以下標記:
5241bc_all, bc_map, bc_self, bc_area。
5242默認bc_area
5243
5244---------------------------------------
5245
5246*setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
5247*setnpcdisplay("<npc name>", "<display name>", <class id>)
5248*setnpcdisplay("<npc name>", "<display name>")
5249*setnpcdisplay("<npc name>", <class id>)
5250
5251Changes the display name and/or display class of the target npc.
5252Returns 0 is successful, 1 if the npc does not exist.
5253Size is 0 = norma 1 = small 2 = big.
5254
5255Since trunk r11779
5256
5257---------------------------------------
5258\\
52595,1.- Time-related commands
5260\\
5261---------------------------------------
5262*addtimer <ticks>,"<NPC object name>::<label>";
5263*deltimer "<NPC object name>::<event label>";
5264*addtimercount <ticks>,"<NPC object name>::<event label>";
5265
5266These commands will create and manage a player-based timer: 'addtimer' to
5267create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
5268number of ticks. For all three cases, the event label given is the identifier of
5269that timer. A player can have multiple timers running at the same time, and
5270there can even be multiple timers referencing the same label.
5271
5272When this timer runs out, a new execution thread will start in the specified NPC
5273object at the specified label, and the script will run attached to that player.
5274If the specified label is not found, the map server will happily print an error.
5275
5276The ticks are given in 1/1000ths of a second.
5277
5278One more thing. These timers are stored as part of player data. If the player
5279logs out, all of these get immediately deleted, without executing the script.
5280If this behavior is undesirable, use some other timer mechanism (like 'sleep').
5281
5282Example 1:
5283<NPC Header> {
5284 dispbottom "Starting a 5 second timer...";
5285 addtimer 5000, strnpcinfo(3)+"::On5secs";
5286 end;
5287On5secs:
5288 dispbottom "5 seconds have passed!";
5289 end;
5290}
5291
5292
5293---------------------------------------
5294
5295*initnpctimer{ "<NPC name>" {, <Attach Flag>} } |
5296 { "<NPC name>" | <Attach Flag> };
5297*stopnpctimer{ "<NPC name>" {, <Detach Flag>} } |
5298 { "<NPC name>" | <Detach Flag> };
5299*startnpctimer{ "<NPC name>" {, <Attach Flag>} } |
5300 { "<NPC name>" | <Attach Flag> };
5301*setnpctimer <tick>{,"<NPC name>"};
5302*getnpctimer(<type of information>{,"<NPC name>"});
5303*attachnpctimer {"<character name>"};
5304*detachnpctimer {"<NPC name>"};
5305
5306This set of commands and functions will create and manage an NPC-based timer.
5307The NPC name may be omitted, in which case the calling NPC is used as target.
5308
5309Contrary to addtimer/deltimer commands which let you have many different timers
5310referencing different labels in the same NPC, each with their own countdown,
5311'initnpctimer' can only have one per NPC object. But it can trigger many labels
5312and let you know how many were triggered already and how many still remain.
5313
5314This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
5315creating this timer, the execution will not stop, but will happily continue
5316onward. The timer will then invoke new execution threads at labels
5317"OnTimer<time>:" in the NPC object it is attached to.
5318
5319To create the timer, use the 'initnpctimer', which will start it running.
5320'stopnpctimer' will pause the timer, without clearing the current tick, while
5321'startnpctimer' will let the paused timer continue.
5322
5323By default timers do not have a RID attached, which lets them continue even
5324if the player that started them logs off. To attach a RID to a timer, you can
5325either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
5326or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
5327stopnpctimer lets you detach any RID after stopping the timer, and by using
5328'detachnpctimer' you can detach a RID at any time.
5329
5330Normally there is only a single timer per NPC, but as an exception, as long as
5331you attach a player to the timer, you can have multiple timers running at once,
5332because these will get stored on the players instead of the NPC.
5333NOTE: You need to attach the RID before the timer _before_ you start it to
5334get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
5335
5336If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
5337event label of that npc will be triggered, so you can do the appropiate
5338cleanup (the player is still attached when this event is triggered).
5339
5340The 'setnpctimer' command will explicitly set the timer to a given tick.
5341'getnpctimer' provides timer information. Its parameter defines what type:
5342
5343 0 - Will return the current tick count of the timer.
5344 1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
5345 specified NPC waiting for execution.
5346 2 - Will return the number of times the timer has triggered and will trigger
5347 an "OnTimer<tick>:" label in the specified NPC.
5348
5349Example 1:
5350
5351 <NPC Header> {
5352 initnpctimer;
5353 npctalk "I cant talk right now, give me 10 seconds";
5354 end;
5355 OnTimer5000:
5356 npctalk "Ok 5 seconds more";
5357 end;
5358 OnTimer6000:
5359 npctalk "4";
5360 end;
5361 OnTimer7000:
5362 npctalk "3";
5363 end;
5364 OnTimer8000:
5365 npctalk "2";
5366 end;
5367 OnTimer9000:
5368 npctalk "1";
5369 end;
5370 OnTimer10000:
5371 stopnpctimer;
5372 mes "[Man]";
5373 mes "Ok we can talk now";
5374 }
5375
5376Example 2:
5377
5378 OnTimer15000:
5379 npctalk "Another 15 seconds have passed.";
5380 setnpctimer 0;
5381 end;
5382
5383 // This OnInit label will run when the script is loaded, so that the timer
5384 // is initialised immediately as the server starts. It is dropped back to 0
5385 // every time the NPC says something, so it will cycle continiously.
5386 OnInit:
5387 initnpctimer;
5388 end;
5389
5390Example 3:
5391
5392 mes "[Man]";
5393 mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you";
5394 // we divide the timer returned by 1000 cause it will be displayed in
5395 // milliseconds otherwise
5396 close;
5397
5398Example 4:
5399
5400 mes "[Man]";
5401 mes "Ok I will let you have 30 sec more";
5402 close2;
5403 setnpctimer (getnpctimer(0)-30000);
5404 // Notice the 'close2'. If there were a 'next' there the timer would be
5405 // changed only after the player pressed the 'next' button.
5406 end;
5407
5408---------------------------------------
5409
5410*sleep {<milliseconds>};
5411*sleep2 {<milliseconds>};
5412*awake "<NPC name>";
5413
5414用來暫停腳本運行
5415sleep and sleep2 將暫停指定毫秒的時間
5416awake 用來取消 sleep. When 使用了awake 腳本將和時間過完一樣繼續運行
5417注意:awake會使該NPC下未到期的sleep/sleep2全部繼續循行,而不是只運行一個。
5418sleep 和 sleep2 功能一樣,但是主要區別是,sleep不會保持玩家關聯
5419而sleep2會在重新運行時重拾關聯。
5420
5421Examples:
5422 sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
5423 sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
5424 awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
5425
5426---------------------------------------
5427
5428*delaytime {<milliseconds>};
5429
5430用來暫停腳本運行
5431將暫停指定毫秒的時間
5432delaytime會使玩家保持腳本關聯。
5433該關聯方式等同於next, input, progressbar等方式
5434無法醒來。
5435
5436---------------------------------------
5437//
54385,1.- End of time-related commands
5439//
5440
5441*announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
5442
5443This command will broadcast a message to all or most players, similar to
5444@kami/@kamib GM commands.
5445
5446 announce "This will be shown to everyone at all in yellow.",0;
5447
5448The region the broadcast is heard in (target), source of the broadcast
5449and the color the message will come up as is determined by the flags.
5450
5451The flag values are coded as constants in db/const.txt to make them easier to use.
5452
5453Target flags:
5454- bc_all: Broadcast message is sent server-wide (default).
5455- bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
5456- bc_area: Message is sent to players in the vecinity of the source.
5457- bc_self: Message is sent only to current player.
5458You cannot use more than one target flag.
5459
5460Source flags:
5461- bc_pc: Broadcast source is the attached player (default).
5462- bc_npc: Broadcast source is the NPC, not the player attached to the script
5463 (useful when a player is not attached or the message should be sent to those
5464 nearby the npc).
5465You cannot use more than one source flag.
5466
5467特殊標識:
5468- bc_yellow: Broadcast will be displayed in yellow color (default).
5469- bc_blue: Broadcast will be displayed in blue color.
5470- bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
5471- bc_name: 公告會顯示關聯玩家或NPC的名字,並能直接添加到密聊。
5472此組標識支持顏色,但不支持字體。
5473Due to the way client handles broadcasts, 無法同時設置特殊標識中的任意2個.
5474
5475The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
5476If any of the optional parameters is used, special flag is ignored.
5477Optional parameters may not work well (or at all) depending on a game client used.
5478
5479The color parameter is a single number which can be in hexadecimal notation.
5480For example:
5481 announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
5482Will display a global announce in green. The color format is in RGB (0xRRGGBB).
5483
5484In official scripts only two font-weights (types) are used:
5485 - normal (FW_NORMAL = 400, default),
5486 - bold (FW_BOLD = 700).
5487
5488Default font size is 12.
5489
5490Using this for private messages to players is probably not that good an idea,
5491but it can be used instead in NPCs to "preview" an announce.
5492
5493 // This will be a private message to the player using the NPC that made the
5494 // announcement
5495 announce "This is my message just for you",bc_blue|bc_self;
5496
5497 // This will be shown on everyones screen that is in sight of the NPC.
5498 announce "This is my message just for you people here",bc_npc|bc_area;
5499
5500---------------------------------------
5501
5502*mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
5503
5504This command will work like 'announce' but will only broadcast to characters
5505currently residing on the specified map. The flag and optional paramaters
5506parameters are the same as in 'announce', but target and source flags are ignored.
5507
5508---------------------------------------
5509
5510*areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
5511
5512This command works like 'announce' but will only broadcast to characters
5513residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
5514optional parameters are the same as in 'announce', but target and source flags are ignored.
5515
5516 areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
5517
5518---------------------------------------
5519
5520*callshop "<name>",<option>;
5521
5522These are a series of commands used to create dynamic shops.
5523The callshop function calls a invisible shop (view -1) as if the player clicked on it.
5524
5525For the options on callShop:
5526 0 = The normal window (buy, sell and cancel)
5527 1 = The buy window
5528 2 = The sell window
5529
5530Example(s):
5531
5532callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.
5533
5534The shop which is called by callshop (as long as an npcshop* command is executed
5535from that NPC (see note 1)) will trigger the labels OnBuyItem and OnSellitem. These
5536labels can take over handling for relatively the buying of items from the shop
5537and selling the items to a shop. Via these labels you can customize the way an item
5538is bought or sold by a player.
5539
5540In the OnBuyItem, two arrays are set (@bought_nameid and @bough_quantity), which
5541hold information about the name id (item id) sold and the amount sold of it. Same
5542goes for the OnSellItem label, only the variables are named different
5543(@sold_nameid and @sold_quantity). An example on a shop comes with eAthena, and
5544can be found in the npc/sample/npc_dynamic_shop.txt file.
5545
5546This example shows how to use the labels and their set variables to create a dynamic shop.
5547
5548Note 1: These labels will only be triggered if a npcshop* command is executed, this is
5549because these commands set a special data on the shop npc,named master_nd in the source.
5550The OnSellItem and OnBuyItem are triggered in the NPC whose master_nd is given in the shop.
5551This was found out thanks to 'Hondacrx', noticing the OnBuyItem wasn't triggered unless
5552npcshopitem was used. After rechecking the source, I found what caused this.
5553
5554---------------------------------------
5555
5556*npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
5557
5558This command lets you override the contents of an existing npc shop. The
5559current sell list will be wiped, and only the items specified with the price
5560specified will be for sale.
5561
5562The function returns 1 if shop was updated successfully, or 0 if not found.
5563
5564Note that you cannot use -1 to specify default selling price!
5565
5566---------------------------------------
5567
5568*npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
5569*npcshopadditem "<name>",<item id>,<price>,<庫存>{,<item id>,<price>,<庫存>{,<item id>,<price>,<庫存>{,...}}}
5570
5571This command will add more items at the end of the selling list for the
5572specified npc shop. If you specify an item already for sell, that item will
5573appear twice on the sell list.
5574
5575The function returns 1 if shop was updated successfully, or 0 if not found.
5576
5577Note that you cannot use -1 to specify default selling price!
5578
5579---------------------------------------
5580
5581*npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}}
5582
5583This command will remove items from the specified npc shop.
5584If the item to remove exists more than once on the shop, all instances will be
5585removed.
5586
5587Note that the function returns 1 even if no items were removed. The return
5588value is only to confirm that the shop was indeed found.
5589
5590---------------------------------------
5591
5592*npcshopattach "<name>"{,<標記>}
5593
5594This command will attach the current script to the given npc shop.
5595When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
5596of your script will be executed whenever a player buys/sells from the shop.
5597Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
5598and @sold_quantity[] will be filled up with the items and quantities
5599bought/sold.
5600
5601The optional parameter specifies whether to attach ("1") or detach ("0") from
5602the shop (the default is to attach). Note that detaching will detach any npc
5603attached to the shop, even if it's from anOnActive Script, while attaching will
5604override any OnActive Script that may be already attached.
5605
5606The function returns 0 if the shop was not found, 1 otherwise.
5607
5608---------------------------------------
5609
5610*npcshopupdate "<NPC名>",<道具id>,<價格>{,<庫存>}
5611
5612更新NPC商店的出售信息
5613
5614---------------------------------------
5615
5616*waitingroom "<chatroom name>",<limit>{,<event label>,<trigger>,<required zeny>,<min lvl>,<max lvl>};
5617
5618This command will create a chat room, owned by the NPC object running this
5619script and displayed above the NPC sprite.
5620The maximum length of a chatroom name is 60 letters.
5621
5622The limit is the maximum number of people allowed to enter the chat room. If the
5623optional event and trigger parameters are given, the event label
5624("<NPC object name>::<label name>") will be invoked as if with a 'doevent' upon
5625the number of people in the chat room reaching the given triggering amount.
5626
5627// The NPC will just show a box above its head that says "Hello World", clicking
5628// it will do nothing, since the limit is zero.
5629 waitingroom "Hello World",0;
5630
5631// The NPC will have a box above its head, it will say "Disco - Waiting Room"
5632// and will have 8 waiting slots. Clicking this will enter the chat room, where
5633// the player will be able to wait until 8 people accumulate. Once this happens,
5634// it will cause the NPC "Bouncer" run the label "OnStart"
5635
5636 waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",8;
5637
5638// The NPC will have a box above its head, it will say "Party - Waiting Room"
5639// and will have 8 waiting slots. Clicking this will allow a player who has
5640// 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
5641// able to wait until 8 people accumulate. Once this happens, it will cause
5642// the NPC "Bouncer" run the label "OnStart"
5643
5644 waitingroom "Party - Waiting Room",5,"Bouncer::OnStart",8,5000,50,99;
5645
5646Creating a waiting room does not stop the execution of the script and it will
5647continue to the next line.
5648
5649For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
5650of waiting rooms.
5651
5652---------------------------------------
5653
5654*delwaitingroom {"<NPC object name"};
5655
5656This command will delete a waiting room. If no parameter is given, it will
5657delete a waiting room attached to the NPC object running this command, if it is,
5658it will delete a waiting room owned by another NPC object. This is the only way
5659to get rid of a waiting room, nothing else will cause it to disappear.
5660
5661It's not clear what happens to a waiting room if the NPC is disabled with
5662'disablenpc', by the way.
5663
5664---------------------------------------
5665
5666*enablewaitingroomevent {"<NPC object name>"};
5667*disablewaitingroomevent {"<NPC object name>"};
5668*enablearena;
5669*disablearena;
5670
5671This will enable and disable triggering the waiting room event (see
5672'waitingroom') respectively. Optionally giving an NPC object name will do that
5673for a specified NPC object. The chat room will not disappear when triggering is
5674disabled and enabled in this manner and players will not be kicked out of it.
5675Enabling a chat room event will also cause it to immediately check whether the
5676number of users in it exceeded the trigger amount and trigger the event
5677accordingly.
5678
5679Normally, whenever a waiting room was created to make sure that only one
5680character is, for example, trying to pass a job quest trial, and no other
5681characters are present in the room to mess up the script.
5682
5683The 'enablearena'/'disablearena' commands are just aliases with no parameter.
5684These are supposedly left here for compatibility with official server scripts,
5685but no eathena script uses these at the moment.
5686
5687---------------------------------------
5688
5689*getwaitingroomstate(<information type>{,"<NPC object name>"})
5690
5691This function will return information about the wating room state for the
5692attached waiting room or for a waiting room attached to the specified NPC if
5693any.
5694
5695The valid information types are:
5696
5697 0 - Number of users currently chatting.
5698 1 - Maximum number of users allowed.
5699 2 - Will return 1 if the waiting room has a trigger set.
5700 0 otherwise.
5701 3 - Will return 1 if the waiting room is currently disabled.
5702 0 otherwise.
5703 4 - The Title of the waiting room (string)
5704 5 - Password of the waiting room, if any. Pointless, since there is no way to
5705 set a password on a waiting room right now.
5706 16 - Event name of the waiting room (string)
5707 32 - Whether or not the waiting room is full.
5708 33 - Whether the amount of users in the waiting room is higher than the trigger
5709 number.
5710
5711---------------------------------------
5712
5713*getwaitingroommember "<NPC object name>"
5714
5715該指令返回一個包含聊天室成員AID的數組$@waitingroommemberaid[]和一個聊天室成員數
5716的變量$@waitingroommembercount
5717
5718---------------------------------------
5719
5720*warpwaitingpc "<地圖名>",<x>,<y>{,<number of people>};
5721
5722This command will warp the amount of characters equal to the trigger number of
5723the waiting room chat attached to the NPC object running this command to the
5724specified map and coordinates, kicking them out of the chat. Those waiting the
5725longest will get warped first. It can also do a random warp on the same map
5726("Random" instead of map name) and warp to the save point ("SavePoint").
5727
5728The list of characters to warp is taken from the list of the chat room members.
5729Those not in the chat room will not be considered even if they are talking to
5730the NPC in question. If the number of people is given, exactly this much people
5731will be warped.
5732
5733This command can also keep track of who just got warped. It does this by setting
5734special variables:
5735
5736$@warpwaitingpc[] is an array containing the character id numbers of the
5737 characters who were just warped.
5738$@warpwaitingpcnum contains the number of the character it just warped.
5739
5740See also 'getpartymember' for advice on what to do with those variables.
5741
5742The obvious way of using this effectively would be to set up a waiting room for
5743two characters to be warped onto a random PVP map for a one-on-one duel, for
5744example.
5745
5746---------------------------------------
5747
5748*kickwaitingroomall {"<NPC object name>"};
5749
5750This command would kick everybody out of a specified waiting room chat. IF it
5751was properly linked into the script interpreter which it isn't, even though the
5752code for it is in place. Expect this to become available in upcoming SVN
5753releases.
5754
5755---------------------------------------
5756
5757*kickwaitingroom {"<AID>"};
5758
5759該指令會把腳本關聯的玩家從聊天室中踢出(如果指定AID則是該指定玩家)。
5760踢出成功返回0。返回-1或1都是不成功。
5761
5762---------------------------------------
5763
5764*setmapflagnosave "<地圖名>","<alternate map name>",<x>,<y>;
5765
5766This command sets the 'nosave' flag for the specified map and also gives an
5767alternate respawn-upon-relogin point.
5768
5769It does not make a map impossible to make a savepoint on as you would normally
5770think, 'savepoint' will still work. It will, however, make the specified map
5771kick the reconnecting players off to the alternate map given to the coordinates
5772 specified.
5773
5774---------------------------------------
5775
5776*setmapflag "<地圖名>",<標記>;
5777
5778This command marks a specified map with a map flag given. Map flags alter the
5779behavior of the map, you can see the list of the available ones in
5780'db/const.txt' under 'mf_'.
5781
5782The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
5783mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
5784(mf_nosave), dead branch usage (mf_nobranch), penalties upon death
5785(mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
5786mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
5787skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
5788current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
5789mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
5790
5791---------------------------------------
5792
5793*removemapflag "<map name>",<flag>;
5794
5795This command removes a mapflag from a specified map.
5796See 'setmapflag' for a list of mapflags.
5797
5798---------------------------------------
5799
5800*getmapflag("<map name>",<flag>)
5801
5802This command checks the status of a given mapflag and returns the mapflag's state.
58030 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
5804
5805---------------------------------------
5806
5807*setbattleflag "<battle flag>",<value>{,<等級>};
5808*getbattleflag("<battle flag>")
5809
5810Sets or gets the value of the given battle flag.
5811Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script.
5812
5813Example(s):
5814
5815//will set the base experience rate to 20x (2000%)
5816 setBattleFlag "base_exp_rate",2000;
5817
5818//will return the value of the base experience rate (when used after the above example, it would return 2000).
5819 getBattleFlag "base_exp_rate";
5820
5821等級默認為0
5822
5823---------------------------------------
5824
5825*removemapflag "<地圖名>",<標記>;
5826
5827This command removes a mapflag from a specified map. See 'setmapflag'.
5828
5829---------------------------------------
5830
5831*warpportal <x>,<y>,"<mapname>",<x>,<y>;
5832
5833Creates a warp Portal as if a acolyte class character did it.
5834The first x and y is the place of the warp portal on the map where the NPC is on
5835The mapname and second x and y is the target area of the warp portal.
5836
5837Example(s):
5838
5839//Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
5840 warpPortal 150,150,"prontera",150,180;
5841
5842---------------------------------------
5843
5844*mapwarp "<from map>","<to map>",<x>,<y>;
5845
5846This command will collect all characters located on the From map and warp them
5847wholesale to the same point on the To map, or randomly distribute them there if
5848the coordinates are zero. "Random" is understood as a special To map name and
5849will mean randomly shuffling everyone on the same map.
5850
5851---------------------------------------
5852\\
58535,2.- Guild-related Commands
5854\\
5855---------------------------------------
5856
5857*maprespawnguildid "<地圖名>",<guild id>,<標記>;
5858
5859This command goes through the specified map and for each player and monster
5860found there does stuff.
5861
5862Flag is a bitmask (add up numbers to get effects you want)
5863 1 - warp all guild members to their savepoints.
5864 2 - warp all non-guild members to their savepoints.
5865 4 - remove all monsters which are not guardian or emperium.
5866
5867Flag 7 will, therefore, mean 'wipe all mobs but guardians and the emperium and
5868kick all characters out', which is what the official scripts do upon castle
5869surrender. Upon start of WoE, the scripts do 2 (warp all intruiders out).
5870
5871Characters not belonging to any guild will warp out regardless of the flag setting.
5872
5873For examples, check the WoE scripts in the distribution.
5874
5875---------------------------------------
5876
5877*agitstart;
5878*agitend;
5879*agitstart2;
5880*agitend2;
5881*agitstart3;
5882*agitend3;
5883
5884These two commands will start and end War of Emperium.
5885
5886This is a bit more complex than it sounds, since the commands themselves won't
5887actually do anything interesting, except causing all 'OnAgitStart:' and
5888'OnAgitEnd:' events to run everywhere, respectively. They are used as
5889simple triggers to run a lot of complex scripts all across the server, and they,
5890in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
5891
5892---------------------------------------
5893
5894*gvgon "<地圖名>";
5895*gvgoff "<地圖名>";
5896
5897These commands will turn GVG mode for the specified maps on and off, setting up
5898appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
5899even though WoE itself may or may not actually be in effect.
5900
5901---------------------------------------
5902
5903*flagemblem <guild id>;
5904
5905This command only works when run by the NPC objects which have sprite id 722,
5906which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
5907will be seen by anyone. If it is invoked in that manner, the emblem of the
5908specified guild will appear on the flag, though, if any players are watching it
5909at this moment, they will not see the emblem change until they move out of sight
5910of the flag and return.
5911
5912This is commonly used in official guildwar scripts with a function call which
5913returns a guild id:
5914
5915// This will change the emblem on the flag to that of the guild that owns
5916// "guildcastle"
5917
5918 flagemblem GetCastleData("guildcastle",1);
5919
5920---------------------------------------
5921
5922*guardian("<地圖名>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>"}{,<guardian index>})
5923
5924This command is roughly equivalent to 'monster', but is meant to be used with
5925castle guardian monsters and will only work with them. It will set the guardian
5926characteristics up according to the castle's investment values and otherwise
5927set the things up that only castle guardians need.
5928
5929Since trunk r12524:
5930Returns the id of the mob or 0 if an error occurred.
5931When 'guardian index' isn't supplied it produces a temporary guardian.
5932Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
5933
5934---------------------------------------
5935
5936*guardianinfo("<地圖名>", <guardian number>, <類型>)
5937
5938This function will return various info about the specified guardian, or -1
5939if it fails for some reason. It is primarily used in the castle manager npc.
5940
5941Map name and guardian number (value between 0 and 7) define the target.
5942Type indicates what information to return:
5943 0 - visibility (whether the guardian is installed or not)
5944 1 - max. hp
5945 2 - current hp
5946
5947---------------------------------------
5948//
59495,2.- End of guild-related commands
5950//
5951---------------------------------------
5952
5953*npcspeed <速度值>;
5954*npcwalkto <x>,<y>;
5955*npcstop;
5956
5957These commands will make the NPC object in question move around the map. As they
5958currently are, they are a bit buggy and are not useful for much more than making
5959an NPC move randomly around the map. (see 'npc/custom/devnpc.txt' for an example
5960of such usage)
5961
5962'npcspeed' will set the NPCs walking speed to a specified value. As in the
5963@speed GM command, 200 is the slowest possible speed while 0 is the fastest
5964possible (instant motion). 100 is the default character walking speed.
5965'npcwalkto' will start the NPC sprite moving towards the specified coordinates
5966on the same map as it is currently on.
5967'npcstop' will stop the motion.
5968
5969While in transit, the NPC will be clickable, but invoking it will cause it to
5970stop motion, which will make it's coordinates different from what the client
5971computed based on the speed and motion coordinates. The effect is rather
5972unnerving.
5973
5974Only a few NPC sprites have walking animations, and those that do, do not get
5975the animation invoked when moving the NPC, due to the problem in the npc walking
5976code, which looks a bit silly. You might have better success by defining a job-
5977sprite based sprite id in 'db/mob-avail.txt' with this.
5978
5979---------------------------------------
5980
5981*movenpc <NPC名>,x,y{,dir};
5982 作用:移動NPC到指定坐標(x,y)
5983 舉例:
5984 moveNPC "Bugga",100,20;
5985
5986---------------------------------------
5987
5988=====================
5989|6.- 其他命令. |
5990=====================
5991---------------------------------------
5992
5993*debugmes "<信息>";
5994
5995該命令會發送信息至服務器控制台 (地圖服務器窗口). 除此之外沒有地方會顯示.
5996
5997 debugmes strcharinfo(0)+" 做了xxx";
5998 // 你可以在地圖服務器窗口裡看到 "NAME 做了xxx"
5999
6000---------------------------------------
6001
6002*logmes "<信息>";
6003
6004該命令會把信息寫入地圖服務器的記錄文件(在'conf/log_athena.conf'設置的).
6005在TXT版本中, 默認記錄文件是 'log/npclog.log'.
6006在SQL版本中, 如果記錄功能打開, 信息會存入npclog表, 否則同TXT.
6007
6008如果記錄功能沒有打開, 則什麼都不會發生.
6009
6010---------------------------------------
6011
6012*rand(<數字>{,<數字>});
6013
6014如果你只指定了一個數,該命令會返回0 - 你指定數之間的一個隨機數.
6015如果你指定2個數,則返回你指定2個數之間的一個隨機數.
6016
6017rand(10) 的結果會是 0,1,2,3,4,5,6,7,8 or 9
6018
6019rand(2,10) 的結果會是 2,3,4,5,6,7,8,9 or 10
6020
6021---------------------------------------
6022
6023*mapviewpoint "地圖名",<動作>,<x>,<y>,<點數量>,<顏色>;
6024*viewpoint <動作>,<x>,<y>,<點數量>,<顏色>;
6025
6026該地圖會在連接的玩家的客戶端的小地圖上做標記。它是用地圖上的x、y坐標。
6027顏色有十六進制數字決定, 和mes命令用的一樣。
6028(看上去像 0x<6位數字>.)
6029
6030動作是你要對點進行的操作, 1是設置, 2是清除。多個點在同一坐標可以用來創建閃光點。
6031
6032 // 該命令會在坐標 X 30 Y 40 坐標記,
6033 // 並且是紅色的.
6034
6035 viewpoint 1,30,40,1,0xFF0000;
6036
6037這會創建3個點:
6038
6039 viewpoint 1,30,40,1,0xFF0000;
6040 viewpoint 1,35,45,2,0xFF0000;
6041 viewpoint 1,40,50,3,0xFF0000;
6042
6043這是如何清除他們:
6044
6045 viewpoint 2,30,40,1,0xFF0000;
6046 viewpoint 2,35,45,2,0xFF0000;
6047 viewpoint 2,40,50,3,0xFF0000;
6048
6049客戶端儲存所有信息,而服務器端不會。
6050
6051---------------------------------------
6052
6053*mapcutin "地圖名","<文件名>",<位置>;
6054*cutin "<文件名>",<位置>;
6055
6056該命令會顯示GRF文件中儲存的圖片。
6057
6058文件取自文件夾 '\data\texture\蠟歷牢磐其撈膠\illust' . 而且似乎卡片大圖 \cardbmp
6059也能正常工作。只有位圖能顯示。.bmp後綴不一定需要。
6060
6061客戶端對顯示4096x4096的圖片時沒有問題的,但通常情況下只顯示500x500. 顏色 FF00FF
6062當作透明色。
6063
6064位置表示在屏幕上顯示圖片的位置:
6065 0 - 左下角
6066 1 - 下中
6067 2 - 右下角
6068 3 - 有標題欄,可移動,居中
6069 4 - 沒有標題欄,可移動,居中
6070 255 - 去除所有圖片
6071
6072文件名留空而位置255將移除所有圖片。其他位置數字不會使腳本出錯,但會使客戶端出錯。
6073一個屏幕只能顯示一張圖片。
6074
6075 // 這個會顯示第七個卡普拉
6076 // 橙色迷你裙的那個
6077 cutin "kafra_7",2;
6078
6079 // 去除顯示的圖片
6080 cutin "Kafra_7",255;
6081
6082 // 去除所有顯示的圖片
6083 cutin "",255;
6084
6085---------------------------------------
6086
6087*pet <寵物>;
6088
6089捕捉寵物用,可以在道具腳本外使用。
6090
6091可捕捉寵物ID見 'db/pet_db.txt'
6092
6093---------------------------------------
6094
6095*emotion <表情數字>{,<目標>{,"<目標名字>"}};
6096
6097顯示表情. 表情數字見 'db/const.txt' 以 'e_' 開頭的.
6098
6099目標為0或省略則表情顯示在關聯NPC頭上。
6100目標為0且指定目標名字則表情顯示指定NPC頭上。
6101目標不為0則顯示在關聯玩家頭上。
6102目標不為0且指定目標名字則顯示在指定玩家頭上。
6103
6104如果沒有發現名字則什麼都不會做。
6105
6106---------------------------------------
6107
6108*soundeffect "<文件名>",<類型>
6109*soundeffectall "<文件名>",<類型>{,"<地圖名>"}{,<x0>,<y0>,<x1>,<y1>}
6110
6111在關聯玩家客戶端播放音樂 ('soundeffect') 或在指定區域的玩家客戶端播放音樂
6112 ('soundeffectall'). 如果沒有指定區域,則會在關聯玩家身上播放,如果沒有關聯
6113玩家,則關聯NPC。
6114
6115類型0播放音效一次。
6116類型1是用來循環播放的,後面跟毫秒間隔。
6117類型2用來停止當前播放的音樂。
6118類型1、2當前所有已知客戶端都不支持,所以服務端不支持。
6119可以使用下面指令來測試客戶端是否支持
6120@send 0x1d3 S"complete.wav" B0 L0 L20000000(你的aid)
6121@send 0x1d3 S"complete.wav" B1 L1000 L20000000
6122@send 0x1d3 S"complete.wav" B2 L0 L20000000
6123
6124---------------------------------------
6125
6126*playBGM "<背景音樂文件名>"
6127*playBGMall "<背景音樂文件名>",{,"<地圖名>"}{,<x0>,<y0>,<x1>,<y1>}
6128
6129這兩條指令會對關聯角色('playBGM')或多個角色('playBGMall')播放背景音樂。
6130如果由浮動NPC運行此指令或者不是由NPC(道具腳本)運行此指令,聲音會從關聯
6131腳本的角色(如果有的話)為中心發出。除此之外,都會以NPC為中心發出。
6132
6133背景音樂文件名是在/BGM/文件夾中的文件名. 必須以.mp3為擴展名。
6134
6135腳本無需指定擴展名。
6136如果坐標被省略,則全地圖播放。
6137
6138通常情況下,你可以這樣自定義背景音樂。
6139
6140---------------------------------------
6141
6142*pvpon "<地圖名>";
6143*pvpoff "<地圖名>";
6144
6145為指定地圖打開PVP模式。效果同@pvpon。
6146
6147---------------------------------------
6148
6149*atcommand "<command line>",<標記>;
6150
6151這條命令會運行制定命令,就好像是99級的GM在鍵盤上輸入一樣。
6152
6153 // 無條件殺死該玩家
6154 input @player$;
6155 atcommand "@nuke "+@player$;
6156
6157使用標記後,將使用靜默默示,不會顯示平時使用指令時的信息。
6158
6159 //將不會給玩家顯示"人物光環已顯示。"
6160 atcommand "@aura 675",1;
6161
6162---------------------------------------
6163
6164*charcommand <command>,<標記>;
6165
6166根據Lance所說該命令無需玩家關聯。
6167
6168舉例:
6169 charCommand "#option 0 0 0 Roy";
6170
6171---------------------------------------
6172
6173*unitskilluseid <GID>,<技能id>,<技能等級>{,<目標id>{,<詠唱時間>{,<是否可被打斷>{,<詠唱結束>}}}};
6174*unitskillusepos <GID>,<技能id>,<技能等級>,<x>,<y>{,<詠唱時間>{,<是否可被打斷>{,<詠唱結束>}}}};
6175*unitskilluseid "名字",<技能id>,<技能等級>{,<目標id>{,<詠唱時間>{,<是否可被打斷>{,<詠唱結束>}}}};
6176*unitskillusepos "名字",<技能id>,<技能等級>,<x>,<y>{,<詠唱時間>{,<是否可被打斷>{,<詠唱結束>}}}};
6177
6178這是用來代替舊命令的, GID和unit系列命令用的一樣。
6179
6180x,y是地圖坐標。
6181詠唱時間為毫秒。
6182
6183名字只支持NPC和玩家,因為只有他們的名字是獨立的
6184
6185詠唱結束表明不會進行詠唱前的需求檢查和距離檢測。
6186
6187---------------------------------------
6188
6189*day;
6190*night;
6191
6192這兩天命令將實現服務器的晝夜交替。
6193設置不同會有不同的客戶端效果。如果服務器設置成了晝夜交替,最終會返回那個輪迴。
6194
6195這個例子講把早上3點設置成晚上而8點天亮, 而如果自動黑夜白晝切換在設置中關閉,
6196服務器在黑夜期間重啟,則黑夜效果將持續。自己理解吧:
6197
6198-%TAB%script%TAB%DayNight%TAB%-1,{
6199
6200 end;
6201
6202OnClock0300:
6203
6204OnClock0800:
6205
6206OnInit:
6207
6208 set $@minutesfrommidnight, gettime(3)*60+gettime(2);
6209
6210 set $@night_start, 180; // 03:00
6211 set $@night_end, 480; // 08:00
6212
6213 if ($@minutesfrommidnight>=$@night_start && $@minutesfrommidnight<$@night_end) goto StartNight;
6214
6215 goto StartDay;
6216 StartNight:
6217 night;
6218 end;
6219 StartDay:
6220 day;
6221 end; }
6222
6223---------------------------------------
6224
6225*defpattern <設置編號>,"<常規表達模板>","<事件標籤>";
6226*activatepset <設置編號>;
6227*deactivatepset <設置編號>;
6228*deletepset <設置編號>;
6229
6230這套命令僅在服務器支持常規表達庫時有效. 不幸的是, 默認編譯是不支持的, 但這些
6231隨便使用困難, 但效果很奇特.
6232
6233NPC會監聽玩家的公開對話, 如果符合常規表達模板, 就會觸發事件.
6234
6235模板按設置編號分類. 可以設置並激活多個模板. 模板編號從1開始.
6236
6237'defpattern' 會關聯表達式和事件. 如果模板激活而又玩家說的話符合模板內容, 則事
6238件就會觸發.
6239
6240'activatepset' 可以激活指定編號的模板. 激活的模板可以通過 'defpattern' 觸發事
6241件, 模板默認不激活.
6242'deactivatepset' 可以取消激活指定編號的模板. 如果指定模板編號為 -1,則所有模板
6243都取消激活.
6244
6245'deletepset' 會從內存中刪除指定編號的模板, 你可以重新設置該編號的模板.
6246
6247使用常規表達式會有很不可思議的效果. 而這不可思議的效果同樣伴隨著其獨特的文本
6248控制能力. 要更多常規表達式的解釋, 請參閱:
6249
6250http://www.regular-expressions.info/
6251http://www.weitz.de/regex-coach/
6252
6253使用舉例, 見 'npc\sample\npc_pcre.txt'.
6254
6255通過這些你可以對當眾乞討的玩家進行懲罰,或者反過來,你也可以直接給他錢.
6256
6257---------------------------------------
6258
6259*pow(<數字>,<冪>)
6260
6261返回計算結果
6262
6263舉例:
6264set @i, pow(2,3); // @i 是 8
6265
6266---------------------------------------
6267
6268*sqrt(<數字>)
6269
6270返回開方值
6271
6272舉例:
6273set @i, sqrt(25); // @i 是 5
6274
6275---------------------------------------
6276
6277*distance(<x0>,<y0>,<x1>,<y1>)
6278
6279返回兩點間的距離
6280
6281舉例:
6282set @i, distance(100,200,101,202);
6283
6284---------------------------------------
6285
6286*md5("<string>")
6287
6288Returns the md5 checksum of a number or string.
6289
6290Example:
6291 mes md5(12345);
6292 mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
6293 mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
6294
6295---------------------------------------
6296
6297*query_sql "MySQL語句", <數列名>{,<數列名>{;
6298
6299最大返回 127 個值至數列.
6300
6301舉例:
6302set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame);
6303mes "名譽大廳: 前五";
6304mes "1."+@name$[0]+"("+@fame[0]+")"; // 返回名譽最大值的人
6305mes "2."+@name$[1]+"("+@fame[1]+")";
6306mes "3."+@name$[2]+"("+@fame[2]+")";
6307mes "4."+@name$[3]+"("+@fame[3]+")";
6308mes "5."+@name$[4]+"("+@fame[4]+")";
6309
6310注意: TXT版本無效,並將返回-1.
6311注意: 使用 $ 作為前綴來獲得字符數據.
6312
6313---------------------------------------
6314
6315*escape_sql("<string>")
6316
6317Escapes special characters in the string, so that it is safe to use in query_sql(),
6318and returns the escaped form of the given string.
6319
6320Example 1:
6321 set .@str$, "John's Laptop";
6322 set .@esc_str$, escape_sql(.@name$); // Escaped string: John\'s Laptop
6323
6324---------------------------------------
6325
6326*setiteminfo(<item id>,<類型>,<value>)
6327
6328This function will set some value of an item.
6329Returns the new value on success, or -1 on fail (item_id not found or invalid type).
6330
6331Valid types are:
6332 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
6333 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
6334 if = 0, then monsters don't drop it at all (rare or a quest item)
6335 if = 10000, then this item is sold in NPC shops only
6336 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
6337 10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
6338
6339Example:
6340
6341setiteminfo 7049,6,999; // Stone now weighs 999
6342
6343---------------------------------------
6344
6345*setitemscript(<道具ID>,<"{ 新道具腳本 }">{,<類型>});
6346
6347為道具設置新的腳力語句. 對遊戲活動很有用.
6348可以通過留空來去除道具效果.
6349Type can optionally be used indicates which script to set (default is 0):
6350 0 - Script
6351 1 - OnEquip_Script
6352 2 - OnUnequip_Script
6353
6354舉例:
6355
6356setitemscript 2637,"{ if(isequipped(2236)==0)end; if(getskilllv(26)){skill 40,1;}else{skill 26,1+isequipped(2636);} }";
6357setitemscript 2637,"";
6358
6359---------------------------------------
6360
6361*runitemscript(<道具ID>{,<類型>});
6362*runitemscript("<道具名>"{,<類型>});
6363
6364執行道具的腳本,而不消耗/裝備道具。
6365
6366Type can optionally be used indicates which script to set (default is 0):
6367 0 - Script
6368 1 - OnEquip_Script
6369 2 - OnUnequip_Script
6370
6371---------------------------------------
6372
6373*atoi ("<字符串>")
6374*axtoi ("<字符串>")
6375
6376此類命令用來轉換字符串為數字
6377atoi 轉換十進制數字而 axtoi 轉換十六進制.
6378
6379舉例:
6380
6381 mes atoi("11"); // 將顯示 11
6382 set @var, axtoi("FF"); // 將把 @var 設置為 255
6383 mes axtoi("11"); // 將顯示 17 (1 = 1, 10 = 16,
6384 // 十六進制: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F})
6385
6386---------------------------------------
6387
6388*strtol ("<字符串>")
6389
6390strtol函數會將參數nptr字符串根據參數base來轉換成長整型數,參數base範圍從2至36。
6391
6392---------------------------------------
6393
6394*compare (<字符串>,<子字符串>)
6395
6396如果子字符串包含在字符串中,該函數返回1,否則返回0.
6397該命令不區分大小寫.
6398
6399舉例:
6400
6401//dothis; will be executed ('Bloody Murderer' contains 'Blood').
6402 if (compare("Bloody Murderer","Blood"))
6403 dothis;
6404//dothat; will not be executed ('Blood butterfly' does not contain 'Bloody').
6405 if (compare("Blood Butterfly","Bloody"))
6406 dothat;
6407
6408---------------------------------------
6409
6410*charisalpha("<字符串>",<位置>)
6411
6412如果字符串的指定位置是字母, 該函數會返回 1 , 如果是數字或空格會返回0.
6413
6414---------------------------------------
6415
6416*charat("<字符串>",<位置>)
6417
6418返回字符串中特定位置的字符. 如果位置超出範圍,則返回空字符串.
6419
6420例如:
6421
6422 charat("This is a string", 10); //返回 "s"
6423
6424---------------------------------------
6425
6426*setchar("<字符串>","<字母>",<位置>)
6427
6428對已有字符串中某位置設置字母。如果位置超出範圍,則返回原字符串。
6429如果字母不只有一個字符,只有第一個字母會被使用。
6430
6431例如:
6432
6433 setchar("Cat", "B", 0); //returns "Bat"
6434
6435---------------------------------------
6436
6437*insertchar("<字符串>","<字母>",<位置>)
6438
6439對已有字符串中某位置插入字母。如果位置超出範圍,則返回原字符串。
6440如果字母不只有一個字符,只有第一個字母會被使用。
6441
6442例如:
6443
6444 insertchar("laughter", "s", 0); //returns "slaughter"
6445
6446---------------------------------------
6447
6448*delchar("<字符串>",<位置>)
6449
6450刪除字符串中特定位置的字符. 如果位置超出範圍,則返回原字符串.
6451
6452例如:
6453
6454 delchar("Diet", 3); //returns "Die"
6455
6456---------------------------------------
6457
6458*strtoupper("<字符串>")
6459*strtolower("<字符串>")
6460
6461返回字符串的大寫/小寫形式,所有非字母將被保留
6462
6463例如:
6464
6465 strtoupper("The duck is blue!!"); //returns "THE DUCK IS BLUE!!"
6466
6467---------------------------------------
6468
6469*charisupper("<字符串>",<位置>)
6470*charislower("<字符串>",<位置>)
6471
6472如果字符串是大寫/小寫則返回1,否則0;非字母返回0;
6473
6474例如:
6475
6476 charisupper("SeAr", 1); //returns 0
6477
6478---------------------------------------
6479
6480*substr("<字符串>",<起始位置>,<結束位置>)
6481
6482返回字符串指定位置之間的子字符串. 如果位置超過範圍或,起始位置大於結束位置則返回空字符串.
6483
6484例如:
6485
6486 substr("foobar", 3, 5); //returns "bar"
6487
6488---------------------------------------
6489
6490*explode(<目標數組>,"<字符串>","<標示符>")
6491
6492基於標示符把字符串分解為子字符串。子字符串將儲存在指定數組裡。
6493如果標示符有多個字符,則只有第一個被使用。
6494如果沒有標示符,字符串將按原樣放進數組。
6495
6496Example:
6497
6498 explode(.@my_array$, "Explode:Test:1965:red:PIE", ":");
6499 //.@my_array$ contents will be...
6500 //.@my_array$[0]: "Explode"
6501 //.@my_array$[1]: "Test"
6502 //.@my_array$[2]: "1965"
6503 //.@my_array$[3]: "red"
6504 //.@my_array$[4]: "PIE"
6505
6506---------------------------------------
6507
6508*implode("字符串"{,<粘合符>})
6509
6510把子字符串粘合成一個字符串。
6511如果指定粘合符,那麼粘合符將存在於每個子字符串之間。
6512
6513Example:
6514 setarray .@my_array$[0], "This", "is", "a", "test";
6515 implode(.@my_array$, " "); //returns "This is a test"
6516
6517---------------------------------------
6518
6519*sprintf(<格式>[,參數[,參數[,...]]]) [Mirei]
6520
6521C style sprintf.
6522The resulting string is returned same as in PHP.
6523除了 %n 以外的C符號都支持.
6524More info: sprintf @ www.cplusplus.com.
6525參數數量受限於腳本引擎
6526
6527Example:
6528 .@format$ = 'The %s contains %d monkeys';
6529 dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
6530 dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
6531
6532---------------------------------------
6533
6534*sscanf(<string>,<format>[,param[,param[,...]]]) [Mirei]
6535
6536C style sscanf.
6537所有C格式的指示符都支持.
6538More info: sscanf @ www.cplusplus.com.
6539參數數量受限於腳本引擎
6540
6541Example:
6542 sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
6543 dispbottom(.@num + " " + .@str$); //prints "42 foobar"
6544
6545---------------------------------------
6546
6547*strpos("<字符串>", "<子字符串>"{,<序號>})
6548
6549PHP style strpos.
6550在字符串中搜索子字符串,並返回其起始位置.
6551序號標示要返回第幾個找到的目標。
6552如果沒有找到則返回-1.
6553區分大小寫
6554
6555Example:
6556 strpos("foobar", "bar", 0); //returns 3
6557 strpos("foobarfoo", "foo", 0); //returns 0
6558 strpos("foobarfoo", "foo", 1); //returns 6
6559
6560---------------------------------------
6561
6562*replacestr("<字符串>", "<子字符串1>", "<子字符串2>"{, <大小寫>{, <數量>}})
6563
6564在字符串中搜索子字符串1並替換為字符串2.
6565除非大小寫設定為0,否則默認區分大小寫。
6566除非指定數量時按順序替換指定個數,否則將全部替換子字符串1。
6567返回替換結果。
6568
6569Example:
6570 replacestr("testing tester", "test", "dash"); //returns "dashing dasher"
6571 replacestr("Donkey", "don", "mon", 0); //returns "monkey"
6572 replacestr("test test test test test", "yay", 0, 3); //returns "yay yay yay test test"
6573
6574---------------------------------------
6575
6576*countstr("<字符串>", "<子字符串>"{, <大小寫>})
6577
6578計算字符串中包含的子字符串. 除非大小寫設定為0,否則默認區分大小寫。
6579
6580Example:
6581 countstr("test test test Test", "test"); //returns 3
6582 countstr("cake Cake", "Cake", 0); //returns 2
6583
6584---------------------------------------
6585
6586*strcut(<文本>, <位置>{, <長度>})
6587 作用: 對"<文本>"截取在"<位置>"前的所有字符。
6588 <位置>最小為0;<長度>最小為1;如果不指定長度,默認為1。(兼容jA, CEA)
6589 如果指定「位置」不在文本長度內,則自動調整為最近的文本長度範圍內的值。
6590 如果指定「長度」超過了文本長度,則自動調整為剩餘文本長度。
6591 例如: strcut(strcharinfo(4),6,3), 截取玩家ip的第7位(含第7位)之後的3個字符。
6592 即:如果ip為10.16.218.24,則返回218。
6593
6594---------------------------------------
6595
6596*wedding_effect;
6597結婚成功是播放結婚效果 (音樂等)
6598結婚腳本中有實例.
6599
6600---------------------------------------
6601
6602*setfont <字體>
6603This command sets the current RO client interface font to one of the
6604fonts stored in data\*.eot by using an ID of the font. When the ID
6605of the currently used font is used, default interface font is used again.
6606 0 - Default
6607 1 - RixLoveangel
6608 2 - RixSquirrel
6609 3 - NHCgogo
6610 4 - RixDiary
6611 5 - RixMiniHeart
6612 6 - RixFreshman
6613 7 - RixKid
6614 8 - RixMagic
6615 9 - RixJJangu
6616
6617--------------------------------------
6618
6619* 寵物AI命令
6620
6621這些命令僅在關聯人物有寵物的情況下才能工作,並且理論上只有在寵物腳本裡才有效。
6622這些命令會改變關聯人物的寵物AI,而他們自己是不會獨立工作的,這也是為什麼只有
6623一條命令有效。一個寵物可以同時有'petloot', 'petskillbonus', 'petskillattack' 或
6624'petpetskillattack2' 和 'petskillsupport' 或 'petheal'。 'petheal' 在默認寵物腳
6625本裡不再使用。
6626
6627*petskillbonus <獎勵類型>,<值>,<持續時間>,<延時>;
6628
6629讓寵物給主人屬性點獎勵 (獎勵類型 - bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate -
6630詳見'db/const.txt'的b開頭部分)
6631
6632*petrecovery <屬性類型>,<延時>;
6633
6634讓寵物治癒指定的狀態。治癒效果會在每次延時的間隔時間內發生。
6635詳見'db/const.txt'的SC_開頭部分
6636
6637*petloot <最大數量>;
6638
6639該命令會開啟寵物的拾取功能。
6640寵物會在最大數量到達的時候或在表現狀態的時候把儲存的物品放出。
6641
6642*petskillsupport <技能id>,<技能等級>,<延時>,<hp百分比>,<sp百分比>;
6643*petskillsupport "<技能名>",<技能等級>,<延時>,<hp百分比>,<sp百分比>;
6644
6645該命名會使寵物在主人的hp或sp在指定的百分比以下時,根據指定延時,對主人使用支持技能。
6646技能id見'db/skill_db.txt'.
6647
6648*petskillattack <技能id>,<技能等級>,<幾率>,<獎勵幾率>;
6649*petskillattack "<技能名>",<技能等級>,<幾率>,<獎勵幾率>;
6650*petskillattack2 <技能id>,<傷害>,<攻擊次數>,<幾率>,<獎勵幾率>;
6651*petskillattack2 "<技能名>",<傷害>,<攻擊次數>,<幾率>,<獎勵幾率>;
6652
6653這兩條命令會讓寵物對主人當前攻擊的敵人詠唱攻擊技能。技能id和等級與'petskillsupport'
6654相同。'petskillattack2'會讓寵物使用的技能使用修正的傷害值和指定的攻擊次數。
6655
6656幾率是發動效果的百分率。 'bonusrate'是當寵物親密度達到最大值時,在普通幾率上增長的
6657幾率。
6658
6659上述效果只有在寵物足夠親密,並且在'battle_athena.conf'中進行了正確設置後才有效。
6660
6661寵物腳本在寵物孵化的時候就會運行。item腳本裡的命令在此時也能運行。顯然,寵物命令在
6662npc腳本裡也有效,直到寵物被再次孵化(人物上下線後也會失效)。NPC腳本生效的寵物AI的
6663持續時間尚不清楚,但至少,這可以用來製作為對寵物進行BUFF的道具。
6664
6665--------------------------------------
6666
6667*bpet;
6668
6669在當前人物的客戶端內打開寵物孵化窗口。
6670可以在道具腳本外使用。
6671
6672---------------------------------------
6673
6674*makepet <pet id>;
6675
6676此命令會創建一個寵物蛋放在關聯人物的道具欄內。寵物類型由'db/pet_db.txt'內的寵物
6677ID決定。創建寵物蛋和玩家成功捕捉魔物的方式一模一樣。
6678
6679 // 給你一個波利:
6680 makepet 1002;
6681
6682注意你不需用此方法創建寵物蛋。如果你用getitem來創建寵物蛋,那麼寵物蛋數據不會傳
6683遞給人物服務器,而玩家在孵化寵物的時候,蛋就會直接消失。(Inkfish: 貌似現在不會消失)
6684
6685---------------------------------------
6686
6687*openmail;
6688
6689打開關聯人物的郵箱窗口。
6690
6691 mes "關閉此窗口來打開郵箱窗口。";
6692 close2;
6693 openmail;
6694 end;
6695
6696---------------------------------------
6697
6698*homshuffle;
6699
6700按照生命體當前等級重新計算當前關聯人物的生命體屬性。
6701
6702---------------------------------------
6703
6704*hommutate <id>;
6705
6706生命體變異。保持屬性和技能。只有在使用過morphembryo後才能使用,並將刪除6415道具。
6707
6708---------------------------------------
6709
6710*morphembryo;
6711
6712This command will try to put the invoking player's Homunculus in an
6713uncallable state, required for mutation into a Homunculus S. The player
6714will also receive a Strange Embryo (ID 6415) in their inventory if
6715successful, which is deleted upon mutation.
6716
6717The command will fail if the invoking player does not have an evolved
6718Homunculus at level 99 or above. The /swt emotion is shown upon failure.
6719
6720Returns 1 upon success and 0 for all failures.
6721
6722---------------------------------------
6723
6724*checkhomcall()
6725
6726This function checks if the attached player's Homunculus is active,
6727and will return the following values:
6728 -1: The player has no Homunculus.
6729 0: The player's Homunculus is active.
6730 1: The player's Homunculus is vaporized.
6731 2: The player's Homunculus is in morph state.
6732
6733---------------------------------------
6734
6735*setcell "<地圖名>",<x1>,<y1>,<x2>,<y2>,<類型>,<標記>;
6736
6737每個地圖的單元格都有很多指定其單元格屬性的「標記」。
6738包括地形屬性 (能否行走, 能否攻擊, 是否存在水),
6739技能 (神聖殿堂, 地屬性領域, ...) 和其他 (npc附近, 禁止交易, ...).
6740每種類型都能打開或關閉。他們共同決定了此單元格的表現。
6741
6742該命令能讓你轉換指定坐標範圍內(x1,y1)-(x2,y2)的所有地圖單元格的標記狀態。
6743標記可以是0或1 (0:清除標記, 1:設置標記).
6744類型定義了要標記的內容。有效類型包括:cell_walkable,
6745cell_shootable, cell_basilica. 詳見const.txt.
6746
6747舉例:
6748
6749 setcell "arena",0,0,300,300,cell_basilica,1;
6750 setcell "arena",140,140,160,160,cell_basilica,0;
6751 setcell "arena",135,135,165,165,cell_walkable,0;
6752 setcell "arena",140,140,160,160,cell_walkable,1;
6753
6754這會在地圖中央創建一個圓。圓外有一個5格寬的圓環,防止與外界交流。地圖的其餘
6755部分被標記為「神聖殿堂」,禁止任何人的攻擊。客戶端不會顯示圓環為牆,但卻不能移動
6756
6757再舉例:
6758
6759OnBarricadeDeploy:
6760 setcell "schg_cas05",114,51,125,51,cell_walkable,0;
6761 end;
6762OnBarricadeBreak:
6763 setcell "schg_cas05",114,51,125,51,cell_walkable,1;
6764 end;
6765
6766這是WoE:SE的一部分腳本, 攻擊者在路障被清除前無法繼續前進。這條命令會創建一條不
6767能行走的單元格,並在路障被清除後取消。
6768
6769---------------------------------------
6770
6771*checkcell ("<地圖名>",<x>,<y>,<類型>);
6772
6773該命令會返回 1 或 0, 取決於指定單元格是否設置了指定「類型」。有很多類型可以
6774檢測, 所有類型參見db/const.txt。
6775
6776有些類型容易混淆, 下面作一下解釋:
6777 - cell_chkwall/water/cliff
6778 這些直接對指定單元格的「地形」作檢查
6779 - cell_chkpass/reach/nopass/noreach
6780 passable = 不是牆也不是斷頭路, reachable = 可通過但不能重疊
6781 - cell_chknpc/basilica/landprotector/novending/nochat
6782 他們的名字就似乎他們的意思(npc、神聖殿堂、地屬性領域、不能開商店、不能開聊天室)
6783
6784舉例:
6785
6786 mes "挑一個目標地圖";
6787 input .@map$;
6788 mes "好,再給我坐標";
6789 input .@x;
6790 input .@y;
6791 if( !checkcell(.@map$,.@x,.@y,cell_chkpass) )
6792 {
6793 mes "抱歉,不能把你傳送過去!";
6794 close;
6795 }
6796 else
6797 {
6798 mes "好吧,準備好了...";
6799 close2;
6800 warp .@map$, .@x, .@y;
6801 end;
6802 }
6803
6804---------------------------------------
6805*setwall "<地圖名>",<x>,<y>,<大小>,<方向>,<可遠程攻擊>,"<名稱>";
6806*delwall "<名稱>";
6807
6808創建一個無形的牆,從指定坐標、在指定方向建立一排指定大小的單元。與setcell的不
6809同點在於,此命令同時更新客戶端部分,以防出錯。
6810
6811---------------------------------------
6812
6813*progressbar "<顏色>",<時間>;
6814
6815時間為秒,顏色暫無意義。
6816
6817在人物頭上顯示進度條。
6818
6819例如:
6820 progressbar 0x000000,10;
6821 mes "你好";
6822 close;
6823客戶端將顯示一個10秒的進度條,然後顯示「你好」。
6824進度條進行中時,無法使用技能;移動將取消進度條,終結腳本。
6825
6826---------------------------------------
6827
6828*progressbar_npc "<color>",<seconds>;
6829
6830Note: If a player is attached to the NPC, they are detached from the NPC
6831as soon as the progress bar activates.
6832
6833*npcprogressbar "<color>",<seconds>{,<"NPC Name">};
6834
6835This command works like progressbar, but displays a progress bar
6836above the head of the currently attached (or given) NPC. Once the
6837given amount of seconds passes, the script resumes. The color format
6838is in RGB (RRGGBB). The color is currently ignored by the client and
6839appears always green.
6840
6841---------------------------------------
6842
6843*questnotify <類型1>, <類型2>;
6844*showevent <類型1>, <類型2>;
6845
6846顯示NPC坐標在小地圖中,並在NPC頭上顯示表情。
6847
6848類型1: (請使用常量,源碼內置轉換兼容120410前後客戶端)
6849 QTYPE_NONE 取消表情和標記
6850 QTYPE_QUEST 感歎號任務(quest)表情
6851 QTYPE_QUEST2 問號任務(quest)表情
6852 QTYPE_JOB 感歎號職業任務(job)表情
6853 QTYPE_JOB2 問號職業任務(job)表情
6854 QTYPE_EVENT 感歎號活動(event)表情
6855 QTYPE_EVENT2 問號活動(event)表情
6856 QTYPE_WARG 狼
6857 QTYPE_WARG2 狼(20120410之後)
6858
6859類型2:
6860 0 = 無標記
6861 1 = 黃色標記
6862 2 = 綠色標記
6863 3 = 藍色標記
6864
6865----------------------------------------
6866
6867*questinfo <任務id>,<類型1>, <類型2>{,<職業id>};
6868
6869顯示NPC坐標在小地圖中,並在NPC頭上顯示表情。
6870
6871類型1: (請使用常量,源碼內置轉換兼容120410前後客戶端)
6872 QTYPE_NONE 取消表情和標記
6873 QTYPE_QUEST 感歎號任務(quest)表情
6874 QTYPE_QUEST2 問號任務(quest)表情
6875 QTYPE_JOB 感歎號職業任務(job)表情
6876 QTYPE_JOB2 問號職業任務(job)表情
6877 QTYPE_EVENT 感歎號活動(event)表情
6878 QTYPE_EVENT2 問號活動(event)表情
6879 QTYPE_WARG 狼
6880 QTYPE_WARG2 狼(20120410之後)
6881
6882類型2:
6883 0 = 無標記
6884 1 = 黃色標記
6885 2 = 綠色標記
6886 3 = 藍色標記
6887
6888在OnInit標籤中使用。當玩家加載完地圖後,如果NPC運行過questinfo,就會檢查是否有
6889該任務,如果沒有,則會在NPC頭上出現氣泡提示。
6890
6891也可以指定職業ID來檢測是否有特定職業的任務存在。
6892
6893舉例:
6894izlude,100,100,4 script Test 844,{
6895 mes "[Test]";
6896 mes "Hello World.";
6897 close;
6898
6899
6900 OnInit:
6901 questinfo 1001, QTYPE_QUEST, 0, Job_Novice;
6902 end;
6903}
6904
6905----------------------------------------
6906
6907*setquestinfo_level <quest_id>,<min_level>,<max_level>;
6908
6909Add level range criteria for quest info with quest id 'quest_id'.
6910
6911This command must be used after 'questinfo'.
6912
6913---------------------------------------
6914
6915*setquestinfo_req <quest_id>,<req_quest_id>,<state>{,<req_quest_id>,<state>,...};
6916
6917Add 'req_quest_id' as requirement for quest info with quest id 'quest_id'.
6918
6919Value os 'state' are:
6920 0: Player doesn't started 'req_quest_id'.
6921 1: Player has 'req_quest_id' (state is either "inactive" or "active").
6922 2: Player has 'req_quest_id' completed
6923
6924This command must be used after 'questinfo'.
6925
6926---------------------------------------
6927
6928*setquestinfo_job <quest_id>,<job_id>{,<job_id>...};
6929
6930Add job criteria for quest info with quest id 'quest_id'.
6931The job criteria may more than one job_id.
6932
6933This command must be used after 'questinfo'.
6934
6935---------------------------------------
6936
6937
6938========================
6939|7.- 副本系統指令.|
6940========================
6941---------------------------------------
6942
6943*instance_create("<副本名>");
6944
6945為關聯玩家的隊伍創建副本. 副本名,和其他相關副本數據,都是從 'db/instance_db.txt'
6946讀取。如果成功,會返回一個唯一的副本ID,並複製所有地圖和NPC,設置有效時間,並觸發
6947副本中所有NPC裡的"OnInstanceInit" 標籤下的腳本。
6948
6949如果成功返回副本ID, 如果失敗則返回:
6950 -1: 無效類型.
6951 -2: 未找到組隊.
6952 -3: 副本已存在.
6953 -4: 沒有空餘的副本.
6954
6955---------------------------------------
6956
6957*instance_destroy {<副本ID>};
6958
6959銷毀指定ID的副本。
6960如果沒有指定ID,則銷毀關聯玩家關聯的副本。
6961如果沒有關聯玩家,則銷毀關聯腳本的副本。
6962如果腳本沒有關聯副本,腳本終止。
6963指定副本ID時,不能有玩家關聯,否則副本不會被銷毀
6964
6965---------------------------------------
6966
6967*instance_enter("<副本名>");
6968
6969腳本結束後傳送關聯玩家到副本中.
6970地圖和坐標在 'db/instance_db.txt'中定義.
6971
6972成功返回0, 失敗返回:
6973 1: 未找到組隊.
6974 2: 組隊沒有副本.
6975 3: 其他錯誤 (無效副本名, 副本和組隊不匹配等).
6976
6977---------------------------------------
6978
6979*instance_npcname("<NPC名字>"{,<副本id>});
6980
6981返回副本化腳本的唯一npc名. 如果沒有指定ID則銷毀關聯腳本的副本。如果腳本沒有關聯副本,腳本
6982關聯玩家的關聯副本被銷毀,如果這也失敗,腳本終止。
6983
6984---------------------------------------
6985
6986*instance_mapname("<地圖名>"{,<副本id>});
6987
6988返回副本化腳本的唯一地圖名. 如果沒有指定ID則銷毀關聯腳本的副本。如果腳本沒有關聯副本,腳本
6989關聯玩家的關聯副本被銷毀,如果這也失敗,返回空字符串。
6990
6991---------------------------------------
6992
6993*instance_id({<參數>});
6994
6995返回腳本的副本id。
6996如果有參數,且參數為0時,返回腳本的副本ID
6997如果有參數,且參數為1時,返回關聯玩家的副本ID
6998如果有參數,且參數為1時,如果沒有關聯玩家或關聯玩家沒有副本,返回0
6999如果沒有參數,返回腳本的副本ID
7000
7001---------------------------------------
7002
7003*instance_getname({<副本ID>});
7004
7005返回副本id的副本名稱。
7006
7007---------------------------------------
7008
7009*instance_warpall "<地圖名>",<x>,<y>{,<副本id>};
7010
7011傳送指定副本id中的玩家去指定地圖名的指定坐標。 如果沒有指定ID則銷毀關聯腳本的副本。
7012如果腳本沒有關聯副本,腳本關聯玩家的關聯副本被銷毀,如果這也失敗,腳本終止。
7013
7014---------------------------------------
7015
7016*instance_check_party(<組隊id>{,<數量>{,<最小>{,<最大>}}});
7017*instance_check_guild(<公會id>{,<數量>{,<最小>{,<最大>}}});
7018*instance_check_clan(<家族id>{,<數量>{,<最小>{,<最大>}}});
7019
7020該函數檢查組隊是否符合特定條件, 返回1如果所有條件符合,否則則返回0。只會檢查在線玩家。
7021
7022數量 - 在線隊伍成員數量 (默認 1).
7023最小 - 組隊成員中的最小等級 (默認 1).
7024最大 - 組隊成員中的最大等級 (默認為 conf 中的最大等級).
7025
7026舉例:
7027
7028if (instance_check_party(getcharid(1),2,2,149)) {
7029 mes "Your party meets the Memorial Dungeon requirements.",
7030 mes "All online members are between levels 1-150 and at least two are online.";
7031 close;
7032} else {
7033 mes "Sorry, your party does not meet requirements.";
7034 close;
7035}
7036
7037---------------------------------------
7038
7039========================
7040|8.- Quest Log commands.|
7041========================
7042---------------------------------------
7043
7044*setquest <ID>;
7045
7046獲取任務DB中對應<ID>的任務到玩家任務記錄中,狀態為激活.
7047
7048---------------------------------------
7049
7050*completequest <ID>;
7051
7052完成任務DB中對應<ID>的任務,並玩家任務記錄中刪除.
7053
7054---------------------------------------
7055
7056*erasequest <ID>{,<靜默>};
7057
7058刪除任務DB中對應<ID>的任務
7059
7060---------------------------------------
7061
7062*changequest <ID>,<ID2>;
7063
7064刪除任務DB中對應<ID>的任務
7065獲取任務DB中對應<ID2>的任務到玩家任務記錄中,狀態為激活.
7066
7067---------------------------------------
7068
7069checkquest(<ID>{,PLAYTIME|HUNTING});
7070
7071沒有附加參數時:
7072 -1 = 未獲得任務
7073 0 = 任務未激活
7074 1 = 任務激活
7075 2 = 任務完成
7076
7077參數PLAYTIME:
7078 -1 = 未獲得任務
7079 0 = 時限未到
7080 1 = 時限未到且任務已經完成
7081 2 = 時限已到
7082
7083參數HUNTING:
7084 -1 = 未獲得任務
7085 0 = 未殺完魔物但時間未到
7086 1 = 未殺完魔物但時間已到
7087 2 = 殺完魔物
7088
7089---------------------------------------
7090
7091===========================
7092|9.- 戰場指令.|
7093===========================
7094---------------------------------------
7095
7096*waitingroom2bg_single(<battle group>,"<mapname>",<x>,<y>,"<npc name>");
7097
7098Adds the first waiting player from the chat room of given NPC to an
7099existing battleground group and warps it to specified coordinates on
7100given map.
7101
7102---------------------------------------
7103
7104*waitingroom2bg("<mapname>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<npc name>"});
7105
7106<Mapname> and X Y coordinates refer to where the "respawn" base is, where the player group will respawn when they die.
7107<On Quit Event> refers to an NPC label that attaches to the character and is run when they relog.
7108<On Death Event> refers to an NPC label that attaches to the character and is run when they die. Can be "" for empty.
7109
7110Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
7111sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
7112
7113If the option parameter is left out, the waiting room of the current NPC is used.
7114
7115Example:
7116 // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
7117 set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
7118 end;
7119
7120----------------------------------------
7121
7122*bg_team_setxy <Battle Group ID>,<x>,<y>;
7123
7124Update the respawn point of the given battle group to x, y on the same map. The <Battle Group ID> can be retrieved using getcharid(4)
7125
7126Example:
7127 bg_team_setxy getcharid(4),56,212;
7128 mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
7129 end;
7130
7131----------------------------------------
7132
7133*bg_warp <Battle Group>,"<Mapname>",<x>,<y>;
7134
7135Similar to warp command.
7136Place all members of <Battle Group> at <mapname> at x y.
7137
7138Example:
7139 //place the battle group one for Tierra Gorge at starting position.
7140 bg_warp $@TierraBG1_id1,"bat_a01",352,342;
7141 end;
7142
7143----------------------------------------
7144
7145*bg_monster <Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>";
7146*bg_monster(<Battle Group>,"<map name>",<x>,<y>,"<name to show>",<mob id>,"<event label>");
7147
7148Similar to monster script command.
7149Spawn a monster with allegiance to the given battle group.
7150Does not allow for the summoning of multiple monsters.
7151Monsters are similar to that in War of Emperium, in that the specified Battle group is considered friendly.
7152
7153Example:
7154 // It can be used in two different ways.
7155 bg_monster $@TierraBG1_id2,"bat_a01",167,50,"Food Depot",1910,"Feed Depot#1::OnMyMobDead";
7156 end;
7157
7158 // Alternatively, you can set an ID for the monster using "set".
7159 // This becomes useful when used with the command below.
7160 set $@Guardian_3, bg_monster($@TierraBG1_id2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
7161 end;
7162
7163----------------------------------------
7164
7165*bg_monster_set_team <GID>,<Battle Group>;
7166
7167This command will change the allegiance if a monster in a battle ground.
7168GID can be set when spawning the monster via the bg_monster command.
7169
7170Example:
7171
7172 end;
7173
7174OnEnable:
7175 mapannounce "A guardian has been summoned for Battle Group 2!",bc_map,"0xFFCE00";
7176 set $@Guardian, bg_monster($@BG_2,"bat_a01",268,204,"Guardian",1949,"NPCNAME::OnMyMobDead");
7177 initnpctimer;
7178 end;
7179
7180OnTimer1000:
7181 stopnpctimer;
7182 mapannounce "Erm, sorry about that! This monster was meant for Battle Group 1.",bc_map,"0xFFCE00";
7183 bg_monster_set_team $@Guardian, $@BG_1;
7184 end;
7185
7186----------------------------------------
7187
7188*bg_leave;
7189
7190Removes attached player from their Battle Group.
7191
7192----------------------------------------
7193
7194*bg_destroy <Batte Group>;
7195
7196As the name says, destroys the battle group created for that battle ground.
7197
7198----------------------------------------
7199
7200*areapercentheal "<mapname>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
7201
7202Not exactly limited to battleground use, this will restore HP/SP in a defined area at a percentage.
7203
7204Example:
7205 areapercentheal "bat_a01",52,208,61,217,100,100;
7206 end;
7207
7208----------------------------------------
7209
7210*bg_get_data(<Battle Group>,<類型>);
7211
7212Retrieves data related to given battle group. Type can be one of the following:
7213
7214 0 - Amount of players currently belonging to the group.
7215
7216----------------------------------------
7217
7218*bg_getareausers(<battle group>,<map name>,<x0>,<y0>,<x1>,<y1>);
7219
7220Retrieves amount of players belonging to given battle group on given
7221map within an specified rectangular area.
7222
7223----------------------------------------
7224
7225*bg_updatescore "<mapname>",<Guillaume Score>,<Croix Score>;
7226
7227Only usable when the map is defined as type:
7228mapflag <mapname> battleground 2
7229This command will force the update of the displayed scoreboard.
7230
7231----------------------------------------
7232
7233bg_kickall <battleground ID>;
7234
7235----------------------------------------
7236
7237getbgusers <battleground ID>;
7238
7239----------------------------------------
7240
7241setbgid <battleground ID> {, <player name> };
7242
7243----------------------------------------
7244
7245createbgid <battleground ID>, <respawn map>, <respawn x>, <respawn y>, <On Quit event>, <On Death event>;
7246
7247----------------------------------------
7248
7249==========================
7250|10.- Mercenary commands.|
7251==========================
7252---------------------------------------
7253
7254*mercenary_create <class>,<contract time>;
7255
7256This command summons a mercenary of given class, for given amount of
7257time in milliseconds. Typically used in item scripts of mercenary
7258scrolls.
7259
7260----------------------------------------
7261
7262*mercenary_delete <參數>;
7263
7264會解除傭兵合約。
7265參數只對客戶端顯示有效。
7266 * 0 = Mercenary soldier's duty hour is over.
7267 * 1 = Your mercenary soldier has been killed.
7268 * 2 = Your mercenary soldier has been fired.
7269 * 3 = Your mercenary soldier has ran away.
7270
7271----------------------------------------
7272
7273*mercenary_heal <hp>,<sp>;
7274
7275This command works like 'heal', but affects the mercenary of the
7276currently attached character.
7277
7278----------------------------------------
7279
7280*mercenary_sc_start <類型>,<tick>,<val1>;
7281
7282This command works like 'sc_start', but affects the mercenary of the
7283currently attached character.
7284
7285----------------------------------------
7286
7287*mercenary_get_calls(<guild>);
7288*mercenary_set_calls <guild>,<value>;
7289
7290Sets or gets the mercenary calls value for given guild for currently
7291attached character. Guild can be one or the following constants:
7292
7293 ARCH_MERC_GUILD
7294 SPEAR_MERC_GUILD
7295 SWORD_MERC_GUILD
7296
7297----------------------------------------
7298
7299*mercenary_get_faith(<guild>);
7300*mercenary_set_faith <guild>,<value>;
7301
7302Sets or gets the mercenary faith value for given guild for currently
7303attached character. Guild can be one or the following constants:
7304
7305 ARCH_MERC_GUILD
7306 SPEAR_MERC_GUILD
7307 SWORD_MERC_GUILD
7308
7309---------------------------------------
7310
7311========================
7312|11.- SeA 指令|
7313========================
7314---------------------------------------
7315
7316*getnpcdata("類型"{,<NPCID>/"NPC名"});
7317*setnpcdata <類型>,"值"{,<NPCID>/"NPC名"};
7318 類型: 1: NPC 名,2: NPC大小(0,1,2),3: NPC方向(0~7)
7319 10:形象ID,11:頭上飾品, 12:頭中飾品, 13:頭下飾品
7320 14:性別, 15:髮型, 16:髮色, 17:衣服色
7321 18:披肩
7322 特殊類型:0: 僅對getnpcdata有作用,返回NPCID
7323 20:僅對setnpcdata有作用,複製指定CID的人物形象給npc。
7324 舉例:
7325 getnpcdata(1); //返回npc名
7326 setnpcdata 20,getcharid(0); //複製自己的形象給npc
7327 註: 僅Xray客戶端支持NPC使用玩家形象。
7328
7329---------------------------------------
7330
7331*dupnpc "參數1","參數2","參數3","參數4"{,持續時間};
7332 作用: 複製NPC。
7333 舉例:
7334 腳本:
7335 prontera,146,99,2 script PVP服務::PVP 917,{
7336 end;
7337 }
7338
7339 通常複製語句:
7340 prontera,156,99,2 duplicate(PVP) PVP服務#1 917
7341
7342 該命令語法:
7343 dupnpc "prontera,156,99,2","duplicate(PVP)","PVP服務#1","917";
7344
7345 即,所有<%TAB>用逗號代替,每個參數之間加引號。
7346 持續時間:毫秒,在玩家完成腳本運行後的"持續時間"後,NPC會自動卸載。
7347
7348---------------------------------------
7349
7350*mobuseskill <GID>,"技能名"/<技能id>,<技能等級>,<詠唱時間>,<可否中斷詠唱>,<表情>,<目標類型>;
7351 作用: 指定魔物使用某技能。
7352 目標類型: 0:自己
7353 1:攻擊對像
7354 2:主人
7355 其他值:隨機。
7356
7357---------------------------------------
7358
7359*enhance <裝備位置>, <類型>, <數值>;
7360 作用: 增加或減少或查詢某位置裝備的耐久度。
7361 裝備不存在時返回-1,否則返回物品的耐久度。
7362 <類型>為0時調整當前耐久度,<類型>為1時調整最大耐久度。
7363 <數值>為0時即查詢耐久度。
7364
7365---------------------------------------
7366
7367*getdurequip <道具id或道具名>,<精煉值>,<卡片1>,<卡片2>,<卡片3>,<卡片4>,<最大耐久度>{,<角色ID>};
7368 作用: 得到有耐久度的指定道具。
7369 例如: getdurequip 2424,10,0,0,0,0,200; 玩家將得到200耐久度的+10輕便鞋。
7370
7371---------------------------------------
7372
7373*getnpcid({"<npcname>"});
7374 作用: 返回npc id,不輸入名字則返回當前npc id;否則則返回輸入名字之npc id。
7375 npc有唯一名(::Name)則輸入唯一名;否則,如果有隱藏名則輸入顯示名+隱藏名,
7376 沒有隱藏名則輸入顯示名。
7377
7378---------------------------------------
7379
7380*delinventory <位置序號>,<數量>;
7381 作用: 刪除道具欄中某位置的物品,位置序號通過getinventoryinfo比對確認。
7382
7383---------------------------------------
7384
7385*equipinventory <位置序號>;
7386 作用: 裝備道具欄中某位置的物品,位置序號通過getinventoryinfo比對確認。
7387
7388---------------------------------------
7389
7390*getinventoryinfo(<位置序號>, <類型>);
7391*setinventoryinfo <位置序號>, <類型>, <值>("<值>");
7392 作用: 根據物品欄位置編號查詢物品信息。
7393 返回-1,如果物品不存在或類型不正確。
7394 類型:
7395 0: id
7396 1: 數量
7397 2: 是否裝備
7398 3: 精煉值
7399 4: 是否鑒定
7400 5: 是否損壞
7401 6: 卡片1
7402 7: 卡片2
7403 8: 卡片3
7404 9: 卡片4
7405 10: 租賃到期時間
7406 11: 耐久度修復後可以使用的時間
7407 12: 當前耐久度
7408 13: 耐久度最大值
7409 14: 裝備序列號(可疊加物品慎用)
7410 15: 隨機屬性1獎勵
7411 16: 隨機屬性2獎勵
7412 17: 隨機屬性3獎勵
7413 18: 隨機屬性4獎勵
7414 19: 隨機屬性5獎勵
7415 20: 隨機屬性1值1
7416 21: 隨機屬性2值1
7417 22: 隨機屬性3值1
7418 23: 隨機屬性4值1
7419 24: 隨機屬性5值1
7420 25: 隨機屬性1值2
7421 26: 隨機屬性2值2
7422 27: 隨機屬性3值2
7423 28: 隨機屬性4值2
7424 29: 隨機屬性5值2
7425 30: 綁定
7426 31: 卡片1租賃到期時間
7427 32: 卡片2租賃到期時間
7428 33: 卡片3租賃到期時間
7429 34: 卡片4租賃到期時間
7430
7431---------------------------------------
7432
7433*existitem(<id>);
7434*existitem(<"name">);
7435 作用: 檢測是否存在該物品。
7436 返回0,如果不存在。
7437 返回<道具id>,如果物品存在,且可以疊加。
7438 返回 - <道具id>,如果物品存在,且不能疊加。
7439 舉例: existitem("太陽眼鏡") == -2201
7440
7441---------------------------------------
7442
7443*readbook <書id>,<頁碼>;
7444 作用: 通過腳本打開書並跳轉到某頁。
7445
7446---------------------------------------
7447
7448*countpoints(<類型>);
7449 作用: 顯示當前角色的卡普拉點數或金錢點數。未知類型返回-1。
7450 類型: 1 - 卡普拉點數;
7451 2 - 金錢點數。
7452
7453---------------------------------------
7454
7455*sendmail "<收件人姓名>","<標題>","<正文>",<zeny數量>{,<物品id>,<數量>,<鑒定>,<精煉>,<損壞>,<卡片1>,<卡片2>,<卡片3>,<卡片4>{,"<發件人姓名>"}};
7456 作用: 可以發匿名郵件,系統不會檢測發件人姓名。常用於給不在線玩家發送物品。
7457 收件人姓名必須真實;
7458 發件人姓名可隨意填寫;
7459 發件人姓名不填寫,則必須存在玩家腳本關聯。
7460 此指令裡設的道具,將覆蓋setitem_next_sendmail中的位置0
7461
7462---------------------------------------
7463
7464*setitem_next_sendmail <位置>,<物品id>,<數量>,<鑒定>,<精煉>,<損壞>,<卡片1>,<卡片2>,<卡片3>,<卡片4>
7465
7466 作用:下一次使用sendmail時,發送道具。
7467 位置:0-4
7468
7469---------------------------------------
7470
7471*resume <裝備位置>, <時間>{,卡片序號};
7472 作用: 續租某位置裝備,時間單位為秒。
7473 裝備不存在時返回-1,非租賃物品返回0,租賃裝備返回續租後剩餘租賃時間。
7474 時間可以為負數以縮短租賃時間。
7475 卡片序號為1~4;
7476
7477---------------------------------------
7478
7479*battleignore{ <標記>};
7480 作用: 怪物不會攻擊你,標記為0時為取消,其他則進入該狀態。
7481
7482---------------------------------------
7483
7484*warpignore{ <標記>};
7485 作用: 不會被傳送,標記為0時為取消,其他則進入該狀態。
7486
7487---------------------------------------
7488
7489*setoption1 <編號>;
7490 作用: 是對像進入指定狀態。下表沒有的編號,則默認為0
7491 類型列表:
7492 1 - 完全石化
7493 2 - 冰凍
7494 3 - 暈眩
7495 4 - 睡眠
7496 6 - 石化中
7497
7498---------------------------------------
7499
7500*setoption2 <編號>{,<標記>};
7501 作用: 標記不為0或沒有標記,則使對像進入指定狀態,標記為0則取消狀態。
7502 類型列表:
7503 1 - 中毒
7504 2 - 詛咒
7505 4 - 沉默
7506 8 - 未知
7507 16 - 黑暗
7508 32 - 致命中毒
7509
7510---------------------------------------
7511
7512*campon "<地圖名>"{,<標籤>};
7513 campoff "<地圖名>";
7514 作用: 打開或關閉無需按shift就能攻擊的功能,只能攻擊不同陣營的對象。
7515 類型: 標籤為2時,地圖顯示傷害,否則則不顯示。
7516
7517---------------------------------------
7518
7519*isrestricted <道具id>;
7520 作用: 如果物品在db\item_trade.txt設定為限制物品,則返回其限制內容;
7521 限制內容由1、2、8、16、32、64表示(具體限制對應參見db\item_trade.txt)
7522 否則,則返回0。如果物品不存在,則返回-1。
7523
7524---------------------------------------
7525
7526*islocked <道具id>;
7527 作用: 檢查該玩家是否鎖定該物品。
7528 是則返回1,否則,則返回0。
7529 注意: 如果身上有一件獨立綁定的道具,該指令也會對該種類道具返回1;
7530
7531---------------------------------------
7532
7533*islocked2 <道具位置>{,<標籤>};
7534 作用: 檢查該玩家是否鎖定該物品。
7535 標籤1:檢查存倉庫是否鎖定
7536 標籤2:檢查賣給NPC是否鎖定
7537 是則返回1,否則,則返回0。
7538 說名: 道具位置用用getinventoryinfo精確定位。
7539
7540---------------------------------------
7541
7542*isrental <裝備位置>;
7543 作用: 如果物品為租賃物品,則返回其剩餘時間(秒)
7544 否則,則返回0;如果指定裝備位置不正確,則返回-1。
7545
7546---------------------------------------
7547
7548*rentequip <道具id或道具名>,<精煉值>,<卡片1>,<卡片2>,<卡片3>,<卡片4>,<N秒後到期>{,<角色ID>{,<是否可交易>}};
7549 作用: 租賃指定的道具,任何裝備都能通過此直接租賃.
7550 租賃物品自動成為無法交易,但可放手推車和個人倉庫,逾期會自動刪除。可以精煉,插卡。
7551 例如: rentequip 2424,10,0,0,0,0,3600; 將租+10輕便鞋給玩家1小時。
7552
7553---------------------------------------
7554
7555*campmob("<map name>",<spawn x>,<spawn y>,<target x>,<target y>,<monster name>,<monster id>,<monster camp>{,"<event>"})
7556 作用: 在指定地圖指定位置創造一個魔物,並且能為該魔物指定陣營、行走目標坐標以及觸發事件。
7557 魔物的出生坐標可以為0,即隨即位置生成。魔物的目的坐標可以為0,即隨即走動。魔物的出生坐標與目的坐標相同,即隨即走動。
7558 如果魔物陣營為0,即普通怪物。如果魔物陣營不為0,則其會主動攻擊有陣營且陣營不同的玩家(魔物狀態必須是Aggressive)。
7559 該腳本會返回魔物GID,可用於mobattach魔物操控。如果魔物與npc關聯,則最後的觸發事件不會啟動,必須使用Callback觸發。
7560 該部分內容請見doc\script_command.txt,Mob Control Suit章節。
7561
7562 r13D84新增內容:路點系統。
7563 <target x> 為 -1 時使用路點系統,<target y> 表示路點id,路點格式參照waypoint.txt
7564
7565---------------------------------------
7566
7567*getguildmember <guild id>,{<類型>};
7568 作用: 該命令會得到如下信息的數列:
7569 $@guildmembername$[] 所有工會成員的名字(如果type不為1、2、3)。
7570 $@guildmembercid[] 所有工會成員的CID(角色id)(如果type為1)。
7571 $@guildmemberaid[] 所有工會成員的AID(賬號id)(如果type為2)。
7572 $@guildiplist$[] 所有在線工會成員的ip(如果type為3)。
7573 $@guildipcount 工會在線ip數量(如果type為3)。
7574 $@guildonlinecount 工會在線成員數量(如果type為3)。
7575 $@guildmembercount 工會成員數量(包括不在線)。
7576
7577---------------------------------------
7578
7579*getguildallies <guild id>;
7580 作用: 該命令會得到如下信息的數列:
7581 $@guildidallies[] 所有同盟公會的公會id。
7582 $@guildalliescount 同盟公會數量。
7583
7584---------------------------------------
7585
7586*buildbarricade, killbarricade
7587 buildbarricade("<地圖名>",<坐標x>,<坐標y>,"<顯示名>",<size>,<dir>,<killable>,<walkable>,<shootable>,<odd>,"<事件標籤>")
7588 dir從正北(上)開始逆時針方向分別為0~7,size表示路障在所給坐標的某方向上擴展多少格,odd如果為1表示在奇數格子內顯示路障,如果為0,則表示在偶數格內顯示路障。
7589 killable表示是否能被攻擊,walkable表示是否能行走穿過,shootable表示是否能穿過路障攻擊或飛躍。他們的值皆為0或1。
7590
7591---------------------------------------
7592
7593*getbattlestatus <id>,<類型>
7594
7595 ID為GID,即玩家時為AID。
7596
7597 類型:
7598 1:str總值 2:agi總值 3:vit總值 4:int總值 5:dex總值
7599 6:luk總值 7:hp 8:maxhp 9:sp 10:maxsp
7600 11:左atk 12:左matk 13:右matk 14:移動速度 15:amotion
7601 16:adelay 17:dmotion 18:hit 19:flee 20:cri
7602 21:flee2 22:屬性def 23:屬性mdef 24:攻擊速度倍率25:屬性
7603 26:屬性等級 27:裝備def 28:裝備mdef 29:右手武器atk 30:右手精煉atk
7604 31:右手武器屬性32:右手武器距離33:左手武器atk 34:左右精煉atk 35:左右武器屬性
7605 36:左手武器距離37:卡片atk 38:裝備matk
7606
7607 id或類型錯誤時,返回-1。
7608
7609---------------------------------------
7610
7611*sc_check <類型>{,<gid>}
7612
7613 返回-1:找不到該角色。
7614 返回0:沒有該狀態。
7615 返回1:有該狀態,並賦予下列變量值,變量意義自我解釋,時間為-1表示無限。
7616 @sc_val1, @sc_val2, @sc_val3, @sc_val4, @sc_tickleft
7617
7618---------------------------------------
7619
7620*script4each "<腳本>",<類型>{,...}
7621
7622 類型0:全服:script4each "<腳本>",0;
7623 類型1:全地圖:script4each "<腳本>",1,"地圖名";
7624 類型2:全區域:script4each "<腳本>",2,"地圖名",坐標x,坐標y,範圍;
7625 類型3:全組隊:script4each "<腳本>",3,玩家cid;
7626 類型4:全公會:script4each "<腳本>",4,玩家cid;
7627 類型5:全陣營:script4each "<腳本>",5,玩家cid;
7628 類型6:全區域:script4each "<腳本>",6,"地圖名",坐標x0,坐標y0,坐標x1,坐標y1;
7629 類型7:全組隊:script4each "<腳本>",7,隊伍id;
7630 類型8:全公會:script4each "<腳本>",8,公會id;
7631 類型9:全陣營:script4each "<腳本>",9,陣營id;
7632
7633---------------------------------------
7634
7635*script4eachmob "<腳本>",<類型>{,...}
7636
7637 該命令僅支持setmobdata指令,setmobdata指令中的魔物GID請用變量「$@4eachmobgid」代替。
7638
7639 類型0:全服:script4eachmob "<腳本>",0;
7640 類型1:全地圖:script4eachmob "<腳本>",1,"地圖名";
7641 類型2:全區域:script4eachmob "<腳本>",2,"地圖名",坐標x0,坐標y0,坐標x1,坐標y1;
7642 類型5:全陣營:script4eachmob "<腳本>",3,陣營編號;
7643
7644---------------------------------------
7645
7646*script4eachnpc "<腳本>",<類型>{,...}
7647
7648 該命令賦予變量「$@4eachnpcgid」代替。
7649
7650 類型0:全服:script4eachnpc "<腳本>",0;
7651 類型1:全地圖:script4eachnpc "<腳本>",1,"地圖名";
7652 類型2:全區域:script4eachnpc "<腳本>",2,"地圖名",坐標x0,坐標y0,坐標x1,坐標y1;
7653
7654---------------------------------------
7655
7656*noovercharge <id>{,<標識>}
7657*nodiscount <id>{,<標識>}
7658
7659 標識0:關閉
7660 標識1:打開
7661 未指定默認1。
7662
7663---------------------------------------
7664
7665*checkalliance <公會id>
7666
7667 返回1: 與此公會同盟
7668 返回0: 與此公會無關
7669 返回-1: 其他錯誤
7670
7671---------------------------------------
7672
7673*status_calc
7674
7675舉例: {
7676OnPCSCEndEvent:
7677OnPCSCStartEvent:
7678 status_calc();
7679 end;
7680OnPCStatCalcEvent:
7681 if(sc_check(SC_EDP))
7682 {
7683 bonus2 bSkillAtk,"GC_CROSSIMPACT",200;
7684 bonus2 bSkillAtk,"GC_COUNTERSLASH",200;
7685 bonus2 bSkillAtk,"AS_SONICBLOW",200;
7686 bonus2 bSkillAtk,"ASC_BREAKER",200;
7687 }
7688}
7689
7690作用:致命吐毒對上述技能傷害翻倍。
7691
7692---------------------------------------
7693
7694*setaura <id>{,<週期>{,<id2>}{,<id3>}}
7695
7696作用:設置光環效果。
7697id在effect_list.txt中查看。
7698週期毫秒記。0為不重複。
7699所有id共享同一週期。
7700
7701---------------------------------------
7702
7703*settitle <id>
7704
7705作用:設置稱號編碼。客戶端設置在lua files/datainfo/title_table.lua
7706
7707---------------------------------------
7708
7709*setnoks <gid>,<類型>
7710
7711 gid: 魔物id
7712 type: 0 - 關閉。1 - 自己。2 - 組隊。 3 - 公會。
7713
7714作用:@noks的腳本指令版。設置不能被搶怪。
7715
7716---------------------------------------
7717
7718*processhalt;
7719
7720作用: 在On*Event事件中終止後續運行。
7721 支持以下事件:
7722 OnPCUseSkillEvent
7723 OnNPCDropItemEvent
7724 OnPCUseItemEvent
7725 OnPCEquipItemEvent
7726 OnPCUnequipItemEvent
7727 OnPCRemoveMapEvent
7728 OnPCMoveEvent
7729 OnPlayerInSight
7730 OnPCRouletteOpenEvent
7731 OnPCTitleChangeEvent
7732 OnPCPetCatchEvent
7733 OnPCInsertCardEvent
7734 OnPetLootItemEvent
7735 OnBGQRegEvent
7736 OnBGQLeaveEvent
7737
7738 支持阻止道具消耗。見checkweight
7739
7740---------------------------------------
7741
7742*viewequip <Aid>{,<flag>};
7743
7744作用: 查看賬號id為Aid的角色的裝備。
7745 flag不為0時強制觀看,否則要符合玩家的意願或為GM。
7746
7747---------------------------------------
7748
7749*usecard <位置>
7750
7751作用:彈出卡片插入時選擇裝備的框。位置是卡片在物品欄裡的位置。
7752
7753---------------------------------------
7754
7755*create_player "姓名", 職業ID, 性別, "地圖名", x坐標, y坐標, 髮型, 髮色, 衣服顏色;
7756
7757作用: 創造玩家。返回AID。
7758
7759---------------------------------------
7760
7761*create_vender AID, "招牌";
7762
7763作用: 將給於AID的角色根據掛機重載的內容創造露天商店。
7764
7765---------------------------------------
7766
7767*cartgetitem2 "<Item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
7768
7769作用: 在手推車中得到物品,基本同getitem2.
7770
7771---------------------------------------
7772
7773*return2egg();
7774
7775作用: 把寵物收起變成蛋。返回0,失敗;返回1,成功。
7776
7777---------------------------------------
7778
7779*addshopentry("<NPC名>",<位置>,<id>,<價格>);
7780
7781作用: 對商店或金錢商店的npc,添加販賣道具。
7782說明: 位置從0開始。
7783
7784---------------------------------------
7785
7786*removeshopentry("<NPC名>",<id>);
7787
7788作用: 對商店或金錢商店的npc,刪除id道具的販賣。
7789
7790---------------------------------------
7791
7792*setshopentry("<NPC名>",<id>,<price>);
7793
7794作用: 對商店或金錢商店的npc,設置id道具的價格。
7795
7796---------------------------------------
7797
7798*setcashpoints("<NPC名>","<變量名>");
7799*setfreepoints("<NPC名>","<變量名>");
7800
7801作用: 使指定npc使用指定變量為cashshop變量。
7802
7803也可以使用cashshop(變量名)來定義cashshop
7804例如:
7805 - cashshop(#賬號變量) Inkfish -1,501:1;
7806
7807---------------------------------------
7808
7809*setmobdrop 魔物id,掉落序號,掉率{,道具id};
7810
7811作用: 指定魔物指定序號的掉落物品及其掉落率,絕對值,不乘以服務器倍率,但是會乘等級加成(若開啟)。
7812
7813---------------------------------------
7814
7815*checkidle({<AID>});
7816
7817作用: 返回當前角色或指定AID角色是否為呆滯狀態。需設置party.conf中的idle_no_share。
7818
7819結果: 1:呆滯。0:活躍。-1:角色不存在。
7820
7821---------------------------------------
7822
7823*set_hotkey <位置>,<類型>,<ID>,<等級>;
7824
7825作用: 設置快捷鍵。位置:從0-37。類型:0表示道具,1表示技能。ID:表示物品或技能ID。等級:表示技能等級。
7826 *快捷鍵只有重新登錄才會顯示。
7827
7828---------------------------------------
7829
7830*get_hotkey <位置>,<種類>;
7831
7832作用: 返回"位置"的快捷鍵。種類:0表示類型,1表示ID,2表示等級。
7833 類型見set_hotkey;
7834
7835---------------------------------------
7836
7837*lock_hotkey <位置>,<0/1>;
7838
7839作用: 鎖定指定位置的快捷鍵。
7840 *客戶端顯示無法鎖定,但實際效果鎖定,重新登錄會復原。
7841
7842---------------------------------------
7843
7844*npcskill <技能id>,<技能等級>,<屬性點>,<基本等級>;
7845*npcskill "<技能名>",<技能等級>,<屬性點>,<基本等級>;
7846
7847作用: 讓npc對關聯玩家使用技能,如果是地面技能則最玩家位置使用。
7848 npc6個屬性點將被賦予相同的值。
7849
7850---------------------------------------
7851
7852*freeloop <標記>
7853
7854作用: 標記為0則解除,其他則無視script_athena.conf中設置的check_cmdcount和check_gotocount
7855
7856---------------------------------------
7857
7858*party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
7859
7860Organizes a party with the attached or specified character as leader. If
7861successful, the command returns 1 and sets the global temporary variable
7862"$@party_create_id" to the ID of the party created.
7863注意,$@party_create_id「不」在隊伍創建之後立即生成,生成速度取決於地圖
7864服務器與角色服務器對話速度。
7865
7866Additionally, item sharing options can be provided:
7867 - Item Share: 0-Each Take (default), 1-Party Share
7868 - Item Share Type: 0-Each Take (default), 1-Even Share
7869
7870These values are returned upon failure:
7871 0: Unknown error.
7872-1: Player not found.
7873-2: Player already has a party.
7874-3: Party name exists.
7875
7876---------------------------------------
7877
7878*party_destroy(<party id>);
7879
7880Disbands a party. The command returns 1 upon success and 0 upon failure.
7881
7882---------------------------------------
7883
7884*party_addmember(<party id>,<character id>);
7885
7886Adds a player to an existing party.
7887
7888The command returns 1 upon success, and these values upon failure:
7889 0: Unknown error.
7890-1: Player not found.
7891-2: Player already has a party.
7892-3: Party not found.
7893-4: Party is full.
7894
7895---------------------------------------
7896
7897*party_delmember({<character id>,<party id>});
7898
7899Removes a player from his/her party. If no player is specified, the command
7900will run for the invoking player. If that player is the only party member
7901remaining, the party will be disbanded.
7902
7903The command returns 1 upon success, and these values upon failure:
7904 0: Unknown error.
7905-1: Player not found.
7906-2: Party not found.
7907-3: Player is not in the party.
7908
7909---------------------------------------
7910
7911*party_changeleader(<party id>,<character id>);
7912
7913Transfers leadership of a party to the specified character.
7914
7915The command returns 1 upon success, and these values upon failure:
7916 0: Unknown error.
7917-1: Party not found.
7918-2: Player not found.
7919-3: Player is not in the party.
7920-4: Player is already party leader.
7921
7922---------------------------------------
7923
7924*party_changeoption(<party id>,<option>,<flag>);
7925
7926Changes a party option.
7927
7928Valid options are:
7929 0 - Exp Share (flags: 0-Each Take, 1-Even Share)
7930 1 - Item Share (flags: 0-Each Take, 1-Party Share)
7931 2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
7932
7933The command returns 1 upon success, and these values upon failure:
7934 0: Invalid option.
7935-1: Party not found.
7936
7937---------------------------------------
7938
7939*getfamename(類型,排名)
7940*getfame(類型,排名)
7941
7942類型:0:鐵匠,1:煉金,2:跆拳
7943排名:0-9表示1~10名
7944
7945getfamename顯示名字,getfame顯示聲望值
7946
7947---------------------------------------
7948
7949*nochangeemblem 類型
7950
7951類型:0:全服可以更換公會圖標
7952類型:1:全服不可以更換公會圖標
7953
7954---------------------------------------
7955
7956*bind_next_getitem 類型
7957
7958類型:0關閉,1賬號綁定,3角色綁定,5賬號綁定但可以賣NPC,7角色綁定但可以賣NPC
7959打開後,下一個得到的物品將綁定,不論是通過getitem,getitem2,還是拾取的物品都會綁定。
7960僅下一次有效。得到綁定物品後即關閉。
7961
7962---------------------------------------
7963
7964*clearflooritem <GID>
7965
7966清楚地面GID的道具。
7967
7968---------------------------------------
7969
7970*showscript "消息"{,<GID>}
7971
7972在指定對像頭上顯示消息,不包含對像名字。
7973
7974GID如果未指定或指定對像不存在,則在腳本關聯對像頭上顯示,如果腳本未關聯對象,則顯示在
7975NPC頭上。
7976
7977---------------------------------------
7978
7979bg_queue_enter "戰場名","地圖名",隊伍1坐標x,隊伍1坐標y,"隊伍1登出事件","隊伍1死亡事件",隊伍2坐標x,隊伍2坐標y,"隊伍2登出事件","隊伍2死亡事件";
7980
7981該語句放在createbgqueue的事件中,將給隊列中的玩家創建戰場。
7982戰場名必須與客戶端顯示的完全一致,這是整個系統的唯一標籤。
7983戰隊1的戰場id將會保存在$@arenabgid1變量中;
7984戰隊2的戰場id將會保存在$@arenabgid2變量中;
7985
7986---------------------------------------
7987
7988createbgqueue "戰場名",人數,最小等級,最大等級,"事件";
7989
7990創建戰場隊列,一般在OnInit中使用。
7991戰場名必須與客戶端顯示的完全一致,這是整個系統的唯一標籤。
7992事件為隊列滿足設定人數條件後運行的事件。
7993
7994---------------------------------------
7995
7996resetbgqueue "戰場名";
7997
7998重新允許隊列進入允許排隊狀態,戰場結束時使用。
7999
8000---------------------------------------
8001
8002statuschangemapchange;
8003
8004地圖轉換時重新計算人物裝備屬性,一般用來刷新有地圖限制的裝備特效。
8005
8006---------------------------------------
8007
8008*getmobposition(<GID>,"<地圖名變量>",<x坐標>,<y坐標>)
8009
8010This function will locate 魔物 coordinates
8011and place their coordinates into the variables specified when calling it. It
8012will return 0 if the search was successful, and -1 if the parameters given were
8013not variables or the search was not successful.
8014
8015---------------------------------------
8016
8017*next_autocast_check_condition{ <參數>};
8018
8019在itemdb使用該指令後,下一個autospell的bonus將在發動時檢查氣彈,物品需求等狀態。僅一次有效。
8020不指定參數則默認1
8021參數:
8022 1: 檢查消耗物品
8023 2: 檢查最大可用數量
8024 4: 檢查狀態(skill_require_db中的手推車,老鷹等的欄位)
8025 8: 檢查skill_nocast_db中的項目。(包括冷卻時間)
8026 16: 不檢查地面技能的UF_NOREITERATION。
8027 32: 不消耗氣彈、Zeny、HP
8028 64: 不消耗物品
8029
8030---------------------------------------
8031
8032* openDressroom;
8033 closeDressroom;
8034
8035打開關閉試衣間。
8036
8037---------------------------------------
8038
8039* showeffect <SI>,<值>,<開關>;
8040
8041顯示/關閉頭飾效果。
8042
8043---------------------------------------
8044
8045* sit {"名字"};
8046* stand {"名字"};
8047
8048讓玩家站起/坐下的指令,不指定姓名則為關聯玩家
8049
8050---------------------------------------
8051
8052* unit_setdir <GID>,<方向>;
8053
8054讓指定對像改變方向。
8055
8056---------------------------------------
8057
8058* getattachment;
8059
8060獲取關聯玩家的所有郵件中的道具和zeny。
8061
8062返回:
8063 0:全部成功
8064 1: 其中有一個郵件的zeny超過限額。
8065 2: 其中有一個郵件的道具不存在。
8066 3: 身上沒有空位。
8067 4: 身上沒有足夠負重。
8068
8069---------------------------------------
8070
8071* clearcooldown{ <技能id>};
8072
8073技能不設,則清空所有。注意,是不設,不是為0。
8074
8075---------------------------------------
8076
8077* gettimetick_date(<年>,<月>,<日>,<時>,<分>,<秒>);
8078
8079獲取指定日期的timetick。
8080例:
8081 rentitem 2115,gettimetick_date(2017,7,21,15,0,0)-gettimetick(2);
8082 獲取巴基力盾,過期時間為2017年7月21日15點。
8083
8084---------------------------------------
8085
8086* gettimetick_nextday(<日>,<時>);
8087
8088獲取過幾天的幾點時刻的timetick。
8089例:
8090 rentitem 2115,gettimetick_nextday(2,21)-gettimetick(2);
8091 獲取巴基力盾,過期時間為兩天後的晚上9點。
8092
8093---------------------------------------
8094
8095* gettimetick_nextweek(<幾次>,<周幾>,<時>);
8096
8097獲取過今天之後第幾個的星期幾的幾點時刻的timetick。
8098例:
8099 rentitem 2115,gettimetick_nextweek(1,1,0)-gettimetick(2);
8100 獲取巴基力盾,過期時間為第一個星期一凌晨0點。
8101
8102---------------------------------------
8103
8104* channel_create("<名字>","<密碼>",<顏色>,<延遲>)
8105
8106創建名字為"名字"的頻道,創建之後,可以在密語框裡輸入「#名字」以在頻道中發言。
8107顏色:(下面是舉例,請用16進制數字,不要用文字)
8108 白色: "0xffffff"
8109 紅色: "0xff0000"
8110 深藍: "0x83cfe9"
8111 橙色: "0xe57c00"
8112 天藍: "0x00b89d"
8113 黃色: "0xffff90"
8114 墨綠: "0x28bf00"
8115 綠色: "0x00ff00"
8116延遲:為每句話之間的間隔。
8117
8118返回1創建成功,返回0創建失敗,返回2已存在。
8119
8120---------------------------------------
8121
8122* channel_destroy("<名字>")
8123
8124關閉頻道。
8125
8126---------------------------------------
8127
8128* channel_join("<名字>","密碼")
8129
8130加入頻道
8131
8132---------------------------------------
8133
8134* channel_leave("<名字>")
8135
8136離開頻道
8137
8138---------------------------------------
8139
8140* channel_bind()
8141
8142綁定頻道,不用在密語框輸入頻道名字就可以在該頻道發言。
8143
8144---------------------------------------
8145
8146* channel_unbind("<名字>")
8147
8148解除綁定頻道
8149
8150---------------------------------------
8151
8152* channel_bindname("<名字1>","<名字2>")
8153
8154綁定頻道名,綁定後可以在密聊框使用名字1,在名字2的頻道發言。
8155名字1是玩家獨立,而名字2是服務器獨立。
8156因此,不同玩家可以使用同樣的名字1,而在不同的頻道發言。
8157
8158---------------------------------------
8159
8160* identify {<類型>};
8161
8162對已鑒定物品進行強制操作。該指令會在雙擊列表中物品後,觸發OnPCIdentifyEvent事件,而不會真的鑒定物品。
8163類型是item_db裡的物品類型,設置後只有該類型的物品會顯示在列表裡。
8164
8165---------------------------------------
8166
8167* rndopt_next_getitem <位置>,<類型>{,<參數>},<值1>,<值2>
8168
8169對getitem, rentitem, makeitem, getitem2, rentequip, makeitem2等腳本指令,以及技能創造道具有效
8170位置是0-4(即1-5個隨機槽)
8171類型為bonus類型。
8172客戶端支持值1最大32767,值2最大255。
8173
8174注意:
8175此指令只能識別<類型>或<類型+參數>用來區分的ID,無法識別<類型+值2>用來區分的ID
8176
8177如果要運行bonus3 <類型>,<參數>,<值1>,<值2>;
8178請設置:rndopt_next_getitem <位置>,<類型>,<參數>,<值1>,<值2>;
8179<值1>,<值2>都不為0
8180
8181如果要運行bonus2 <類型>,<參數>,<值1>;
8182請設置:rndopt_next_getitem <位置>,<類型>,<參數>,<值1>,<值2>;
8183<值1>不為0,<值2>為0
8184
8185如果要運行bonus <類型>,<參數>;
8186請設置:rndopt_next_getitem <位置>,<類型>,<參數>,<值1>,<值2>;
8187<值1>為0,<值2>無意義
8188
8189如果要運行bonus2 <類型>,<值1>,<值2>;
8190請設置:rndopt_next_getitem <位置>,<類型>,<值1>,<值2>;
8191<值2>不為0
8192
8193如果要運行bonus <類型>,<值1>;
8194請設置:rndopt_next_getitem <位置>,<類型>,<值1>,<值2>;
8195<值2>為0
8196
8197舉例1:
8198 rndopt_next_getitem 0,bMaxHp,10,0;
8199 rndopt_next_getitem 1,bSubEle,Ele_Ghost,10,0;
8200 客戶端設置第1條為MaxHp +%d
8201 客戶端設置第33條為對念屬性攻擊傷害減少 %d
8202 item_random_option.txt設置1,bMaxHp
8203 item_random_option.txt設置33,bSubEle,Ele_Ghost
8204 效果等同於{ bonus bMaxHp,10; bonus2 bSubEle,Ele_Ghost,10; }客戶端也會正常顯示
8205 如果item_random_option.txt沒有設置bMaxHp或bSubEle,Ele_Ghost對應的客戶端條目位置,則相應的腳本不會生效。
8206
8207舉例2:
8208 rndopt_next_getitem 0,bGetZenyNum,100,1;
8209 在item_random_option設置為x,bGetZenyNum時(x為任意id,是否可以顯示不再此次討論範圍)將運行:
8210 bonus2 bGetZenyNum,100,1;
8211
8212舉例3:
8213 rndopt_next_getitem 0,bSubEle,Ele_Earth,20,BF_LONG;
8214 在item_random_option設置為x,bSubEle,Ele_Earth時(x為任意id,是否可以顯示不再此次討論範圍)將運行:
8215 bonus3 bSubEle,Ele_Earth,20,BF_LONG;
8216
8217---------------------------------------
8218
8219* getguildalliance <公會ID1>, <公會ID2>;
8220
8221敵對返回2,同盟返回1,否則返回0.
8222
8223---------------------------------------
8224
8225* jobcanentermap "<地圖名>"{, <職業ID>};
8226
8227所給的職業ID能否進入地圖。不給職業ID則是關聯玩家。
8228返回1可以,0不可以。
8229
8230---------------------------------------
8231
8232*getmercinfo(<類型>{,<角色ID>});
8233
8234Retrieves information about mercenary of the currently attached
8235character. If char id is given, the information of that character is
8236retrieved instead. Type specifies what information to retrieve and
8237can be one of the following:
8238
8239 0 - Mercenary ID
8240 1 - Mercenary Class
8241 2 - Mercenary Name
8242 3 - Mercenary faith value for this mercenary's guild, if any
8243 4 - Mercenary calls value for this mercenary's guild, if any
8244 5 - Mercenary kill count
8245 6 - Mercenary remaining life time in msec
8246 7 - Mercenary level
8247 8 - GID
8248
8249If the character does not have a mercenary, the command returns ""
8250for name and 0 for all other types.
8251
8252---------------------------------------
8253
8254* isequippable(道具ID, 職業ID)
8255
8256返回1可以裝備,0無法裝備
8257
8258---------------------------------------
8259
8260* changecharsex
8261
8262改變角色的性別,而不是賬號的。會根據當前登陸角色的性別自動判定。
8263
8264---------------------------------------
8265
8266* changeemail "舊email", "新email";
8267
8268返回-1如果新舊相同。
8269返回-2如果使用了初始email a@a.com
8270返回-3如果新郵件格式不正確
8271返回-4如果舊郵件格式不正確
8272返回1如果舊郵件輸入與當前不符
8273返回0發送至login
8274
8275注意:請檢查字符長度,大於40個的會被捨去
8276
8277---------------------------------------
8278
8279* changebirthdate "舊生日", "新生日";
8280
8281返回-1如果新舊相同。
8282返回-2如果使用了初始0000-00-00
8283返回-3如果新生日格式不正確
8284返回1如果舊生日輸入與當前不符
8285返回0發送至login
8286
8287---------------------------------------
8288
8289* changepassword "email", "生日","新密碼";
8290
8291返回-1如果密碼小於4個字符。
8292返回-2如果生日格式不正確
8293返回-3如果郵件格式不正確
8294返回1如果生日輸入與當前不符
8295返回2如果郵件輸入與當前不符
8296返回0發送至login
8297
8298注意:請檢查字符長度,大於33個的會被捨去
8299
8300---------------------------------------
8301
8302* changelevel 等級{,標籤};
8303
8304改變GM等級
8305標籤為1時為永久有效。
8306
8307---------------------------------------
8308
8309* setequipbind <裝備位置>{,<值>}
8310
8311設置裝備的綁定值,默認1。
8312
8313---------------------------------------
8314
8315* getbinditem <道具ID>,<數量>{,<綁定值>{,<角色ID>}}
8316
8317得到綁定的裝備,綁定值默認1。
8318
8319---------------------------------------
8320
8321* getequipindex <裝備位置>
8322
8323返回在物品欄的索引序號。
8324
8325---------------------------------------
8326
8327* setequipflag <編號>
8328
8329有效編號為,0 : 右手;1:左手;2:彈藥
8330
8331一般使用在itembonus中以明確該bonus為哪個位置。
8332不設置則默認右手。
8333運行過程中所有bonus遵循上一個設置。
8334整個itembonus運行結束會自動清0。
8335
8336---------------------------------------
8337
8338============================
8339|15.- 成就系統指令.|
8340============================
8341---------------------------------------
8342
8343*achievementadd(<成就ID>{,<角色ID>})
8344
8345該指令會給關聯角色或指定 <角色ID>添加一個成就目標. The objective requirements are not ignored
8346when using this function.
8347成功返回1,失敗返回0.
8348
8349---------------------------------------
8350
8351*achievementremove(<成就ID>{,<角色ID>})
8352
8353該指令會給關聯角色或指定 <角色ID>去除一個成就目標.
8354player or the supplied <角色ID>.
8355成功返回1,失敗返回0.
8356
8357---------------------------------------
8358
8359*achievementinfo(<成就ID>,<類型>{,<角色ID>})
8360
8361該函數會返回關聯角色或指定 <角色ID>的指定 <類型> 的成就。
8362如果玩家沒有激活該成就或成就不存在,返回-1.
8363其他諸如類型錯誤,返回-2.
8364
8365有效類型:
8366- ACHIEVEINFO_COUNT1
8367- ACHIEVEINFO_COUNT2
8368- ACHIEVEINFO_COUNT3
8369- ACHIEVEINFO_COUNT4
8370- ACHIEVEINFO_COUNT5
8371- ACHIEVEINFO_COUNT6
8372- ACHIEVEINFO_COUNT7
8373- ACHIEVEINFO_COUNT8
8374- ACHIEVEINFO_COUNT9
8375- ACHIEVEINFO_COUNT10
8376- ACHIEVEINFO_COMPLETE
8377- ACHIEVEINFO_COMPLETEDATE
8378- ACHIEVEINFO_GOTREWARD
8379- ACHIEVEINFO_LEVEL (<成就ID> 對此無效)
8380- ACHIEVEINFO_SCORE (<成就ID> 對此無效)
8381
8382---------------------------------------
8383
8384*achievementcomplete(<成就ID>{,<角色ID>})
8385
8386該指令會給關聯角色或指定 <角色ID>完成一個成就目標. The objective requirements are ignored
8387when using this function.
8388成功返回1,失敗返回0.
8389
8390---------------------------------------
8391
8392*achievementexists(<成就ID>{,<角色ID>});
8393
8394該指令會給關聯角色或指定 <角色ID>是否存在此成就目標.
8395成功返回1,失敗返回0.
8396
8397---------------------------------------
8398
8399*achievementupdate(<類型>{,<參數1>{,<參數2>{,<參數3>{,<參數4>{,<參數5>}}}}});
8400
8401該指令會傳遞參數以檢查條件(condition)該類型中所有成就是否可以完成。
8402成功返回1,失敗返回0.
8403
8404例如:
8405 achievementupdate(AG_SEE,1);
8406 這條指令將劃掉110001的第一個條件,以示完成。
8407
8408 achievementupdate(AG_SEE,127);
8409 這條指令將劃掉110001的所有條件,並完成成就。
8410注1:以上示例基於默認DB。
8411
8412注2:achievementupdate將對所有該<類型>的成就進行檢測,不限於某個成就ID。
8413
8414---------------------------------------
8415
8416*achievementsetcount(<成就ID>,<項>,<數量>)
8417
8418該指令可以設置指定成就指定項的數量
8419項為0-9。
8420如果成就沒有在玩家數據庫中,腳本會終止。
8421
8422---------------------------------------
8423
8424*resetmymob;
8425
8426對當前NPC用monster, areamonster, campmob, summon, mobspawn等指令召喚的魔物,
8427執行等同於killmonster效果的指令,魔物不會掉落物品,觸發事件,給予經驗。
8428
8429---------------------------------------
8430
8431*countmymob();
8432
8433返回當前NPC用monster, areamonster, campmob, summon, mobspawn等指令召喚的魔物數量。
8434
8435---------------------------------------
8436
8437*navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
8438
8439Generates a navigation for attached or specified character. Requires client
84402011-10-10aRagEXE or newer.
8441
8442The flag specifies how the client will calculate the specific route.
8443
8444Valid flags are:
8445 NAV_NONE - No services
8446 NAV_AIRSHIP_ONLY - Airship only
8447 NAV_SCROLL_ONLY - Scroll only
8448 NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
8449 NAV_KAFRA_ONLY - Kafra only
8450 NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
8451 NAV_KAFRA_AND_SCROLL - Kafra and Scroll
8452 NAV_ALL - All services
8453
8454When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
8455
8456The hide_window specifies whether to display (0) or hide (1) the navigation window.
8457By default the window is hidden.
8458
8459You can specify the monster_id in combination with a mapname to make the
8460navigation system tell you, that you have reached the desired mob.
8461
8462Note:
8463The client requires custom monster spawns be in the navigation file
8464for using the embedded client Navigation feature to work properly. In this
8465instance sending the player to the map where the monster spawns is a simpler
8466solution rather than sending the map and the monster_id.
8467
8468---------------------------------------
8469
8470*getrandgroupitem <group_id>{,<quantity>{,<sub_group>{,<identify>{,<char_id>}}}};
8471
8472Similar to the above example, this command allows players to obtain the specified
8473quantity of a random item from the group "<group id>". The different groups and
8474their group number are specified in db/(pre-)re/item_group_db.txt
8475
8476If 'quantity' is not defined or 0, it will uses defined amount from Item Group list.
8477
8478If 'sub_group' is not defined the value will be 1 (since random group is 1 ~ 5, and 0 is
8479'must' item group).
8480
8481For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
8482as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
8483if 'identify' is defined with value 1.
8484
8485More info, see doc/item_group.txt.
8486
8487---------------------------------------
8488
8489*getgroupitem <group_id>{,<identify>{,<char_id>}};
8490
8491Gives item(s) to the attached player based on item group contents.
8492This is not working like 'getrandgroupitem' which only give 1 item for specified
8493item group & sub_group.
8494
8495For item with type IT_WEAPON, IT_ARMOR, IT_PETARMOR, and IT_SHADOWGEAR will be given
8496as unidentified item (as defined by itemdb_isidentified in src/map/itemdb.cpp) except
8497if 'identify' is defined with value 1.
8498
8499More info, see doc/item_group.txt.
8500
8501---------------------------------------
8502
8503* getrandomoptinfo <參數>
8504
8505參數:1: val1。2: val2。0: id。
8506
8507---------------------------------------
8508
8509* getmobspawntime <GID>
8510
8511參數:1: val1。2: val2。0: id。
8512
8513---------------------------------------
8514
8515*getvar <變量>,<角色ID>;
8516
8517Get variable value from the specified player. Only player/account variables
8518are allowed to be used (temporary character variable "@", permanent
8519character "", permanent local account "#", and permanent global account "##").
8520
8521---------------------------------------
8522
8523LapineDdukddak_open <道具ID>
8524LapineDdukddak_result <參數>
8525
8526LapineDdukddak_open用來打開窗口,該窗口用來將多個物品組合成新的物品。
8527打開窗口後是否有道具在窗口內顯示可被拖曳為lua控制與服務端無關。
8528在窗口內拖曳道具並按確認後,交由服務端事件OnLapineDdukddakEvent處理,詳見doc/事件標籤.txt
8529
8530<參數>: 5 材料不夠;7 物品不在合成列表
8531
8532---------------------------------------
8533
8534LapineUpgrade_open <道具ID>
8535LapineUpgrade_result <道具位置>,<參數>
8536
8537LapineUpgrade_open用來打開窗口,該窗口用來給物品添加隨機屬性。
8538打開窗口後是否有道具在窗口內顯示可被拖曳為lua控制與服務端無關。
8539在窗口內拖曳道具並按確認後,交由服務端事件OnLapineDdukddakEvent處理,詳見doc/事件標籤.txt
8540
8541<道具位置> 道具在物品欄的位置
8542<參數>: 0 成功;1 失敗
8543
8544---------------------------------------
8545
8546* isdeadsit {<角色ID>}
8547
85481: 死亡。2:坐下
8549
8550---------------------------------------
8551
8552* guildopenstorage_log;
8553
8554顯示公會倉庫存取記錄。
8555最大245條,時間倒敘,如果角色未在線,則首次使用將顯示角色ID,再次使用時會顯示名字。
8556
8557---------------------------------------
8558
8559* guild_has_permission <參數>;
8560
8561返回玩家是否有公會權限,1為有權限,0為沒權限。
8562
8563參數:
8564 0x1加人
8565 0x10踢人
8566 0x100開倉庫
8567
8568---------------------------------------
8569
8570結束。