Method FindNearestItemOnGround
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
FindNearestItemOnGround(string, string, string, float)
Finds the nearest item on the ground that matches the specified name criteria.
public ItemBehaviour FindNearestItemOnGround(string name1 = "", string name2 = null, string name3 = null, float maxDistance = 15)Parameters
- name1string
- Primary name to search for. Item name must contain this string. If empty, matches any name. 
- name2string
- Optional secondary name to search for. If provided, item name must contain either this or name1. 
- name3string
- Optional tertiary name to search for. If provided, item name must contain either this, name2, or name1. 
- maxDistancefloat
- Maximum search distance from the hero. Defaults to 15 units. 
Returns
- ItemBehaviour
- The nearest ItemBehaviour that matches the criteria, or null if no matching item is found. 
Remarks
The method searches for items in a box-shaped area around the hero. Items must be:
- Within the specified maxDistance
- Not already in an inventory
- Not currently equipped
- Not being carried by a player
- Reachable by the hero's navigation system
var potion = FindNearestItem("Vial of Health");
if (potion != null)
{
    PickUp(potion);
}var weapon = FindNearestItem("sword", "axe");
if (weapon != null)
{
    Say($"Found a {weapon.name}!");
}FindNearestItemOnGround(Predicate<ItemBehaviour>, float)
public ItemBehaviour FindNearestItemOnGround(Predicate<ItemBehaviour> predicate, float maxDistance = 15)Parameters
- predicatePredicate<ItemBehaviour>
- maxDistancefloat