public class 0400_Player_Commands extends Object
========================= |0400.- Player commands.| =========================
| 构造器和说明 |
|---|
0400_Player_Commands() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
areawarp()
areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
This command is similar to 'warp', however, it will not refer to the invoking
character, but instead, all characters within a specified area, defined by the
x1/y1-x2/y2 square, will be warped.
|
void |
autobonus()
autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
These commands are meant to be used in item scripts.
|
void |
bonus_script_clear()
bonus_script_clear {<flag>,{<char_id>}};
Removes attached bonus_script from player.
|
void |
bonus_script()
bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
This command will attach a script to a player for a given duration, in seconds.
|
void |
bonus()
bonus <bonus type>,<val1>;
bonus2 <bonus type>,<val1>,<val2>;
bonus3 <bonus type>,<val1>,<val2>,<val3>;
bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
These commands are meant to be used in item scripts.
|
void |
changebase()
changebase <job ID number>{,<account ID>};
This command will change a character's appearance to that of the specified job
class.
|
void |
changecharsex()
changecharsex({<char_id>});
This command will change the gender of the attached character.
|
void |
changesex()
changesex({<char_id>});
This command will change the gender for the attached character's account.
|
void |
classchange()
classchange(<view id>{,"<NPC name>","<flag>"});
This command is very ancient, its origins are clouded in mystery.
|
void |
disguise()
disguise <Monster ID>{,<char_id>};
undisguise {<char_id>};
This command disguises the current player with a monster sprite.
|
void |
dispbottom()
dispbottom "<message>"{,<color>{,<char_id>}};
This command will send the given message with color into the invoking character's chat
window.
|
void |
eaclass()
eaclass({<job number>,<char_id>})
This commands returns the "eA job-number" corresponding to the given class, and
uses the invoking player's class if none is given.
|
void |
get_githash()
get_githash()
This command will return the Git Hash that the server is currently running on.
|
void |
get_revision()
get_revision()
This command will return the SVN revision number that the server is currently
running on.
|
void |
getexp()
getexp <base_exp>,<job_exp>{,<char_id>};
This command will give the invoking character a specified number of base and job
experience points.
|
void |
getexp2()
getexp2 <base_exp>,<job_exp>{,<char_id>};
This command is safety version of 'set' command for BaseExp and JobExp.
|
void |
getstatus()
getstatus(<effect type>{,<type>{,<char_id>}})
Retrieve information about a specific status effect when called.
|
void |
heal()
heal <hp>,<sp>{,<char_id>};
This command will heal a set amount of HP and/or SP on the invoking character.
|
void |
itemheal()
itemheal <hp>,<sp>{,<char_id>};
This command heals relative amounts of HP and/or SP on the invoking character.
|
void |
jobcanentermap()
jobcanentermap("<mapname>"{,<JobID>});
Return true if player (decided by job) can enter the map, false otherwise.
|
void |
jobchange()
jobchange <job number>{,<upper flag>,<char_id>};
This command will change the job class of the invoking character.
|
void |
jobname()
jobname(<job number>)
This command retrieves the name of the given job using the map_msg entries 550->655.
|
void |
mail()
mail <destination id>,"<sender name>","<title>","<body>"{,<zeny>{,<item id array>,<item amount array>{,<item card0 array>{,<item card1 array>{,<item card2 array>{,<item card3 array>
{,<random option id0 array>, <random option value0 array>, <random option paramter0 array>{,<random option id1 array>, <random option value1 array>, <random option paramter1 array>
{,<random option id2 array>, <random option value2 array>, <random option paramter2 array>{,<random option id3 array>, <random option value3 array>, <random option paramter3 array>
{,<random option id4 array>, <random option value4 array>, <random option paramter4 array>}}}}}}};
This command will send mail to the <destination id> which is a character ID.
|
void |
message()
message "<character name>","<message>";
That command will send a message to the chat window of the character specified
by name.
|
void |
needed_status_point()
needed_status_point(<type>,<val>{,<char id>});
Returns the number of stat points needed to change the specified stat <type> by <val>.
|
void |
npcskilleffect()
npcskilleffect <skill id>,<number>,<x>,<y>;
npcskilleffect "<skill name>",<number>,<x>,<y>;
This command behaves identically to 'skilleffect', however, the effect will not
be centered on the invoking character's sprite, nor on the NPC sprite, if any,
but will be centered at map coordinates given on the same map as the invoking
character.
|
void |
nude()
nude {<char_id>};
This command will unequip anything equipped on the invoking character.
|
void |
openauction()
openauction({<char_id>});
This will open the Auction window on the client connected to the invoking character.
|
void |
openmail()
openmail({<char_id>});
This will open a character's Mail window on the client connected to the
invoking character.
|
void |
openstorage()
openstorage;
This will open character's Kafra storage window on the client connected to the
invoking character.
|
void |
openstorage2()
openstorage2 <storage_id>,<mode>{,<account_id>};
Just like the 'openstorage' command, except this command can open additional storages
by the specified <storage_id>.
|
void |
pcblockmove()
pcblockmove <id>,<option>;
unitblockmove <id>,<option>;
Prevents the given GID from moving when the option is 1, and enables the ID to
move again when the option is 0.
|
void |
pcblockskill()
pcblockskill <id>,<option>;
unitblockskill <id>,<option>;
Prevents the given GID from casting skills when the option is 1, and enables
the ID to cast skills again when the option is 0.
|
void |
pcfollow()
pcfollow <id>,<target id>;
pcstopfollow <id>;
Makes a character follow or stop following someone.
|
void |
percentheal()
percentheal <hp>,<sp>{,<char_id>};
This command will heal the invoking character.
|
void |
pushpc()
pushpc <direction>,<cells>;
This command will push the currently attached player to given direction by given
amount of square cells.
|
void |
recalculatestat()
recalculatestat;
This command will force a stat recalculation for the attached player.
|
void |
recovery()
recovery <type>{,<option>,<revive_flag>{,<map name>}};
This command will revive and fully restore the HP/SP of the selected characters.
|
void |
resetlvl()
resetlvl <action type>{,<char_id>};
This is a character reset command, meant mostly for rebirth script supporting
Advanced jobs, which will reset the invoking character's stats and level
depending on the action type given.
|
void |
resetskill()
resetskill({<char_id>});
This command takes off all the skill points on the invoking character, so they
only have Basic Skill blanked out (lvl 0) left, and returns the points for them
to spend again.
|
void |
resetstatus()
resetstatus({<char_id>});
This is a character reset command, which will reset the stats on the invoking
character and give back all the stat points used to raise them previously.
|
void |
rid2name()
rid2name(<rid>)
Converts rid to name.
|
void |
roclass()
roclass(<job number>{,<gender>})
Does the opposite of eaclass.
|
void |
savepoint()
savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
These commands save where the invoking character will return to upon clicking
"Return to Save Point", after death and in some other cases.
|
void |
sc_start()
sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
sc_end <effect type>{,<GID>};
sc_end_class {<char_id>{,<job_id>}};
These commands will bestow a status effect on a character.
|
void |
setlook()
setlook <look type>,<look value>{,<char_id>};
changelook <look type>,<look value>{,<char_id>};
'setlook' will alter the look data for the invoking character.
|
void |
showscript()
showscript "<message>"{,<GID>, <flag>};
Makes attached player or GID says a message like shouting a skill name, the message
will be seen to everyone around but not in chat window.
|
void |
sit()
sit {"<character name>"};
stand {"<character name>"};
These commands will make a character sit or stand.
|
void |
skill()
skill <skill id>,<level>{,<flag>};
skill "<skill name>",<level>{,<flag>};
addtoskill <skill id>,<level>{,<flag>};
addtoskill "<skill name>",<level>{,<flag>};
These commands will give the invoking character a specified skill.
|
void |
skilleffect()
skilleffect <skill id>,<number>;
skilleffect "<skill name>",<number>;
This command displays visual and aural effects of given skill on currently
attached character.
|
void |
specialeffect()
specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
This command will display special effect with the given number, centered on the
specified NPCs coordinates, if any.
|
void |
specialeffect2()
specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
This command behaves identically to 'specialeffect', but the effect will be
centered on the invoking character's sprite.
|
void |
statusup()
statusup <stat>{,<char_id>};
This command will change a specified stat of the invoking character up by one
permanently.
|
void |
statusup2()
statusup2 <stat>,<amount>{,<char_id>};
This command will change a specified stat of the invoking character by the
specified amount permanently.
|
void |
transform()
transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
This command will turn a player into a monster for a given duration and can grant
a SC attribute effect while transformed.
|
void |
warp()
warp "<map name>",<x>,<y>{,<char id>};
This command will take the invoking character or <char id>, if specified, to the specified map, and if
wanted, specified coordinates too, but these can be random.
|
void |
warpguild()
warpguild "<map name>",<x>,<y>,<guild_id>;
Warps a guild to specified map and coordinate given the guild id, which you can get with
getcharid(2).
|
void |
warppartner()
warppartner("<map name>",<x>,<y>);
This function will find the invoking character's marriage partner, if any, and
warp them to the map and coordinates given.
|
void |
warpparty()
warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
Warps a party to specified map and coordinate given the party ID, which you can get with
getcharid(1).
|
rid2name(<rid>)
Converts rid to name. Note: The player/monster/NPC must be online/enabled.
Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
Note: rid2name may not produce correct character names since rid = account id.
It will return the current online character of the account only.
message "<character name>","<message>";
That command will send a message to the chat window of the character specified
by name. The text will also appear above the head of that character. It will not
be seen by anyone else.
dispbottom "<message>"{,<color>{,<char_id>}};
This command will send the given message with color into the invoking character's chat
window. The color format is in RGB (0xRRGGBB). The color is
by default green
showscript "<message>"{,<GID>, <flag>};
Makes attached player or GID says a message like shouting a skill name, the message
will be seen to everyone around but not in chat window.
flag: Specify target
AREA - Message is sent to players in the vicinity of the source (default).
SELF - Message is sent only to player attached.
warp "<map name>",<x>,<y>{,<char id>};
This command will take the invoking character or <char id>, if specified, to the specified map, and if
wanted, specified coordinates too, but these can be random.
warp "place",50,55;
This would take them to X 50 Y 55 on the map called "place". If your X and Y
coordinates land on an unwalkable map square, it will send the warped character
to a random place. Same will happen if they are both zero:
warp "place",0,0;
Notice that while warping people to coordinates 0,0 will normally get them into
a random place, it's not certain to always be so. Darned if I know where this is
actually coded, it might be that this happens because square 0,0 is unwalkable
on all official maps. If you're using custom maps, beware.
There are also three special 'map names' you can use.
"Random" will warp the player randomly on the current map.
"Save" and "SavePoint" will warp the player back to their save point.
areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
This command is similar to 'warp', however, it will not refer to the invoking
character, but instead, all characters within a specified area, defined by the
x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
including the activating character, if they are outside the area.
areawarp "place",10,10,120,120,"place2",150,150;
Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
shape, on the map called "place", will be affected, and warped to "place2" X 150
Y 150
areawarp "place",10,10,120,120,"place2",0,0;
By using ,0,0; as the destination coordinates it will take all the characters in
the affected area to a random set of co-ordinates on "place2".
areawarp "place",10,10,120,120,"place2",150,150,200,200;
By using the optional x4 and y4 parameters, the destination coordinates will be a
random place within the defined x3/y3-x4/y4 square.
Like 'warp', areawarp will also explicitly warp characters randomly into the
current map if you give the 'to map name' as "Random".
See also 'warp'.
warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>",<range x>,<range y>};
Warps a party to specified map and coordinate given the party ID, which you can get with
getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
You can use the following "map names" for special warping behavior:
Random: All party members are randomly warped in their current map (as if they
all used a fly wing)
SavePointAll: All party members are warped to their respective save point.
SavePoint: All party members are warped to the save point of the currently
attached player (will fail if there's no player attached).
Leader: All party members are warped to the leader's position. The leader must
be online and in the current map-server for this to work.
If you specify a from_mapname, 'warpparty' will only affect those on that map.
The <range x> and <range y> optional values allow for a randomization with the
player's warp point. The values will randomly add or subtract from the given <x>
and <y> coordinates.
Example:
mes "[Party Warper]";
mes "Here you go!";
close2;
.@party_id = getcharid(1);
warpparty "prontera",150,100,.@party_id;
close;
warpguild "<map name>",<x>,<y>,<guild_id>;
Warps a guild to specified map and coordinate given the guild id, which you can get with
getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
You can use the following "map names" for special warping behavior:
Random: All guild members are randomly warped in their current map (as if they
all used a fly wing)
SavePointAll: All guild members are warped to their respective save point.
SavePoint: All guild members are warped to the save point of the currently
attached player (will fail if there's no player attached).
Example:
warpguild "prontera",x,y,Guild_ID;
warppartner("<map name>",<x>,<y>);
This function will find the invoking character's marriage partner, if any, and
warp them to the map and coordinates given. It will return 1 upon success and
0 if the partner is not online, the character is not married, or if there's no
invoking character (no RID). 0,0 will, as usual, normally translate to random coordinates.
savepoint "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
save "<map name>",<x>,<y>{,{<range x>,<range y>,}<char_id>};
These commands save where the invoking character will return to upon clicking
"Return to Save Point", after death and in some other cases. The two versions are
equivalent. They ignore any and all mapflags, and can make a character respawn where
no teleportation is otherwise possible.
The <range x> and <range y> optional values allow for a randomization with the
player's save point. The values will randomly add or subtract from the given <x>
and <y> coordinates.
savepoint "place",350,75;
savepoint "place",350,75,2,2; // Randomly save the character between 348,73 and 352,77
heal <hp>,<sp>{,<char_id>};
This command will heal a set amount of HP and/or SP on the invoking character.
heal 30000,0; // This will heal 30,000 HP
heal 0,30000; // This will heal 30,000 SP
heal 300,300; // This will heal 300 HP and 300 SP
This command just alters the hit points and spell points of the invoking
character and produces no other output whatsoever.
itemheal <hp>,<sp>{,<char_id>};
This command heals relative amounts of HP and/or SP on the invoking character.
Unlike heal, this command is intended for use in item scripts. It applies
potion-related bonuses, such as alchemist ranking, cards, and status changes.
When used inside an NPC script, certain bonuses are omitted.
The command also applies a SP/VIT-related bonus:
heal = heal * [(100 + STATUS*2) / 100]
Example:
// If the player has 50 vit and no bonuses, this will heal
// anything from 200 to 300 HP and 5 SP
itemheal rand(100,150),5;
percentheal <hp>,<sp>{,<char_id>};
This command will heal the invoking character. It heals the character, but not
by a set value - it adds percent of their maximum HP/SP.
percentheal 100,0; // This will heal 100% HP
percentheal 0,100; // This will heal 100% SP
percentheal 50,50; // This will heal 50% HP and 50% SP
So the amount that this will heal will depend on the total amount of HP or SP
you have maximum. Like 'heal', this will not call up any animations or effects.
recovery <type>{,<option>,<revive_flag>{,<map name>}};
This command will revive and fully restore the HP/SP of the selected characters.
It returns 1 upon successful use.
<type> is the target, and determines the <option> parameter:
0: Player -> Character ID number
1: Party -> Party ID number
2: Guild -> Guild ID number
3: Map -> Map name (a string)
4: All -> None (takes <revive_flag> as option)
If no option is specified, the invoking player's character ID, party ID, guild ID,
or map will be used.
<revive_flag> determines the action:
1: Revive and heal all players (default)
2: Heal living players only
4: Revive dead players only
<map name> can optionally be used to define a single map to execute the command on
for types 1 (party) and 2 (guild).
Examples:
// Only revive characters in invoking party on map "morocc"
recovery 1,getcharid(1),4,"morocc";
// Fully heal (don't revive) all members of invoking character's guild
recovery 2,getcharid(2),2;
// Revive and fully heal everyone in map "prontera"
recovery 3,"prontera";
// Only revive all dead characters on server
recovery 4,4;
jobchange <job number>{,<upper flag>,<char_id>};
This command will change the job class of the invoking character.
jobchange 1; // This would change your player into a Swordman
jobchange 4002; // This would change your player into a Swordman High
This command does work with numbers, but you can also use job names. The full
list of job names and the numbers they correspond to can be found in
'src/map/script_constants.hpp'.
// This would change your player into a Swordman
jobchange Job_Swordman;
// This would change your player into a Swordman High
jobchange Job_Swordman_High;
'upper flag' can alternatively be used to specify the type of job one changes
to. For example, jobchange Job_Swordman,1; will change the character to a high
swordsman. The upper values are:
-1 (or when omitted): preserves the current job type.
0: Normal/standard classes
1: High/Advanced classes
2: Baby classes
This command will also set a permanent character-based variable
'jobchange_level' which will contain the job level at the time right before
changing jobs, which can be checked for later in scripts.
jobname(<job number>)
This command retrieves the name of the given job using the map_msg entries 550->655.
mes "[Kid]";
mes "I never thought I'd met a " + jobname(Class) + " here of all places.";
close;
eaclass({<job number>,<char_id>})
This commands returns the "eA job-number" corresponding to the given class, and
uses the invoking player's class if none is given. The eA job-number is also a
class number system, but it's one that comes with constants which make it easy
to convert among classes. The command will return -1 if you pass it a job number
which doesn't have an eA job-number equivalent.
roclass(<job number>{,<gender>})
Does the opposite of eaclass. That is, given an eA job-number, it returns the
corresponding RO class number. A gender is required because both Bard and Dancers
share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
gender if none is given (if no player is attached, male will be used by default).
The command will return -1 if there is no valid class to represent the specified
job (for example, if you try to get the baby version of a Taekwon class).
changebase <job ID number>{,<account ID>};
This command will change a character's appearance to that of the specified job
class. Nothing but appearance will change.
The command will run for the invoking character unless an account ID is given.
changebase Job_Novice; // Changes player to Novice sprite.
changebase Class; // Changes player back to default sprite.
classchange(<view id>{,"<NPC name>","<flag>"});
This command is very ancient, its origins are clouded in mystery.
It will send a 'display id change' packet to everyone in the immediate area of
the NPC object, which will supposedly make the NPC look like a different sprite,
an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
not persist (Which is odd, cause it would be relatively easy to make it do so)
and most importantly, will not work at all since this command was broken with
the introduction of advanced classes. The code is written with the assumption
that the lowest sprite IDs are the job sprites and the anything beyond them is
monster and NPC sprites, but since the advanced classes rolled in, they got the
ID numbers on the other end of the number pool where monster sprites float.
As a result it is currently impossible to call this command with a valid view
id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
run will actually just crash the client.
It could be a real gem if it can be gotten to actually do what it's supposed to
do, but this will only happen in a later SVN revision.
Empty <NPC name> means attached NPC.
Target for <flag>:
- bc_area : Sprite is sent to players in the vicinity of the source (default value).
- bc_self : Sprite is sent only to player attached.
changesex({<char_id>});
This command will change the gender for the attached character's account. If it
was male, it will become female, if it was female, it will become male. The
change will be written to the character server, the player will receive the
message: "Need disconnection to perform change-sex request..." and the player
will be immediately kicked to the login screen. When they log back in, they will
be the opposite sex.
If there are any Dancer/Gypsy or Bard/Clown characters on the account,
they will also have their skills reset upon 'changesex'.
changecharsex({<char_id>});
This command will change the gender of the attached character. If it
was male, it will become female, if it was female, it will become male. The
change will be written to the character server, the player will receive the
message: "Need disconnection to perform change-sex request..." and the player
will be immediately kicked to the login screen. When they log back in, they will
be the opposite sex.
If the character being changed is a Dancer/Gypsy or Bard/Clown class type,
the character will also have their skills reset upon 'changecharsex'.
getexp <base_exp>,<job_exp>{,<char_id>};
This command will give the invoking character a specified number of base and job
experience points. Used for a quest reward. Negative values won't work.
The EXP values are adjustted by 'quest_exp_rate' config value, VIP bonus, Guild
Tax and EXP boost items such Battle Manual, Bubble Gum, or items that have
SC_EXPBOOST or SC_ITEMBOOST.
getexp 10000,5000;
getexp2 <base_exp>,<job_exp>{,<char_id>};
This command is safety version of 'set' command for BaseExp and JobExp. If using
'set' while the BaseExp or JobExp value is more than 2,147,483,647 (INT_MAX) will
causing overflow error.
Unlike 'getexp', this command ignores the adjustment factors!
setlook <look type>,<look value>{,<char_id>};
changelook <look type>,<look value>{,<char_id>};
'setlook' will alter the look data for the invoking character. It is used
mainly for changing the palette used on hair and clothes: you specify which look
type you want to change, then the palette you want to use. Make sure you specify
a palette number that exists/is usable by the client you use.
'changelook' works the same, but is only client side (it doesn't save the look value).
// This will change your hair color, so that it uses palette 8, what ever your
// palette 8 is, your hair will use that color
setlook LOOK_HAIR_COLOR,8;
// This will change your clothes color, so they are using palette 1, whatever
// your palette 1 is, your clothes will then use that set of colors.
setlook LOOK_CLOTHES_COLOR,1;
Here are the possible look types:
LOOK_BASE - Base sprite
LOOK_HAIR - Hairstyle
LOOK_WEAPON - Weapon
LOOK_HEAD_BOTTOM - Head bottom
LOOK_HEAD_TOP - Head top
LOOK_HEAD_MID - Head mid
LOOK_HAIR_COLOR - Hair color
LOOK_CLOTHES_COLOR - Clothes color
LOOK_SHIELD - Shield
LOOK_SHOES - Shoes
LOOK_BODY2 - Body style
Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
with this value. It still wants it from the server though, so it is kept, but
normally doesn't do a thing.
Only the look data for hairstyle, hair color and clothes color are saved to the
char server's database and will persist. Body style will also persist if 'save_body_style'
configuration is enabled in '/conf/battle/client.conf'. The rest freely change as the character
puts on and removes equipment, changes maps, logs in and out and otherwise you
should not expect to set them. In fact, messing with them is generally
hazardous, do it at your own risk, it is not tested what will this actually do -
it won't cause database corruption and probably won't cause a server crash, but
it's easy to crash the client with just about anything unusual.
However, it might be an easy way to quickly check for empty view IDs for
sprites, which is essential for making custom headgear.
Since a lot of people have different palettes for hair and clothes, it's
impossible to tell you what all the color numbers are. If you want a serious
example, there is a Stylist script inside the default rAthena installation that
you can look at: 'npc/custom/stylist.txt'
pushpc <direction>,<cells>;
This command will push the currently attached player to given direction by given
amount of square cells. Direction is the same as used when declaring NPCs, and
can be specified by using one of the DIR_* constants (src/map/script_constants.hpp).
The knock-back is not restricted by items or map flags, only obstacles are taken
into account. If there is not enough space to perform the push (e.g. due to a
wall), the character is pushed only up to the obstacle.
// pushes the character 5 cells in 3 o'clock direction from its
// current position.
pushpc DIR_EAST, 5;
recalculatestat;
This command will force a stat recalculation for the attached player.
needed_status_point(<type>,<val>{,<char id>});
Returns the number of stat points needed to change the specified stat <type> by <val>.
If <val> is negative, returns the number of stat points that would be needed to
raise the specified stat from (current value - <val>) to current value.
jobcanentermap("<mapname>"{,<JobID>});
Return true if player (decided by job) can enter the map, false otherwise.
For optional 'JobID', see constant of Job_*, or use player's Class, BaseJob,
and BaseClass. If no player is attached, this param must have a value.
See also db/[pre-]re/job_noenter_map.txt
get_revision()
This command will return the SVN revision number that the server is currently
running on.
if (get_revision() >= 15000)
mes "Welcome to rAthena!";
get_githash()
This command will return the Git Hash that the server is currently running on.
mes "Welcome to rAthena! Git Hash: " + get_githash();
openstorage;
This will open character's Kafra storage window on the client connected to the
invoking character. It can be used from any kind of NPC or item script, not just
limited to Kafra Staff.
The storage window opens regardless of whether there are open NPC dialogs or
not, but it is preferred to close the dialog before displaying the storage
window, to avoid any disruption when both windows overlap.
mes "Close this window to open your storage.";
close2;
openstorage;
end;
openstorage2 <storage_id>,<mode>{,<account_id>};
Just like the 'openstorage' command, except this command can open additional storages
by the specified <storage_id>. For <storage_id>, please read the conf/inter_server.yml
for storage groups.
Values for <mode> are:
STOR_MODE_NONE : Player only can read the storage entries.
STOR_MODE_GET : Player can get items from the storage.
STOR_MODE_PUT : Player can put items in the storage.
Example:
if (vip_status(VIP_STATUS_ACTIVE)) {
mes "I will open your Premium storage.";
mes "Thank you for using our service.";
close2;
openstorage2 1,STOR_MODE_GET|STOR_MODE_PUT;
} else {
mes "Sorry, your Premium status is expired.";
mes "Storage will be opened but you can't put any item into it.";
close2;
openstorage2 1,STOR_MODE_GET;
}
end;
openmail({<char_id>});
This will open a character's Mail window on the client connected to the
invoking character.
mes "Close this window to open your mail inbox.";
close2;
openmail;
end;
mail <destination id>,"<sender name>","<title>","<body>"{,<zeny>{,<item id array>,<item amount array>{,<item card0 array>{,<item card1 array>{,<item card2 array>{,<item card3 array>
{,<random option id0 array>, <random option value0 array>, <random option paramter0 array>{,<random option id1 array>, <random option value1 array>, <random option paramter1 array>
{,<random option id2 array>, <random option value2 array>, <random option paramter2 array>{,<random option id3 array>, <random option value3 array>, <random option paramter3 array>
{,<random option id4 array>, <random option value4 array>, <random option paramter4 array>}}}}}}};
This command will send mail to the <destination id> which is a character ID.
A <sender name> can be specified but does not have to be from the direct creator
of the mail and is limited to NAME_LENGTH (24) characters. Mail <title> is limited
to MAIL_TITLE_LENGTH (40) characters. Mail <body> is limited to MAIL_BODY_LENGTH
(200) characters for PACKETVER < 20150513 or 500 characters for later clients.
Optional <zeny> and item data can be added to the mail as well. PACKETVER < 20150513
is limited to 1 item while later clients are limited to MAIL_MAX_ITEM (5).
The <item id array>, <item amount array>, <item card0 array>, <item card1 array>,
<item card2 array>, and <item card3 array> should all be integer arrays.
For random options there can be 5 arrays in pairs of 3 (ids, values, parameters) right after the cards.
All of these arrays shall be integer arrays as well.
Example of sending mail with zeny:
.@charid = getcharid(0);
.@sender$ = "Poring";
.@title$ = "Welcome";
.@body$ = "Hi! I'm a simple Poring from the Prontera fields! Welcome to Ragnarok!";
.@zeny = 5000;
mail .@charid, .@sender$, .@title$, .@body$, .@zeny;
Example of sending mail with items:
.@charid = getcharid(0);
.@sender$ = "Angeling";
.@title$ = "Welcome";
.@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
.@zeny = 0;
setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2;
Example of sending mail with items and random options:
.@charid = getcharid(0);
.@sender$ = "Angeling";
.@title$ = "Welcome";
.@body$ = "Hi! I'm a simple Angeling from the Prontera fields! Welcome to Ragnarok!";
.@zeny = 0;
setarray .@mailitem[0], 504, 505, 2220, 1214; // White Potion, Blue Potion, Hat, Dagger
setarray .@mailamount[0], 10, 5, 1, 1; // 10 White Potions, 5 Blue Potions, 1 Hat, 1 Dagger
setarray .@mailcard0[0], 0, 0, 4198, 4092; // Attach Maya Purple Card to the Hat, Attach Skeleton Worker Card to Dagger
setarray .@mailcard1[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
setarray .@mailcard2[0], 0, 0, 0, 4092; // Attach Skeleton Worker Card to Dagger
setarray .@mailcard3[0], 0, 0, 0, 0; // Empty last slot
setarray .@mailrndopt_id0[0], 0, 0, 0, 0, RDMOPT_VAR_MAXHPAMOUNT; // Enchant the Dagger with increased HP option
setarray .@mailrndopt_val0[0], 0, 0, 0, 0, 1000; // Enchant the Dagger with increased HP option by 1000 points
setarray .@mailrndopt_prm0[0], 0, 0, 0, 0, 0; // Enchant the Dagger with increased HP option - does not need any parameter
mail .@charid, .@sender$, .@title$, .@body$, .@zeny, .@mailitem, .@mailamount, .@mailcard0, .@mailcard1, .@mailcard2, .@mailcard3, .@mailrndopt_id0, .@mailrndopt_val0, .@mailrndopt_prm0;
openauction({<char_id>});
This will open the Auction window on the client connected to the invoking character.
mes "Close this window to open the Auction window.";
close2;
openauction;
end;
resetlvl <action type>{,<char_id>};
This is a character reset command, meant mostly for rebirth script supporting
Advanced jobs, which will reset the invoking character's stats and level
depending on the action type given. Valid action types are:
1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
status effects (only the ones settable by 'setoption'), sets all stats to 1.
If the new job is 'Novice High', give 100 status points, give First Aid and
Play Dead skills.
2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
Skills and attribute values are not altered.
3 - Base level 1, base exp 0. Nothing else is changed.
4 - Job level 1, job exp 0. Nothing else is changed.
In all cases everything the character has on will be unequipped.
Even though it doesn't return a value, it is used as a function in the official
rebirth scripts. Ask AppleGirl why.
resetstatus({<char_id>});
This is a character reset command, which will reset the stats on the invoking
character and give back all the stat points used to raise them previously.
Nothing will happen to any other numbers about the character.
Used in reset NPC's (duh!)
resetskill({<char_id>});
This command takes off all the skill points on the invoking character, so they
only have Basic Skill blanked out (lvl 0) left, and returns the points for them
to spend again. Nothing else will change but the skills. Quest skills will also
reset if 'quest_skill_reset' option is set to Yes in 'battle_athena.conf'. If
the 'quest_skill_learn' option is set in there, the points in the quest skills
will also count towards the total.
Used in reset NPC's (duh!)
sc_start <effect type>,<ticks>,<value 1>{,<rate>,<flag>{,<GID>}};
sc_start2 <effect type>,<ticks>,<value 1>,<value 2>{,<rate>,<flag>{,<GID>}};
sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<rate>,<flag>{,<GID>}};
sc_end <effect type>{,<GID>};
sc_end_class {<char_id>{,<job_id>}};
These commands will bestow a status effect on a character.
The <effect type> determines which status is invoked. This can be either a number
or constant, with the common statuses (mostly negative) found in 'src/map/script_constants.hpp'
with the 'SC_' prefix. A full list is located in 'src/map/status.hpp', though
they are not currently documented.
The duration of the status is given in <ticks>, or milleseconds.
Use INFINITE_TICK for infinite duration.
Certain status changes take an additional parameter <value 1>, which typically
modifies player stats by the given number or percentage. This differs for each
status, and is sometimes zero.
Optional value <rate> is the chance that the status will be invoked (100 = 1%).
This is used primarily in item scripts. When used in an NPC script, a flag MUST
be defined for the rate to work.
Optional value <flag> is how the status change start will be handled (a bitmask).
SCSTART_NOAVOID : Status change cannot be avoided.
SCSTART_NOTICKDEF : Tick cannot be reduced by stats (default).
SCSTART_LOADED : sc_data loaded, so no value will be altered.
SCSTART_NORATEDEF : Rate cannot be reduced.
SCSTART_NOICON : Status icon won't be sent to client
If a <GID> is given, the status change will be invoked on the specified character
instead of the one attached to the script. This can only be defined after setting
a rate and flag.
'sc_start2' and 'sc_start4' allow extra parameters to be passed, and are used only
for effects that require them. The meaning of the extra values vary depending on the
effect type. For more infos, read status_change.txt containing a list of all Status Changes
and theirs val1, val2, val3, and val4 usage in source.
'sc_end' will remove a specified status effect. If SC_ALL (-1) is given, it will
perform a complete removal of all statuses (although permanent ones will re-apply).
'sc_end_class' works like 'sc_end' but will remove all status effects from any learned
skill on the invoking character. If <job_id> is provided it will end the effect for that job.
Examples:
// This will poison the invoking character for 10 minutes at 50% chance.
sc_start SC_POISON,600000,0,5000;
// This will bestow the effect of Level 10 Blessing.
sc_start SC_BLESSING,240000,10;
// Adjust element resistance by percentage. Sample with Resist_Fire item script:
// val1: Water resistance
// val2: Earth resistance
// val3: Fire resistance
// val4: Wind resistance
sc_start4 SC_ARMOR_ELEMENT,1200000,-15,0,20,0;
// This will end the Freezing status for the invoking character.
sc_end SC_FREEZE;
// This will end the effect of any learned skill for the invoking character.
sc_end_class;
// This will end the effect of any learned skill for the character with the <char_id> 150000.
// val1: <char_id>
sc_end_class(150000);
// This will end the effect of any Arch Bishop skill for the invoking character.
// val1: <char_id>
// val2: <job_id> of Arch Bishop
sc_end_class(getcharid(0),Job_Arch_Bishop);
Note: to use SC_NOCHAT you should alter Manner
set Manner, -5; // Will mute a user for 5 minutes
set Manner, 0; // Will unmute a user
set Manner, 5; // Will unmute a user and prevent the next use of 'Manner'
getstatus(<effect type>{,<type>{,<char_id>}})
Retrieve information about a specific status effect when called. Depending on <type>
specified the function will return different information.
Possible <type> values:
- 0 or undefined: whether the status is active
- 1: the val1 of the status
- 2: the val2 of the status
- 3: the val3 of the status
- 4: the val4 of the status
- 5: the amount of time in milliseconds that the status has remaining
If <type> is not defined or is set to 0, then the script function will either
return 1 if the status is active, or 0 if the status is not active. If the status
is not active when any of the <type> fields are provided, this script function
will always return 0.
skilleffect <skill id>,<number>;
skilleffect "<skill name>",<number>;
This command displays visual and aural effects of given skill on currently
attached character. The number parameter is for skill whose visual effect
involves displaying of a number (healing or damaging). Note, that this command
will not actually use the skill, it is intended for scripts, which simulate
skill usage by the NPC, such as buffs, by setting appropriate status and
displaying the skill's effect.
mes "Be blessed!";
// Heal of 2000 HP
heal 2000,0;
skilleffect 28,2000;
// Blessing Level 10
sc_start SC_BLESSING,240000,10;
skilleffect 34,0;
// Increase AGI Level 5
sc_start SC_INCREASEAGI,140000,5;
skilleffect 29,0;
This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
Increase AGI Lv 5, and display appropriate effects.
npcskilleffect <skill id>,<number>,<x>,<y>;
npcskilleffect "<skill name>",<number>,<x>,<y>;
This command behaves identically to 'skilleffect', however, the effect will not
be centered on the invoking character's sprite, nor on the NPC sprite, if any,
but will be centered at map coordinates given on the same map as the invoking
character.
specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
This command will display special effect with the given number, centered on the
specified NPCs coordinates, if any. For a full list of special effect numbers
known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
some client releases. (Notably, rain is absent from any client executables
released after April 2005.)
<NPC name> parameter will display <effect number> on another NPC. If the NPC
specified does not exist, the command will do nothing. When specifying an NPC,
<send_target> must be specified when specifying an <NPC Name>, specifying AREA
will retain the default behavior of the command.
// this will make the NPC "John Doe#1"
// show the effect "EF_HIT1" specified by
// Jane Doe. I wonder what John did...
mes "[Jane Doe]";
mes "Well, I never!";
specialeffect EF_HIT1,AREA,"John Doe#1";
close;
specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
This command behaves identically to 'specialeffect', but the effect will be
centered on the invoking character's sprite.
<Player name> parameter will display <effect number> on another Player than the
one currently attached to the script. Like with specialeffect, when specifying
a player, <send_target> must be supplied, specifying AREA will retain the default
behavior of the command.
statusup <stat>{,<char_id>};
This command will change a specified stat of the invoking character up by one
permanently. Stats are to be given as number, but you can use these constants to
replace them:
bStr - Strength
bVit - Vitality
bInt - Intelligence
bAgi - Agility
bDex - Dexterity
bLuk - Luck
statusup2 <stat>,<amount>{,<char_id>};
This command will change a specified stat of the invoking character by the
specified amount permanently. The amount can be negative. See 'statusup'.
// This will decrease a character's Vit forever.
statusup2 bVit,-1;
bonus <bonus type>,<val1>;
bonus2 <bonus type>,<val1>,<val2>;
bonus3 <bonus type>,<val1>,<val2>,<val3>;
bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
These commands are meant to be used in item scripts. They will probably work
outside item scripts, but the bonus will not persist for long. They, as
expected, refer only to an invoking character.
You can find the full list of possible bonuses and which command to use for each
kind in 'doc/item_bonus.txt'.
autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
These commands are meant to be used in item scripts. They will probably work
outside item scripts, but the bonus will not persist for long. They, as
expected, refer only to an invoking character.
What these commands do is 'attach' a script to the player which will get
executed on attack (or when attacked in the case of autobonus2).
Rate is the trigger rate of the script (1000 = 100%).
Duration is the time in milliseconds that the bonus will last for since the script has triggered.
Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
The optional argument 'flag' is used to classify the type of attack where the script
can trigger (it shares the same flags as the bAutoSpell bonus script):
Range criteria:
BF_SHORT: Trigger on melee attack
BF_LONG: Trigger on ranged attack
Default: BF_SHORT+BF_LONG
Attack type criteria:
BF_WEAPON: Trigger on weapon skills
BF_MAGIC: Trigger on magic skills
BF_MISC: Trigger on misc skills
Default: BF_WEAPON
Skill criteria:
BF_NORMAL: Trigger on normal attacks
BF_SKILL: Trigger on skills
default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
otherwise BF_SKILL+BF_NORMAL is used.
The difference between the optional argument 'other script' and the 'bonus script' is that,
the former one triggers only when attacking(or attacked) and the latter one runs on
status calculation as well, which makes sure, within the duration, the "bonus" that get
lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
"bonus" command only. And we usually use 'other script' to show visual effects.
In all cases, when the script triggers, the attached player will be the one
who holds the bonus. There is currently no way of knowing within this script
who was the other character (the attacker in autobonus2, or the target in
autobonus and autobonus3).
//Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
//using weapon or misc attacks (both melee and ranged skills) and shows a special
//effect when the bonus is active.
autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
bonus_script "<script code>",<duration>{,<flag>{,<type>{,<status_icon>{,<char_id>}}}};
This command will attach a script to a player for a given duration, in seconds.
After that time, the script will automatically expire. The same bonus cannot be
stacked. By default, this bonus will be stored on `bonus_script` table when player
logs out.
Flags (bitmask):
1 : Remove when dead.
2 : Removable by Dispell.
4 : Removable by Clearance.
8 : Remove when player logs out.
16 : Removeable by Banishing Buster.
32 : Removable by Refresh.
64 : Removable by Lux Anima.
128 : Remove when Madogear is activated or deactivated.
256 : Remove when receive damage.
512 : Script is permanent, cannot be cleared by bonus_script_clear.
1024: Force to replace duplicated script by expanding the duration.
2048: Force to add duplicated script. This flag cannot be stacked with 1024,
if both are defined, 1024 will be checked first and ignore this flag.
Types:
This will be used to decide negative or positive buff for 'debuff_on_logout'.
0: Ignore the buff type and won't be removed if the flag is not &8 (Default)
1: Buff
2: Debuff
Status_icon: See "Status Icon" section in 'src/map/script_constants.hpp'. Default is SI_BLANK (-1).
Example:
// Apple gives you +5 Str bonus for 1 minute when it's consumed.
512,Apple,Apple,0,15,,20,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "{ bonus bStr,5; }",60; },{},{}
bonus_script_clear {<flag>,{<char_id>}};
Removes attached bonus_script from player. If no 'char_id' given, it will removes
from the invoker.
If 'flag' is 1, means will clears all scripts even it's Permanent effect. By default,
it just removes non-permanent script.
skill <skill id>,<level>{,<flag>};
skill "<skill name>",<level>{,<flag>};
addtoskill <skill id>,<level>{,<flag>};
addtoskill "<skill name>",<level>{,<flag>};
These commands will give the invoking character a specified skill. This is also
used for item scripts.
Level is obvious. Skill id is the ID number of the skill in question as per
'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
a character a monster's skill, but you're welcome to try with the numbers given
in 'db/(pre-)re/mob_skill_db.txt'.
Flag is 0 if the skill is given permanently (will get written with the character
data) or 1 if it is temporary (will be lost eventually, this is meant for card
item scripts usage.). The flag parameter is optional, and defaults to 1 in
'skill' and to 2 in 'addtoskill'.
Flag 2 means that the level parameter is to be interpreted as a stackable
additional bonus to the skill level. If the character did not have that skill
previously, they will now at 0+the level given.
Flag 3 is the same as flag 1 in that it saves to the database. However, these skills
are ignored when any action is taken that adjusts the skill tree (reset/job change).
Flag constants:
0 - SKILL_PERM
1 - SKILL_TEMP
2 - SKILL_TEMPLEVEL
3 - SKILL_PERM_GRANT
// This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
// level 1.
skill 152,1,0;
nude {<char_id>};
This command will unequip anything equipped on the invoking character.
It is not required to do this when changing jobs since 'jobchange' will unequip
everything not equippable by the new job class anyway.
sit {"<character name>"};
stand {"<character name>"};
These commands will make a character sit or stand.
If no character is specified, the command will run for the invoking character.
Additionnally Sitting constant is true when the character is sitting, false otherwise.
disguise <Monster ID>{,<char_id>};
undisguise {<char_id>};
This command disguises the current player with a monster sprite.
The disguise lasts until 'undisguise' is issued or the player logs out.
Example:
disguise 1002; // Disguise character as a Poring.
next;
undisguise; // Return to normal character sprite.
transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
active_transform <monster ID>,<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
active_transform "<monster name>",<duration>{,<sc type>,<val1>,<val2>,<val3>,<val4>};
This command will turn a player into a monster for a given duration and can grant
a SC attribute effect while transformed. Note that players cannot be transformed
during War of Emperium or if already disguised.
Can only be removed when you die or the duration ends.
'transform' and 'active_transform' can stack on each other but using 'transform' or
'active_transform' twice will not stack (it will cancel the previous bonus for the new).
'active_transform' will take priority over transform for its duration.
pcfollow <id>,<target id>;
pcstopfollow <id>;
Makes a character follow or stop following someone. This command does the same
as the @follow command. The main difference is that @follow can use character
names, and this commands needs the account ID for the target.
Examples:
// This will make Aaron follow Bullah, when both of these characters are online.
pcfollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
// Makes Aaron stop following whoever he is following.
pcstopfollow getCharID(3,"Aaron");
pcblockmove <id>,<option>;
unitblockmove <id>,<option>;
Prevents the given GID from moving when the option is 1, and enables the ID to
move again when the option is 0. This command will run for the attached unit
if the given GID is zero.
Examples:
// Prevents the current char from moving away.
pcblockmove getcharid(3),1;
// Enables the current char to move again.
pcblockmove getcharid(3),0;
pcblockskill <id>,<option>;
unitblockskill <id>,<option>;
Prevents the given GID from casting skills when the option is 1, and enables
the ID to cast skills again when the option is 0. This command will run for
the attached unit if the given GID is zero.
Examples:
// Prevents the current char from casting skills.
pcblockskill getcharid(3),1;
// Enables the current char to cast skills again.
pcblockskill getcharid(3),0;
Copyright © 工程的初始时间(可选)–2019. All rights reserved.