OnWorldItemPickup

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 20:00, 19 October 2026 by QCherry (talk | contribs) (Document upcoming 0.1.9 custom native keys, shared doors, server Lua callbacks and persistence; not a release)
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.

Available from 0.1.9 (upcoming; not yet publicly released). Not included in public 0.1.8. Use matching updated server and clients.

Custom-key pickup

The existing (objectId, playerId, item, quantity, serverTimeMs) event also reports registered custom keys using their canonical identity. Inventory was already granted by the core; do not give it again. Persist your gamemode inventory as needed. This is a reserved server notification, not remotely triggerable. See Custom keys.