public class 0500_MOB_or_NPC_Commands extends Object
====================================== |0500.- Mob / NPC - related commands.| ======================================
| 构造器和说明 |
|---|
0500_MOB_or_NPC_Commands() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addmonsterdrop()
addmonsterdrop <monster id>,<item id>,<rate>;
addmonsterdrop "<monster name>",<item id>,<rate>;
delmonsterdrop <monster id>,<item id>;
delmonsterdrop "<monster name>",<item id>;
These commands will temporarily add or delete a monster drop, which will be reset
when the mob database reloads or the server shuts down.
|
void |
announce()
announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
This command will broadcast a message to all or most players, similar to
|
void |
areaannounce()
areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
This command works like 'announce' but will only broadcast to characters
residing in the specified x1/y1-x2/y2 rectangle on the map given.
|
void |
areamobuseskill()
areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
This command will make all monsters of the specified mob ID in the specified
area use the specified skill.
|
void |
callshop()
callshop "<name>",<option>;
These are a series of commands used to create dynamic shops.
|
void |
chatmes()
chatmes "<message>"{,"<NPC name>"};
This command will display a message in the waitingroom (chat) of the NPC.
|
void |
clone()
clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
This command creates a monster which is a copy of another player.
|
void |
cmdothernpc()
cmdothernpc "<npc name>","<command>";
This is simply "donpcevent <npc name>::OnCommand<command>".
|
void |
delwaitingroom()
delwaitingroom {"<NPC object name"};
This command will delete a waiting room.
|
void |
disablenpc()
disablenpc "<NPC object name>";
enablenpc "<NPC object name>";
These two commands will disable and enable, respectively, an NPC object
specified by name.
|
void |
doevent()
doevent "<NPC object name>::<event label>";
This command will start a new execution thread in a specified NPC object at the
specified label.
|
void |
donpcevent()
donpcevent "<NPC object name>::<event label>";
This command invokes the event label code within an another NPC or NPCs.
|
void |
enablewaitingroomevent()
enablewaitingroomevent {"<NPC object name>"};
disablewaitingroomevent {"<NPC object name>"};
enablearena;
disablearena;
This will enable and disable triggering the waiting room event (see
'waitingroom') respectively.
|
void |
getmapflag()
getmapflag("<map name>",<flag>{,<type>})
This command checks the status of a given mapflag and returns the mapflag's state.
0 means OFF, and 1 means ON.
|
void |
getwaitingroomstate()
getwaitingroomstate(<information type>{,"<NPC object name>"})
This function will return information about the waiting room state for the
attached waiting room or for a waiting room attached to the specified NPC if
any.
|
void |
getwaitingroomusers()
getwaitingroomusers "<NPC object name>";
This command get all the characters in the waiting room of the given NPC and stores
their gids in the array .
|
void |
hideonnpc()
hideonnpc "<NPC object name>";
hideoffnpc "<NPC object name>";
These commands will make the NPC object specified display as hidden/visible,
even though not actually disabled per se.
|
void |
kickwaitingroomall()
kickwaitingroomall {"<NPC object name>"};
This command kicks everybody out of a specified waiting room chat.
|
void |
killmonster()
killmonster "<map name>","<event label>"{,<type>};
This command will kill all monsters that were spawned with 'monster' or
'addmonster' and have a specified event label attached to them.
|
void |
killmonsterall()
killmonsterall "<map name>"{,<type>};
This command will kill all monsters on a specified map name, regardless of how
they were spawned or what they are.
|
void |
mapannounce()
mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
This command will work like 'announce' but will only broadcast to characters
currently residing on the specified map.
|
void |
mapwarp()
mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
This command will collect all characters located on the From map and warp them
wholesale to the same point on the To map, or randomly distribute them there if
the coordinates are zero.
|
void |
mobcount()
mobcount("<map name>","<event label>")
This function will count all the monsters on the specified map that have a given
event label and return the number or 0 if it can't find any.
|
void |
monster()
monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
This command will spawn a monster on the specified coordinates on the specified
map.
|
void |
movenpc()
movenpc "<NPC name>",<x>,<y>{,<dir>};
This command looks like the NPCWalkToxy function,but is a little different.
|
void |
npcshopadditem()
npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
This command will add more items at the end of the selling list for the
specified NPC shop or cashshop.
|
void |
npcshopattach()
npcshopattach "<name>"{,<flag>};
This command will attach the current script to the given NPC shop.
|
void |
npcshopdelitem()
npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
This command will remove items from the specified NPC shop or cashshop.
|
void |
npcshopitem()
npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
This command lets you override the contents of an existing NPC shop or cashshop.
|
void |
npcshopupdate()
npcshopupdate "<name>",<item_id>,<price>{,<stock>}
Update an entry from shop.
|
void |
npcspeed()
npcspeed <speed value>;
npcwalkto <x>,<y>;
npcstop;
These commands will make the NPC object in question move around the map.
|
void |
npctalk()
npctalk "<message>"{,"<NPC name>","<flag>"};
This command will display a message as if the NPC object running it was a player
talking - that is, above their head and in the chat window.
|
void |
removemapflag()
removemapflag "<map name>",<flag>{,<zone>};
This command removes a mapflag from a specified map.
|
void |
setbattleflag()
setbattleflag "<battle flag>",<value>{,<reload>};
getbattleflag("<battle flag>")
Sets or gets the value of the given battle flag.
|
void |
setmapflag()
setmapflag "<map name>",<flag>{,<zone>{,<type>}};
This command marks a specified map with the given map flag, which will alter the
behavior of the map.
|
void |
setmapflagnosave()
setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
This command sets the 'nosave' flag for the specified map and also gives an
alternate respawn-upon-relogin point.
|
void |
setnpcdisplay()
setnpcdisplay("<npc name>", "<display name>", <class id>, <size>)
setnpcdisplay("<npc name>", "<display name>", <class id>)
setnpcdisplay("<npc name>", "<display name>")
setnpcdisplay("<npc name>", <class id>)
Changes the display name and/or display class of the target NPC.
|
void |
strmobinfo()
strmobinfo(<type>,<monster id>);
This function will return information about a monster record in the database, as
per 'db/(pre-)re/mob_db.txt'.
|
void |
summon()
summon "monster name",<monster id>{,<Time Out>{,"event label"}};
This command will summon a monster.
|
void |
unloadnpc()
unloadnpc "<NPC object name>";
This command will fully unload a NPC object and all of it's duplicates.
|
void |
waitingroom()
waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
This command will create a chat room, owned by the NPC object running this
script and displayed above the NPC sprite.
|
void |
waitingroomkick()
waitingroomkick "<NPC object name>" , "<character name>";
This command kicks the given character from the waiting room attached to the given NPC.
|
void |
warpportal()
warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
Creates a warp portal identical to the Acolyte "Warp Portal" skill.
|
void |
warpwaitingpc()
warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
This command will warp the amount of characters equal to the trigger number of
the waiting room chat attached to the NPC object running this command to the
specified map and coordinates, kicking them out of the chat.
|
monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
This command will spawn a monster on the specified coordinates on the specified
map. If the script is invoked by a character, a special map name, "this", will
be recognized to mean the name of the map the invoking character is located at.
This command works fine in the item scripts.
The same command arguments mean the same things as described above in the
beginning of this document when talking about permanent monster spawns. Monsters
spawned in this manner will not respawn upon being killed.
Unlike the permanent monster spawns, if the mob id is -1, a random monster will
be picked from the entire database according to the rules configured in the
server for dead branches. This will work for all other kinds of non-permanent
monster spawns.
The only very special thing about this command is an event label, which is an
optional parameter. This label is written like '<NPC object name>::<label name>'
and upon the monster being killed, it will execute the script inside of the
specified NPC object starting from the label given. The RID of the player
attached at this execution will be the RID of the killing character.
The variable 'killedrid' is set to the Class (mob ID) of the monster killed.
The variable 'killedgid' is set to the ID (unique mob game ID) of the monster killed.
<size> can be:
Size_Small (0) (default)
Size_Medium (1)
Size_Large (2)
<ai> can be:
AI_NONE (0) (default)
AI_ATTACK (1) (attack/friendly)
AI_SPHERE (2) (Alchemist skill)
AI_FLORA (3) (Alchemist skill)
AI_ZANZOU (4) (Kagerou/Oboro skill)
AI_LEGION (5) (Sera skill)
AI_FAW (6) (Mechanic skill)
monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
The coordinates of 0,0 will spawn the monster on a random place on the map.
The 'areamonster' command works much like the 'monster' command and is not
significantly different, but spawns the monsters within a square defined by
x1/y1-x2/y2.
Returned value is an array with the game ID of the spawned monster(s) depending
on the amount spawned. Array is stored in $@mobid[].
Simple monster killing script:
<Normal NPC object definition. Let's assume you called him NPCNAME.>
mes "[Summon Man]";
mes "Want to start the Poring hunt?";
next;
if (select("Yes.:No.") == 2) {
mes "[Summon Man]";
mes "Come back later.";
close;
}
// Summon 10 Porings.
// Using coordinates 0,0 will spawn them in a random location.
monster "prontera",0,0,"Quest Poring",1002,10,"NPCNAME::OnPoringKilled";
mes "[Summon Man]";
mes "Now go and kill all the Porings I summoned.";
close;
OnPoringKilled:
$PoringKilled++;
if ($PoringKilled >= 10) {
announce "Summon Man: Well done. All the Porings are dead!",3;
$PoringKilled = 0;
}
end;
For more good examples see just about any official 2-1 or 2-2 job quest script.
areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
This command will make all monsters of the specified mob ID in the specified
area use the specified skill. Map name, x, and y define the center of the area,
which extending <range> cells in each direction (ex: a range of 3 would create
a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
milliseconds (1000 = 1 second), and the rest should be self-explanatory.
<target type> can be:
0 = self
1 = the mob's current target
2 = the mob's master
3 = random target
Example:
// spawn 1 Shining Plant in the 5x5 area centered on (155,188)
areamonster "prontera",153,186,157,190,"Shining Plant",1083,1;
// make the plant cast level 10 Cold Bolt on a random target
areamobuseskill "prontera",155,188,2,1083,"MG_COLDBOLT",10,3000,1,ET_KEK,3;
killmonster "<map name>","<event label>"{,<type>};
This command will kill all monsters that were spawned with 'monster' or
'addmonster' and have a specified event label attached to them. Commonly used to
get rid of remaining quest monsters once the quest is complete.
If the label is given as "All", all monsters which have their respawn times set
to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
command, and all monsters summoned with GM commands, but no other ones - that
is, all non-permanent monsters) on the specified map will be killed regardless
of the event label value.
As of r12876 killmonster now supports an optional argument type. Using 1 for type
will make the command fire "OnMyMobDead" events from any monsters that do die
as a result of this command.
killmonsterall "<map name>"{,<type>};
This command will kill all monsters on a specified map name, regardless of how
they were spawned or what they are. As of r12873, The behavior has changed slightly.
In light of a label behavior fix for mob spawning commands that will now allow the label to
trigger when there is no player, killmonsterall has also been modified to support this.
Using this the normal/old way means labels don't trigger when a player didn't
attack/kill a monster. This is because it breaks compatibility with older scripts if
forced to use the new method. However, if you wish to use the new label type with this
command, simply use 1 for type. Any other number won't be recognized.
strmobinfo(<type>,<monster id>);
This function will return information about a monster record in the database, as
per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
It will return 0 if there is no such monster (or the type value is invalid),
or an empty string if you requested the monster's name.
1 - 'english name' field in the database, a string.
2 - 'japanese name' field in the database, a string.
All other returned values are numbers:
3 - Level.
4 - Maximum HP.
5 - Maximum SP.
6 - Experience reward.
7 - Job experience reward.
mobcount("<map name>","<event label>")
This function will count all the monsters on the specified map that have a given
event label and return the number or 0 if it can't find any. Naturally, only
monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
event label.
If you pass this function an empty string for the event label, it will return
the total count of monster without event label, including permanently spawning monsters.
With the dynamic mobs system enabled, where mobs are not kept
in memory for maps with no actual people playing on them, this will return a 0
for any such map.
If the event label is given as "all", all monsters will be counted, regardless of
having any event label attached.
If the map name is given as "this", the map the invoking character is on will
be used. If the map is not found, or the invoker is not a character while the map
is "this", it will return -1.
clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
This command creates a monster which is a copy of another player. The first
four arguments serve the same purpose as in the monster script command, The
<char id> is the character id of the player to clone (player must be online).
If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
must be a character id of another online player.
The mode can be specified to determine the behavior of the clone. Its
values are the same as the ones used for the mode field in the mob_db. The
default mode is aggressive, assists, can move, can attack.
Flag can be either zero or one currently. If zero, the clone is a normal
monster that'll target players, if one, it is considered a summoned monster,
and as such, it'll target other monsters. Defaults to zero.
The duration specifies how long the clone will live before it is auto-removed.
Specified in seconds, defaults to no limit (zero).
Returned value is the monster ID of the spawned clone. If command fails,
returned value is zero.
summon "monster name",<monster id>{,<Time Out>{,"event label"}};
This command will summon a monster. (see also 'monster') Unlike monsters spawned
with other commands, this one will set up the monster to fight to protect the
invoking character. Monster name and mob id obey the same rules as the one given
at the beginning of this document for permanent monster spawns with the
exceptions mentioned when describing 'monster' command.
The effect for the skill 'Call Homunculus' will be displayed centered on the
invoking character.
Timeout is the time in milliseconds the summon lives, and is set default
to 60000 (1 minute). Note that also the value 0 will set the timer to default,
and it is not possible to create a spawn that lasts forever.
If an event label is given, upon the monster being killed, the event label will
run as if by 'donpcevent'.
Returned value is the game ID of the spawned monster.
// Will summon a dead branch-style monster to fight for the character.
summon "--ja--",-1;
addmonsterdrop <monster id>,<item id>,<rate>;
addmonsterdrop "<monster name>",<item id>,<rate>;
delmonsterdrop <monster id>,<item id>;
delmonsterdrop "<monster name>",<item id>;
These commands will temporarily add or delete a monster drop, which will be reset
when the mob database reloads or the server shuts down. They return 1 upon success.
If the monster already drops the specified item, its drop rate will be updated with
the given rate (100 = 1%).
Examples:
// Makes Owl Baron drop Honey at an 80% rate.
addmonsterdrop 1295,518,8000;
// Deletes Executioner's Mitten from Rybio.
delmonsterdrop 1201,7017;
disablenpc "<NPC object name>";
enablenpc "<NPC object name>";
These two commands will disable and enable, respectively, an NPC object
specified by name. The disabled NPC will disappear from sight and will no longer
be triggerable in the normal way. It is not clear whether it will still be
accessible through 'donpcevent' and other triggering commands, but it probably
will be. You can disable even warp NPCs if you know their object names, which is
an easy way to make a map only accessible through walking half the time. Then
you 'enablenpc' them back.
You can also use these commands to create the illusion of an NPC switching
between several locations, which is often better than actually moving the NPC -
create one NPC object with a visible and a hidden part to their name, make a few
copies, and then disable all except one.
hideonnpc "<NPC object name>";
hideoffnpc "<NPC object name>";
These commands will make the NPC object specified display as hidden/visible,
even though not actually disabled per se. Hidden as in thief Hide skill, but
unfortunately, not detectable by Ruwach or Sight.
As they are now, these commands are pointless, it is suggested to use
'disablenpc'/'enablenpc', because these two commands actually unload the NPC
sprite location and other accompanying data from memory when it is not used.
However, you can use these for some quest ideas (such as cloaking NPCs talking
while hidden then revealing.... you can wonder around =P
unloadnpc "<NPC object name>";
This command will fully unload a NPC object and all of it's duplicates.
doevent "<NPC object name>::<event label>";
This command will start a new execution thread in a specified NPC object at the
specified label. The execution of the script running this command will not stop,
and the event called by the 'doevent' command will not run until the invoking
script has terminated. No parameters may be passed with a doevent call.
The script of the NPC object invoked in this manner will run as if it's been
invoked by the RID that was active in the script that issued a 'doevent'. As
such, the command will not work if an RID is not attached.
place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
mes "This is what you will see when you click me";
close;
OnLabel:
mes "This is what you will see if the doevent is activated";
close;
}
....
doevent "NPC::OnLabel";
donpcevent "<NPC object name>::<event label>";
This command invokes the event label code within an another NPC or NPCs. It
starts a separate instance of execution, and the invoking NPC will resume
execution its immediately.
If the supplied event label has the form "NpcName::OnLabel", then only given
NPC's event label will be invoked (much like 'goto' into another NPC). If the
form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
label will be invoked, one after another. In both cases the invoked script
will run without an attached RID, whether or not the invoking script was
attached to a player. The event label name is required to start with "On".
This command can be used to make other NPCs act, as if they were responding to
the invoking NPC's actions, such as using an emotion or talking.
place,100,100,1%TAB%script%TAB%NPC1%TAB%53,{
mes "NPC2 copies my actions!";
close2;
donpcevent "NPC2::OnEmote";
end;
OnEmote:
emotion rand(1,30);
end;
}
place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{
mes "NPC1 copies my actions!";
close2;
donpcevent "NPC1::OnEmote";
end;
OnEmote:
emotion rand(1,30);
end;
}
Whichever of the both NPCs is talked to, both will show a random emotion at the
same time.
As of r16564, command now returns 1 or 0 on success and failure.
A debug message also shows on the console when no events are triggered.
cmdothernpc "<npc name>","<command>";
This is simply "donpcevent <npc name>::OnCommand<command>".
It is an approximation of official server script language's 'cmdothernpc'.
Returns true if the command was executed on the other NPC successfully, false if not.
npctalk "<message>"{,"<NPC name>","<flag>"};
This command will display a message as if the NPC object running it was a player
talking - that is, above their head and in the chat window.
The display name of the NPC won't get appended in front of the message.
If the <NPC name> option is given and not empty, then that NPC will display the message,
else the attached NPC will display the message.
Target for <flag>:
- bc_all : Broadcast message is sent server-wide (only in the chat window).
- bc_map : Message is sent to everyone in the same map as the source of the npc.
- bc_area : Message is sent to players in the vicinity of the source (default value).
- bc_self : Message is sent only to player attached.
// This will make everyone in the area see the NPC greet the character
// who just invoked it.
npctalk "Hello " + strcharinfo(0) + ", how are you?";
chatmes "<message>"{,"<NPC name>"};
This command will display a message in the waitingroom (chat) of the NPC.
If the <NPC name> option is given, then that NPC will display the message, else
the attached NPC will display the message.
If the NPC is not in a waitingroom, nothing happens.
// Everyone in the waitingroom will see this message:
chatmes "Waiting 5 minutes until the next match will start";
setnpcdisplay("<npc name>", "<display name>", <class id>, <size>);
setnpcdisplay("<npc name>", "<display name>", <class id>);
setnpcdisplay("<npc name>", "<display name>");
setnpcdisplay("<npc name>", <class id>);
Changes the display name and/or display class of the target NPC.
Returns 0 is successful, 1 if the NPC does not exist.
Size is 0 = normal 1 = small 2 = big.
announce "<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
This command will broadcast a message to all or most players, similar to
mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
This command will work like 'announce' but will only broadcast to characters
currently residing on the specified map. The flag and optional parameters
parameters are the same as in 'announce', but target and source flags are ignored.
areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
This command works like 'announce' but will only broadcast to characters
residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
optional parameters are the same as in 'announce', but target and source flags are ignored.
areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
callshop "<name>",<option>;
These are a series of commands used to create dynamic shops.
The 'callshop' function calls an invisible shop (view -1) as if the player clicked on it.
The options are:
0 = The normal window (buy, sell and cancel)
1 = The buy window
2 = The sell window
Note: The <option> parameter only works on the 'shop' type NPC.
A shop called with this command will trigger the labels "OnBuyItem" and "OnSellItem"
(as long as an npcshop* command is executed from that NPC, see note below). These
labels, if used, will replace how the shop handles the buying and selling of items,
allowing for the creation of dynamic shops.
The label "OnBuyItem" sets the following arrays:
npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
This command lets you override the contents of an existing NPC shop or cashshop. The
current sell list will be wiped, and only the items specified with the price
specified will be for sale.
The function returns 1 if shop was updated successfully, or 0 if not found.
NOTES:
- That you cannot use -1 to specify default selling price!
- If attached shop type is market shop, need an extra param after price, it's <qty>
and make sure don't add duplication item!
npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}};
This command will add more items at the end of the selling list for the
specified NPC shop or cashshop. If you specify an item already for sell, that item will
appear twice on the sell list.
The function returns 1 if shop was updated successfully, or 0 if not found.
NOTES:
- That you cannot use -1 to specify default selling price!
- If attached shop type is market shop, need an extra param after price, it's <qty>
and make sure don't add duplication item!
npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}};
This command will remove items from the specified NPC shop or cashshop.
If the item to remove exists more than once on the shop, all instances will be
removed.
Note that the function returns 1 even if no items were removed. The return
value is only to confirm that the shop was indeed found.
npcshopattach "<name>"{,<flag>};
This command will attach the current script to the given NPC shop.
When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
of your script will be executed whenever a player buys/sells from the shop.
Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
and @sold_quantity[] will be filled up with the items and quantities
bought/sold.
The optional parameter specifies whether to attach ("1") or detach ("0") from
the shop (the default is to attach). Note that detaching will detach any NPC
attached to the shop, even if it's from another script, while attaching will
override any other script that may be already attached.
The function returns 0 if the shop was not found, 1 otherwise.
NOTES:
- If attached shop type is market shop, will be default to call the 'buy' window.
npcshopupdate "<name>",<item_id>,<price>{,<stock>}
Update an entry from shop. If price is 0 means don't change the price, maybe used for
marketshop to update the stock quantity. Except marketshop type, 'stock' value means
nothing.
waitingroom "<chatroom name>",<limit>{,"<event label>"{,<trigger>{,<required zeny>{,<min lvl>{,<max lvl>}}}}};
This command will create a chat room, owned by the NPC object running this
script and displayed above the NPC sprite.
The maximum length of a chat room name is 60 letters.
The limit is the maximum number of people allowed to enter the chat room.
The attached NPC is included in this count. If the optional event and trigger
parameters are given, the event label ("<NPC object name>::<label name>")
will be invoked as if with a 'doevent' upon the number of people in the chat
room reaching the given triggering amount.
// The NPC will just show a box above its head that says "Hello World", clicking
// it will do nothing, since the limit is zero.
waitingroom "Hello World",0;
// The NPC will have a box above its head, it will say "Disco - Waiting Room"
// and will have 8 waiting slots. Clicking this will enter the chat room, where
// the player will be able to wait until 7 players accumulate. Once this happens,
// it will cause the NPC "Bouncer" run the label "OnStart".
waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
// The NPC will have a box above its head, it will say "Party - Waiting Room"
// and will have 8 waiting slots. Clicking this will allow a player who has
// 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
// able to wait until 7 players accumulate. Once this happens, it will cause
// the NPC "Bouncer" run the label "OnStart".
waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
Creating a waiting room does not stop the execution of the script and it will
continue to the next line.
For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
of waiting rooms.
delwaitingroom {"<NPC object name"};
This command will delete a waiting room. If no parameter is given, it will
delete a waiting room attached to the NPC object running this command, if it is,
it will delete a waiting room owned by another NPC object. This is the only way
to get rid of a waiting room, nothing else will cause it to disappear.
It's not clear what happens to a waiting room if the NPC is disabled with
'disablenpc', by the way.
enablewaitingroomevent {"<NPC object name>"};
disablewaitingroomevent {"<NPC object name>"};
enablearena;
disablearena;
This will enable and disable triggering the waiting room event (see
'waitingroom') respectively. Optionally giving an NPC object name will do that
for a specified NPC object. The chat room will not disappear when triggering is
disabled and enabled in this manner and players will not be kicked out of it.
Enabling a chat room event will also cause it to immediately check whether the
number of users in it exceeded the trigger amount and trigger the event
accordingly.
Normally, whenever a waiting room was created to make sure that only one
character is, for example, trying to pass a job quest trial, and no other
characters are present in the room to mess up the script.
The 'enablearena'/'disablearena' commands are just aliases with no parameter.
These are supposedly left here for compatibility with official server scripts,
but no rAthena script uses these at the moment.
getwaitingroomstate(<information type>{,"<NPC object name>"})
This function will return information about the waiting room state for the
attached waiting room or for a waiting room attached to the specified NPC if
any.
The valid information types are:
0 - Number of users currently chatting.
1 - Maximum number of users allowed.
2 - Will return 1 if the waiting room has a trigger set.
0 otherwise.
3 - Will return 1 if the waiting room is currently disabled.
0 otherwise.
4 - The Title of the waiting room (string)
5 - Password of the waiting room, if any. Pointless, since there is no way to
set a password on a waiting room right now.
16 - Event name of the waiting room (string)
32 - Whether or not the waiting room is full.
33 - Whether the amount of users in the waiting room is higher than the trigger
number.
warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
This command will warp the amount of characters equal to the trigger number of
the waiting room chat attached to the NPC object running this command to the
specified map and coordinates, kicking them out of the chat. Those waiting the
longest will get warped first. It can also do a random warp on the same map
("Random" instead of map name) and warp to the save point ("SavePoint").
The list of characters to warp is taken from the list of the chat room members.
Those not in the chat room will not be considered even if they are talking to
the NPC in question. If the number of people is given, exactly this much people
will be warped.
This command can also keep track of who just got warped. It does this by setting
special variables:
$@warpwaitingpc[] is an array containing the account_id numbers of the
characters who were just warped.
$@warpwaitingpcnum contains the number of the character it just warped.
See also 'getpartymember' for advice on what to do with those variables.
The obvious way of using this effectively would be to set up a waiting room for
two characters to be warped onto a random PVP map for a one-on-one duel, for
example.
waitingroomkick "<NPC object name>" , "<character name>";
This command kicks the given character from the waiting room attached to the given NPC.
getwaitingroomusers "<NPC object name>";
This command get all the characters in the waiting room of the given NPC and stores
their gids in the array .@waitingroom_users[]. Also, stores the number of characters
in the variable .@waitingroom_usercount.
kickwaitingroomall {"<NPC object name>"};
This command kicks everybody out of a specified waiting room chat.
setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
This command sets the 'nosave' flag for the specified map and also gives an
alternate respawn-upon-relogin point.
It does not make a map impossible to make a save point on as you would normally
think, 'savepoint' will still work. It will, however, make the specified map
kick the reconnecting players off to the alternate map given to the coordinates
specified.
setmapflag "<map name>",<flag>{,<zone>{,<type>}};
This command marks a specified map with the given map flag, which will alter the
behavior of the map. A full list of mapflags is located in 'src/map/script_constants.hpp' with
the 'mf_' prefix, and documentation can be found in 'doc/mapflags.txt'.
The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
(mf_nosave), dead branch usage (mf_nobranch), penalties upon death
(mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
The optional parameter <zone> is used to set the zone for 'restricted' mapflags,
GM level bypass for 'nocommand', base/job experience for 'bexp'/'jexp', and
flag for 'battleground'.
For 'skill_damage' mapflag:
- Setting the flag here will adjust the global (all skills) damage on the map.
- <zone> is the -100 to 100000 damage adjustment value of the skills.
- See 'getmapflag' for the different <type> values.
For 'skill_duration' mapflag:
- <zone> is the skill ID to adjust.
- <type> is the percentage of adjustment from 0 to 100000.
removemapflag "<map name>",<flag>{,<zone>};
This command removes a mapflag from a specified map.
See 'setmapflag' for a list of mapflags.
The optional parameter 'zone' is used to remove the zone from restricted mapflags.
getmapflag("<map name>",<flag>{,<type>})
This command checks the status of a given mapflag and returns the mapflag's state.
0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
For MF_RESTRICTED, the zone value of the map is returned.
The optional parameter 'type' is used in the 'skill_damage' mapflag:
SKILLDMG_MAX: if mapflag is set (default)
SKILLDMG_PC: damage against players
SKILLDMG_MOB: damage against mobs
SKILLDMG_BOSS: damage against bosses
SKILLDMG_OTHER: damage against other
SKILLDMG_CASTER: caster type
setbattleflag "<battle flag>",<value>{,<reload>};
getbattleflag("<battle flag>");
Sets or gets the value of the given battle flag.
Battle flags are the flags found in the battle / *.conf files and is also used in Lupus' variable rates script.
If the reload value is given then the server will attempt to reload monster data
to properly apply the new rates. This applies to EXP/Drop type configs. The server
will only attempt to reload specific configs.
Examples:
// Will set the base experience rate to 20x (2000%) - Monster data will continue to use previous rates at server start
setBattleFlag "base_exp_rate",2000;
// Will set the base experience rate to 20x (2000%) - Monster data will be reloaded to new value
setBattleFlag "base_exp_rate",2000,true;
// Will return the value of the base experience rate (when used after the above example, it would print 2000).
mes getBattleFlag("base_exp_rate");
warpportal <source x>,<source y>,"<map name>",<target x>,<target y>;
Creates a warp portal identical to the Acolyte "Warp Portal" skill.
The source coordinates specify the portal's location on the map of the invoking NPC.
The target map and coordinates determine the destination of the portal.
Examples:
// Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
warpportal 150,150,"prontera",150,180;
mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
This command will collect all characters located on the From map and warp them
wholesale to the same point on the To map, or randomly distribute them there if
the coordinates are zero. "Random" is understood as a special To map name and
will mean randomly shuffling everyone on the same map.
Optionally, a type and ID can be specified. Available types are:
0 - Everyone
1 - Guild
2 - Party
Example:
// Will warp all members of guild with ID 63 on map prontera to map alberta.
mapwarp "prontera","alberta",150,150,1,63;
npcspeed <speed value>;
npcwalkto <x>,<y>;
npcstop;
These commands will make the NPC object in question move around the map. As they
currently are, they are a bit buggy and are not useful for much more than making
an NPC move randomly around the map.
'npcspeed' will set the NPCs walking speed to a specified value. As in the
movenpc "<NPC name>",<x>,<y>{,<dir>};
This command looks like the NPCWalkToxy function,but is a little different.
While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
sometimes gives problems if the path isn't a straight line without objects),
this command just moves the NPC. It basically warps out and in on the current
and given spot. Direction can be used to change the NPC's facing direction.
Example:
// This will move Bugga from it's old coordinates to the new coordinates at 100,20 (if those coordinates are legit).
moveNPC "Bugga",100,20;
Copyright © 工程的初始时间(可选)–2019. All rights reserved.