Omega Crafter

Omega Crafter

Not enough ratings
Optimized Auto-Gatherer Buddy AI: Maximizing Efficiency
By Kinor
This guide delves into an optimized Buddy AI script that maximizes its efficiency for automated resource collection. Learn about its priority-based logic, how it handles item delivery and crucial game mechanics.
   
Award
Favorite
Favorited
Unfavorite
Understanding Your Buddy's Brain: Priority-Based AI
To truly grasp how this AI works, it's essential to understand its core principle: Priorities. Your Buddy will constantly evaluate its tasks in a specific order, ensuring it always performs the most important action first.

You can watch a demonstration of this AI in action here:

Here's the main loop your Buddy will follow:

when play button is pushed loop Comment: Pass ... (Phase 1: Item Delivery) ... Comment: Pick ... (Phase 2: Picking Up Dropped Items) ... Comment: Destroy ... (Phase 3: Resource Gathering) ...



Let's dive into each phase!
Phase 1: Item Delivery (The "Hand-Over" Logic)
This is the first thing your Buddy checks in its continuous loop.

Comment: Pass if having an item then try pass item to player if it fails put item on the ground end if restart process end if



How it works:
If your Buddy is holding any item, its absolute top priority is to deliver it to you. This is crucial because your Buddy can only hold one item at a time.

  • Attempt to Pass: Your Buddy will first try to pass item to player.
  • Handle Failure (Rare): While pass item to player failures are generally rare, if it does occur (e.g., your inventory is full), the game will automatically display a red error message (like "Search target not found") above your Buddy's head. This message forces a 2 second delay during which your Buddy cannot move or act. To handle this gracefully, your Buddy will then put item on the ground.
  • Restart Loop: Regardless of whether the item was successfully passed to you or dropped on the ground, the restart process immediately sends the Buddy back to the very beginning of its loop. This ensures it quickly moves on to its next task (like picking up the newly dropped item, if any, or continuing to gather).
Phase 2: Picking Up Dropped Items (The "Hoover" Function)
After checking for item delivery, your Buddy will scan its surroundings for dropped resources.

Comment: Pick if exists Tree Seed in around then search Tree Seed and pick up one restart process end if if exists Wood in around then search Wood and pick up one restart process end if if exists Stone in around then search Stone and pick up one restart process end if



How it works:
Your Buddy will check for each specified dropped item one by one. The exists [Item] in around block is instantaneous, and it doesn't cause a delay if the item isn't there. If an item is found, your Buddy picks it up, and the restart process sends it back to the top of the loop. This ensures:
  • It prioritizes delivering the newly picked-up item.
  • It re-scans for more dropped items in case multiple resources fell (e.g., from a single tree).
This section is highly efficient because it avoids delays when no items are present.
Phase 3: Resource Gathering (The "Workhorse" - Where Delays Can Occur)
This is the lowest priority task, performed only if your Buddy has no item to deliver and no dropped items to pick up. This is also where understanding the game's "failure delay" mechanism becomes critical.

Comment: Destroy try search Tree and attack until it is destroyed wait 0.5 sec restart process if it fails (This branch executes if search Tree fails) try search Ore and attack until it is destroyed wait 0.5 sec restart process if it fails (This branch executes if search Ore also fails) print log Buddy idle: Cannot find gathering target. end if end if



How it works:
  • Try Tree First: Your Buddy first attempts to find and attack a Tree.
    • If a Tree is found, it will attack it until destroyed, wait 0.5 sec (to allow dropped items to appear), and then the restart process to prioritize picking up the new Wood/Tree Seed.
    • If search Tree fails (i.e., no trees found in range), this action itself triggers an approximately 2-second delay with the red "Search target not found" message. The code then moves to the if it fails branch for the tree.
  • Then Try Ore: If the Tree search failed, your Buddy then attempts to find and attack Ore.
    • If Ore is found, it will attack it, wait 0.5 sec, and the restart process to pick up the Stone.
    • If search Ore fails (i.e., no ore found in range), this action also triggers another approximately 2-second delay with the red error message.
  • Idle State: If both Tree and Ore searches fail (resulting in approximately 4 seconds of combined forced delays), your Buddy will print log "Buddy idle: Cannot find gathering target.". The loop then naturally continues, letting your Buddy re-evaluate its priorities from the very beginning.
Crucial Insight: Managing Delays
The approximately 2-second delays for failed search or pass actions are an inherent game mechanic (to display error messages). You cannot prevent these delays when an action fails. This AI script is designed to minimize the impact of these delays by:
  • Always prioritizing actions that are instant (exists checks) or immediately useful (pass item).
  • Ensuring that after any failure (and its associated delay), your Buddy immediately triggers a restart process to re-evaluate the highest priority tasks, rather than getting stuck in redundant checks or adding unnecessary wait times.
Understanding restart process
This block is fundamental to how this AI achieves its priority system. When restart process is triggered, your Buddy immediately stops what it's doing and jumps back to the very first block in the main loop. This ensures:
  • Immediate Item Delivery: If it just picked something up, it instantly goes to deliver it.
  • Rapid Response to Drops: If it just cut a tree, it immediately checks for the newly fallen logs/seeds.
  • Dynamic Prioritization: It constantly re-evaluates all tasks from highest to lowest priority, adapting to the changing environment and your needs.
Conclusion
This optimized AI script provides a solid foundation for an efficient gathering Buddy. Experiment with it, understand its mechanics, and enjoy the automation! Remember to consider disabling this gathering script if other bots are dedicated to resource collection to avoid conflicts.

Feel free to leave comments or questions below if you have any suggestions for improvement or encounter any issues!

Happy crafting!
Export Data
This is the complete export data for the Intelligent Harvester Assistant Buddy AI. Due to character limitations on Steam, the full script is hosted externally for easy access and import.

Click the link below to view and copy the full export data:
Intelligent Harvester Assistant AI Script (Full Export Data)[docs.google.com]

(Please copy all content within the link to import into your game's Buddy AI system.)