Author Topic: [Support Script] Hole-Bot Hooks  (Read 444 times)

Hole-Bot Hooks

This is an overhaul of Bot_Holes's AIPlayer::hLoop that aims to make holebots much more extensible while retaining compatibility with current holebot mods.
It does this by breaking up the components of hLoop (player searching, brick "pathing", etc.) into many functions, which check the bot's datablock and armor for hook variables that specify if the function is to be overridden, or disabled. If a hook variable is set to 0 or doesn't exist, the default behavior will be used.

Examples:
Code: [Select]
//
// Hooking a bot so it sends a chat message instead of pathing its way to a brick.
//

function botTalk(%obj)
{
     talk("Hello, World!");
}

// Datablock Physician Prescribed Desoxynod:
datablock PlayerData(HoleBot : PlayerStandardArmor)
{
     hooks_ifPathBrick = "botTalk";
};

// Armor Physician Prescribed Desoxynod:
%obj.hooks_ifPathBrick = "botTalk";

//
// Disabling a bot from pathing its way to bricks.
//

// Datablock Physician Prescribed Desoxynod:
datablock PlayerData(HoleBot : PlayerStandardArmor)
{
     hooks_ifPathBrick = -1;
};

// Armor Physician Prescribed Desoxynod:
%obj.hooks_ifPathBrick = -1;

If a bot has both a datablock and armor variable for the same hook, the armor variable will be prioritized.
Also important is that each hook will pass the bot's player object as an argument, with the hooks tooFarFromSpawn and guardAtSpawn also passing in a %chaseDist variable.

To use this script, simply include it in your Add-On and execute it before the rest of your code.
« Last Edit: May 21, 2022, 05:44:38 PM by RobbinsonBlock »

this is a really good prerequisite support script for any ai pathfinding venture. before you'd have to make your own bot class or override the holebot Physician Prescribed Desoxynods but your mod eliminates the need to do that. very good