Skip to main content
Apocalypse Rising 2 only. Guard with if api.client.x then before calling on other games.

Getters

CallReturnsWhat it tells you
getWeapon() / getWeaponName()string?The item name of your equipped firearm. nil if empty-handed or not holding a firearm.
getHydration()numberYour current hydration.
getEnergy()numberYour current energy.
getVelocity()Vector3Your current velocity.
isThirdPerson()booleantrue while in third person.
getVehicle()Model?The vehicle you’re in, or nil.
AR2 notes: getMaxHealth() is always 100 (the game’s base) and getHealthFraction() is relative to that. isSpectating() is always false. getTeam() reflects the local team string only.

Inventory

Read your gear and nearby loot, then move items around. Item ids come from the read calls; pass an item’s id to the action calls. These are the same moves you can do by hand, so the server still enforces space, valid slots, and so on.
CallReturnsWhat it gives you
getItems(){ Item }Everything in your carried containers.
getNearbyLoot(){ Item }Items in open bodies / containers / ground nearby (each also has container and source).
getEquipment(){ Item }Your equipped gear, each tagged with equipSlot.
equipItem(id, slot?)Equip an item (optionally into a specific slot).
useItem(id)Use / consume an item (heal, eat, drink).
dropItem(id, rotated?)Drop an item to the ground.
pickupItem(id, containerId?)Pick up loot. The container is found for you if omitted.
craftItem(id, sourceId)Combine sourceId into id (top up a mag / ammo box).
fillAmmo(id)Fill a magazine from your loose ammo.
unloadAmmo(id)Unload a magazine into loose ammo.
slotUtility(id)Slot a utility (flashlight, binoculars, etc.).
removeAttachment(id, parentId?)Detach an attachment. The parent is found for you if omitted.
See Item.

Examples

-- Use the first medkit in your bag
for _, item in api.client.getItems() do
    if item.name == "Medkit" then
        api.client.useItem(item.id)
        break
    end
end

-- Grab every nearby gun
for _, item in api.client.getNearbyLoot() do
    if item.type == "Firearm" then
        api.client.pickupItem(item.id, item.container)
    end
end