OnWorldItemPickup

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 18:41, 3 September 2026 by QCherry (talk | contribs) (Document Lua events available or improved from G1R:MP 0.1.2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onWorldItemPickup

IMPROVED FROM UPDATE 0.1.2
This event is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.

Triggered after the server accepts a synchronized world-item pickup and applies its authoritative inventory grant.

Availability

This event is available in server-side scripts.

Callback signature

onWorldItemPickup(objectId, playerId, itemKey, quantity, serverTimeMs)

Parameters

Name Type Description
objectId int The positive server-assigned 64-bit world-item object ID.
playerId int The player that picked up the item.
itemKey string The stable item definition key.
quantity int The complete accepted world-stack quantity granted to the player.
serverTimeMs int Server timestamp of the accepted pickup.

Examples

Handle the event:

addEventHandler("onWorldItemPickup", root, function(objectId, playerId, itemKey, quantity, serverTimeMs)
    outputDebugString(getPlayerName(playerId) .. " picked up " .. itemKey)
end)

Notes

  • The server has already added quantity to its authoritative native inventory cache before this observation event. Do not grant the same items again from the handler.
  • The picked-up tombstone is broadcast reliably and the object is removed from active late-join state before callbacks run. The bundled GothicRP resource then persists the inventory grant asynchronously.
  • Rejected, stale, duplicate, out-of-range, or over-capacity pickup attempts do not emit this event.