Violet

Party

On this page

Read your current party and act on it: list members, create or leave a party, invite / kick / promote by name, apply to a listed party, and respond to incoming invites.

Not in a party

When you're not in a party, is_in_party() and is_party_leader() return false, get_party_id() and get_party_boss_id() return 0, get_party_name() returns "" and get_members() returns an empty table. On the login screens you always count as not in a party.

Requests

create, leave, invite, kick, promote, apply, accept_invite and decline_invite send a request to the server. Each returns true once the request is sent, or false and a reason when it isn't, for example when you're not in a map, not the party leader, or the name isn't in your party. A request that was sent can still be refused by the server, for example on maps where parties are restricted, so check is_in_party() or get_members() for the result.

Names are matched the way the game matches them: upper and lower case letters count as the same. A name with characters the game can't use is refused.

Party Member Structure

get_members() returns an array of objects, one per member currently in the party:

PropertyTypeDescription
idnumberMember character ID
namestringCharacter name (IGN)
levelnumberCharacter level
jobnumberJob code
sub_jobnumberSub-job code (0 for most jobs)
channelnumberChannel the member is on, numbered like core.get_channel_id(); negative while the member isn't on a channel, for example offline or in the Cash Shop
field_idnumberMap ID the member is in
is_bossbooleantrue for the party leader

State

core.party.is_in_party() -> boolean

Available on GMS and CW

Returns true if you are currently in a party.


core.party.is_party_leader() -> boolean

Available on GMS and CW

Returns true if you are the party leader (boss).


core.party.get_party_id() -> number

Available on GMS and CW

Returns the current party ID, or 0 when not in a party.


core.party.get_party_name() -> string

Available on GMS and CW

Returns the party name, or "" when not in a party.


core.party.get_party_boss_id() -> number

Available on GMS and CW

Returns the leader's character ID, or 0 when not in a party.


core.party.get_members() -> table<party_member>

Available on GMS and CW

Returns an array of the current members (see Party Member Structure). The array is empty when you aren't in a party.

lua
for _, m in ipairs(core.party.get_members()) do
    core.log(string.format("%s Lv.%d%s", m.name, m.level, m.is_boss and " (leader)" or ""))
end

core.party.is_member(who: string | number) -> boolean

Available on GMS and CW

Returns true if who is currently in your party. Pass either a character name (string) or a character ID (number). Returns false and a reason when who is neither.

Actions

core.party.create(name?: string) -> boolean, string?

Available on GMS and CW

Creates a new party. Without a name (or with an empty one) the party gets the game's default name; a name can be up to 36 characters. Like a party made with the game's own create command, it accepts join requests from party search. Returns false and a reason if you're already in a party.


core.party.leave() -> boolean, string?

Available on GMS and CW

Leaves the current party. Returns false and a reason if you're not in a party.


core.party.invite(name: string) -> boolean, string?

Available on GMS and CW

Invites the player named name to your party. Works while you lead a party or aren't in one. Returns false and a reason when you're a member but not the leader, when the party is full, or when name is your own.


core.party.kick(name: string) -> boolean, string?

Available on GMS and CW

Kicks the member named name. Only the leader can kick. Returns false and a reason when you're not the leader, when name isn't a current member, or when name is your own.


core.party.promote(name: string) -> boolean, string?

Available on GMS and CW

Makes the member named name the party leader. Only the leader can promote, and the game only hands leadership to a member on your map. Returns false and a reason when you're not the leader, when name isn't a current member, or when name is your own.


core.party.apply(party_id: number) -> boolean, string?

Available on GMS and CW

Applies to join the listed party with the given party_id (party search). Returns false and a reason if you're already in a party; leave() first.

Invites

on_party_invite(inviter: string, inviter_id: number, level: number, job: number, sub_job: number) -> boolean | nil

Available on GMS and CW

Called when a party invite arrives, before the client shows its invite dialog. The return value decides what happens:

ReturnEffect
trueAccept the invite (no dialog shown)
falseDecline the invite (no dialog shown)
nil (or no return)Let the normal invite dialog appear

inviter is the inviter's name; inviter_id is their character ID (keep it if you want to answer later via accept_invite / decline_invite); level / job / sub_job describe the inviter. The first script to return a non-nil value decides — later scripts don't see that invite. An invite a script answers skips the game's own handling, including its automatic refusals such as invites from players you blocked.


core.party.accept_invite(inviter_id: number) -> boolean, string?

Available on GMS and CW

Accepts a pending invite from inviter_id (the value passed to on_party_invite). Use this to answer outside the hook — e.g. after an async check. An invite is pending while the game shows its invite window for it (no on_party_invite answered it), until you answer it here or the window times out. The game shows one invite window at a time and refuses other invites while it is open, so those are never pending. For an inviter_id with no pending invite this returns false and a reason. Clicking an answer in the game's window isn't seen here, so the invite stays pending until the window would have timed out.

The game's invite window stays open after you answer here; leave it to time out, because its buttons and closing it send a second answer.


core.party.decline_invite(inviter_id: number) -> boolean, string?

Available on GMS and CW

Declines a pending invite from inviter_id, with the same rules as accept_invite.

Plugin Required

on_party_invite must be part of a plugin with proper metadata structure.

Example

lua
plugin = {
    name = "Party Helper",
    author = "YourName",
    version = "1.0",
    description = "Auto-accepts invites from my mules and prints the party",
    load = true
}

local TRUSTED = { mymule1 = true, mymule2 = true }

function on_party_invite(inviter, inviter_id, level, job, sub_job)
    if TRUSTED[string.lower(inviter)] then
        core.log("Accepting party invite from " .. inviter)
        return true        -- accept, no dialog
    end
    return nil              -- show the normal dialog for everyone else
end

-- Print the current party
if core.party.is_in_party() then
    core.log(string.format("Party '%s' (id %d):",
        core.party.get_party_name(), core.party.get_party_id()))
    for _, m in ipairs(core.party.get_members()) do
        core.log(string.format("  %s Lv.%d ch.%d%s",
            m.name, m.level, m.channel, m.is_boss and " (leader)" or ""))
    end
end

-- Hand the lead to a mule, and say why when that can't happen
local ok, err = core.party.promote("MyMule1")
if not ok then
    core.log_warning("Promote failed: " .. err)
end