public class 1300_Party_Commands extends Object
======================== |1300.- Party commands.| ========================
| 构造器和说明 |
|---|
1300_Party_Commands() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clan_join()
clan_join(<clan id>{,<char id>});
The attached player joins the clan with the <clan id>.
|
void |
clan_leave()
clan_leave({<char id>});
The attached player will leave their clan.
|
void |
getequiprandomoption()
getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
Returns value of an attribute of a random option on an equipped item.
|
void |
getpartyleader()
getpartyleader(<party id>{,<type>})
This function returns some information about the given party-id's leader.
|
void |
getpartymember()
getpartymember <party id>{,<type>{,<array_variable>}};
This command will find all members of a specified party and returns their names
(or character id or account id depending on the value of "type") into an array
of temporary global variables.
|
void |
getpartyname()
getpartyname(<party id>)
This function will return the name of a party that has the specified ID number.
|
void |
getrandomoptinfo()
getrandomoptinfo(<type>);
Returns value of an attribute of current random option.
|
void |
hateffect()
hateffect(<Hat Effect ID>,<State>);
This will set a Hat Effect onto the player.
|
void |
is_party_leader()
is_party_leader({<party ID>})
This command will return true if the player attached to the script is the leader
of his/her party, or, if a party ID is specified, of that party.
|
void |
navigateto()
navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
Generates a navigation for attached or specified character.
|
void |
opendressroom()
opendressroom(<flag>{,<char_id>});
This will open the Dress Room window on the client connected to the invoking character.
|
void |
party_addmember()
party_addmember(<party id>,<character id>);
Adds a player to an existing party.
|
void |
party_changeleader()
party_changeleader(<party id>,<character id>);
Transfers leadership of a party to the specified character.
|
void |
party_changeoption()
party_changeoption(<party id>,<option>,<flag>);
Changes a party option.
|
void |
party_create()
party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
Organizes a party with the attached or specified character as leader.
|
void |
party_delmember()
party_delmember({<character id>,<party id>});
Removes a player from his/her party.
|
void |
party_destroy()
party_destroy(<party id>);
Disbands a party.
|
void |
setrandomoption()
setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
Sets <index+1>th random option for equipment equipped at <equipment slot>
to <id>, <value> and <param>.
|
getpartyname(<party id>)
This function will return the name of a party that has the specified ID number.
If there is no such party ID, "null" will be returned.
Lets say the ID of a party was saved as a global variable:
// This would return the name of the party from the ID stored in a variable
mes "You're in the '" + getpartyname($@var) + "' party, I know!";
getpartymember <party id>{,<type>{,<array_variable>}};
This command will find all members of a specified party and returns their names
(or character id or account id depending on the value of "type") into an array
of temporary global variables. There's actually quite a few commands like this
which will fill a special variable with data upon execution and not do anything
else.
Upon executing this,
$@partymembername$[] is a global temporary string array which contains all the
names of these party members
(only set when type is 0 or not specified)
$@partymembercid[] is a global temporary number array which contains the
character id of these party members.
(only set when type is 1)
$@partymemberaid[] is a global temporary number array which contains the
account id of these party members.
(only set when type is 2)
$@partymembercount is the number of party members that were found.
The party members will (apparently) be found regardless of whether they are
online or offline. Note that the names come in no particular order.
Be sure to use $@partymembercount to go through this array, and not
'getarraysize', because it is not cleared between runs of 'getpartymember'. If
someone with 7 party members invokes this script, the array would have 7
elements. But if another person calls up the NPC, and he has a party of 5, the
server will not clear the array for you, overwriting the values instead. So in
addition to returning the 5 member names, the 6th and 7th elements from the last
call remain, and you will get 5+2 members, of which the last 2 don't belong to
the new guy's party. $@partymembercount will always contain the correct number,
(5) unlike 'getarraysize()' which will return 7 in this case.
If 'array_variable' is set, the result will be stored to that variable instead
using global variable.
Example 1: list party member names
// get the party member names
getpartymember getcharid(1),0;
// It's a good idea to copy the global temporary $@partymember*****
// variables to your own scope variables because if you have pauses in this
// script (sleep, sleep2, next, close2, input, menu, select, or prompt),
// another player could click this NPC, trigger 'getpartymember', and
// overwrite the $@partymember***** variables.
.@count = $@partymembercount;
copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
// list the party member names
for (.@i = 0; .@i < .@count; .@i++)
mes (.@i +1) + ". ^0000FF" + .@name$[.@i] + "^000000";
close;
Example 2: check party count (with a 'next' pause), before warping to event
.register_num = 5; // How many party members are required?
// get the charID and accountID of character's party members
getpartymember getcharid(1), 1;
getpartymember getcharid(1), 2;
if ( $@partymembercount != .register_num ) {
mes "Please form a party of " + .register_num + " to continue";
close;
}
// loop through both and use 'isloggedin' to count online party members
for ( .@i = 0; .@i < $@partymembercount; .@i++ )
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
.@count_online++;
// We search accountID & charID because a single party can have multiple
// characters from the same account. Without searching through the charID,
// if a player has 2 characters from the same account inside the party but
// only 1 char online, it would count their online char twice.
if ( .@count_online != .register_num ) {
mes "All your party members must be online to continue";
close;
}
// copy the array to prevent players cheating the system
copyarray .@partymembercid, $@partymembercid, .register_num;
mes "Are you ready ?";
next; // careful here
select("Yes");
// When a script hits a next, menu, sleep or input that pauses the script,
// players can invite or /leave and make changes in their party. To prevent
// this, we call getpartymember again and compare with the original values.
getpartymember getcharid(1), 1;
if ( $@partymembercount != .register_num ) {
mes "You've made changes to your party !";
close;
}
for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
if ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {
mes "You've made changes to your party !";
close;
}
}
// Finally, it's safe to start the event!
warpparty "event_map", 0,0, getcharid(1);
getpartyleader(<party id>{,<type>})
This function returns some information about the given party-id's leader.
When type is omitted, the default information retrieved is the leader's name.
Possible types are:
1: Leader account id
2: Leader character id
3: Leader's class
4: Leader's current map name
5: Leader's current level as stored on the party structure (may not be
current level if leader leveled up recently).
If retrieval fails (leader not found or party does not exist), this function
returns "null" instead of the character name, and -1 for the other types.
is_party_leader({<party ID>})
This command will return true if the player attached to the script is the leader
of his/her party, or, if a party ID is specified, of that party.
party_create("<party name>"{,<character id>{,<item share>,<item share type>}});
Organizes a party with the attached or specified character as leader. If
successful, the command returns 1 and sets the global temporary variable
"$@party_create_id" to the ID of the party created.
Additionally, item sharing options can be provided:
- Item Share: 0-Each Take (default), 1-Party Share
- Item Share Type: 0-Each Take (default), 1-Even Share
These values are returned upon failure:
0: Unknown error.
-1: Player not found.
-2: Player already has a party.
-3: Party name exists.
party_destroy(<party id>);
Disbands a party. The command returns 1 upon success and 0 upon failure.
party_addmember(<party id>,<character id>);
Adds a player to an existing party.
The command returns 1 upon success, and these values upon failure:
0: Unknown error.
-1: Player not found.
-2: Player already has a party.
-3: Party not found.
-4: Party is full.
-5: Another character from the same account is already in the party.
party_delmember({<character id>,<party id>});
Removes a player from his/her party. If no player is specified, the command
will run for the invoking player. If that player is the only party member
remaining, the party will be disbanded.
The command returns 1 upon success, and these values upon failure:
0: Unknown error.
-1: Player not found.
-2: Party not found.
-3: Player is not in the party.
party_changeleader(<party id>,<character id>);
Transfers leadership of a party to the specified character.
The command returns 1 upon success, and these values upon failure:
0: Unknown error.
-1: Party not found.
-2: Player not found.
-3: Player is not in the party.
-4: Player is already party leader.
party_changeoption(<party id>,<option>,<flag>);
Changes a party option.
Valid options are:
0 - Exp Share (flags: 0-Each Take, 1-Even Share)
1 - Item Share (flags: 0-Each Take, 1-Party Share)
2 - Item Share Type (flags: 0-Each Take, 1-Even Share)
The command returns 1 upon success, and these values upon failure:
0: Invalid option.
-1: Party not found.
opendressroom(<flag>{,<char_id>});
This will open the Dress Room window on the client connected to the invoking character.
mes "Close this window to open the Dress Room window.";
close2;
opendressroom(1);
end;
Valid flag are:
1 - Open the Dress Room window
navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
Generates a navigation for attached or specified character. Requires client
2011-10-10aRagEXE or newer.
The flag specifies how the client will calculate the specific route.
Valid flags are:
NAV_NONE - No services
NAV_AIRSHIP_ONLY - Airship only
NAV_SCROLL_ONLY - Scroll only
NAV_AIRSHIP_AND_SCROLL - Airship and Scroll
NAV_KAFRA_ONLY - Kafra only
NAV_KAFRA_AND_AIRSHIP - Kafra and Airship
NAV_KAFRA_AND_SCROLL - Kafra and Scroll
NAV_ALL - All services
When flag is not specified, the default value is NAV_KAFRA_AND_AIRSHIP.
The hide_window specifies whether to display (0) or hide (1) the navigation window.
By default the window is hidden.
You can specify the monster_id in combination with a mapname to make the
navigation system tell you, that you have reached the desired mob.
Note:
The client requires custom monster spawns be in the navigation file
for using the embedded client Navigation feature to work properly. In this
instance sending the player to the map where the monster spawns is a simpler
solution rather than sending the map and the monster_id.
hateffect(<Hat Effect ID>,<State>);
This will set a Hat Effect onto the player. The state field allows you to
enable (true) or disable (false) the effect on the player.
The Hat Effect constants can be found in 'src/map/script_constants.hpp' starting
with HAT_EF_*.
Requires client 2015-05-13aRagEXE or newer.
getrandomoptinfo(<type>);
Returns value of an attribute of current random option.
Valid attributes are:
ROA_ID - ID of current option
ROA_VALUE - Value field of current option
ROA_PARAM - Param field of current option
This script command is intended for using in random option scripts.
getequiprandomoption(<equipment index>,<index>,<type>{,<char id>});
Returns value of an attribute of a random option on an equipped item.
See 'getequipid' for a full list of valid equipment slots.
index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
For valid attribute types, see `getrandomoptinfo` command reference.
setrandomoption(<equipment slot>,<index>,<id>,<value>,<param>{,<char id>});
Sets <index+1>th random option for equipment equipped at <equipment slot>
to <id>, <value> and <param>.
See 'getequipid' for a full list of valid equipment slots.
index parameter can be 0 to MAX_ITEM_RDM_OPT-1 (default 0-4).
ID - ID of random option. See db/const.txt for constants.
Value - Value of random option
Param - Parameter of random option
clan_join(<clan id>{,<char id>});
The attached player joins the clan with the <clan id>. On a successful join,
true is returned, else false if the join failed.
If <char id> is specified, the specified player is used rather than the attached one.
clan_leave({<char id>});
The attached player will leave their clan. On a successful leave, true is returned,
else false if the leave failed.
If <char id> is specified, the specified player is used rather than the attached one.
Copyright © 工程的初始时间(可选)–2019. All rights reserved.