Skip to content
smartargs
VantageDocumentation

Party reference

The party component, the party it joins and the rules that decide who shares a kill. For how to use it, see Party.

VtUnitParty

Component. Add it with Add Component → Vantage → Party → VtUnitParty. Adds VtUnit automatically.

A unit’s membership in a VtParty: invites, joining, leaving, and the leader’s kick, promote and loot rule. Opt in through VtUnitDefinition.useParty; VtUnit attaches it.

Scripting API

Member Description
VtUnit Unit { get; } The unit this component belongs to.
VtParty Party { get; } The party this unit is in, or null.
bool InParty { get; } True while in a party.
bool IsLeader { get; } True when this unit leads its party.
VtUnit PendingInviter { get; } The unit whose invite is waiting for an answer, or null.
static int MaxSize { get; } Most members a party may have, from the tuning asset.
event Action<VtParty> OnPartyChanged Fires on every member when the party formed, changed or disbanded. Null means no party.
event Action<VtUnit> OnInvited Fires on the invited unit with the inviter.
event Action OnInviteCleared Fires when a pending invite was accepted, declined or dropped.
void Initialize() Cache the sibling unit. Safe to call more than once; call it after adding the component at runtime.
static bool AreInSameParty(VtUnit a, VtUnit b) True when a and b are the same unit or members of one party.
bool CanInvite(VtUnit target, out VtPartyFailureReason reason) Whether this unit could invite target now. Pure query.
bool Invite(VtUnit target, out VtPartyFailureReason reason) Invite target. A newer invite replaces an older one on the target.
bool AcceptInvite(out VtPartyFailureReason reason) Join the inviter’s party, forming it if the inviter had none.
bool DeclineInvite() Turn down the pending invite. False when there is none.
bool Leave() Leave the party. The next member leads if the leader leaves; a party of one disbands.
bool Kick(VtUnit member, out VtPartyFailureReason reason) Remove member from the party. Leader only.
bool Promote(VtUnit member, out VtPartyFailureReason reason) Hand leadership to member. Leader only.
bool SetLootRule(VtPartyLootRule rule, out VtPartyFailureReason reason) Change who may pick up the party’s drops. Leader only.
void ApplyPartyFromNet(IReadOnlyList<VtUnit> members, VtUnit leader, VtPartyLootRule rule) Replace this unit’s view of its party. Used by replication; not authority-gated. An empty list means no party.
void ApplyInviteFromNet(VtUnit inviter) Replace this unit’s pending invite. Used by replication; not authority-gated. Null clears it.

VtParty

Class.

A group of units that share kill credit, loot and party-only effects. Read-only to consumers: every change goes through the members’ VtUnitParty components so it is authority-gated and raises events. Destroyed members drop out on the next read.

Scripting API

Member Description
VtUnit Leader { get; } The member who may invite, kick, promote and change the loot rule.
IReadOnlyList<VtUnit> Members { get; } Every member, leader included, in join order.
int Count { get; } Number of members.
VtPartyLootRule LootRule { get; } Who may pick up drops from the party’s kills.
bool Contains(VtUnit unit) True when unit is a member.

VtPartyRules

Static class.

Who shares a kill. XP awards, currency drops and kill objectives ask here, so a custom reward system can apply the same rules.

Scripting API

Member Description
static void GetCreditRecipients(VtUnit killer, Vector3 at, List<VtUnit> results) Fill results with the killer first, then every other member of the killer’s party within VtTuning.partyShareRange of at. A solo killer is the only recipient.
static bool IsInShareRange(VtUnit unit, Vector3 at) True when unit stands within the share range of at on the ground plane. A range of 0 means any distance.
static bool SharesKillCredit(VtUnit holder, VtUnitId killerId, VtUnit killed) True when a kill by killerId also counts for holder: a different unit in the holder’s party, with the holder in share range of the killed unit.
static int SplitXp(int award, int recipients) XP each of recipients gets from an award of award: the award plus VtTuning.partyXpBonusPerMember per extra recipient, split evenly, at least 1.

Enums

VtPartyFailureReason

Why a VtUnitParty call refused.

Value Description
None The call succeeded.
InvalidTarget No target, the unit itself, a unit without a party component, a hostile unit, or someone not in this party.
TargetInParty The invited unit already belongs to a party.
AlreadyInParty This unit already belongs to a party.
NotInParty This unit belongs to no party.
NotLeader Only the leader may do this.
PartyFull The party has VtTuning.partyMaxSize members.
NoInvite No invite is pending, or the inviter is gone.
AuthorityNotLocal Not the authority; the request was forwarded.

VtPartyLootRule

Who may pick up items that drop from a kill made by a party member. Serialized as int; append-only.

Value Description
FreeForAll Anyone may pick up the drop.
PartyReserved For VtTuning.lootReserveSeconds only the killer’s party may pick up the drop; after that anyone may.