Extension provides a natives to hook action event handlers and create custom actions
Notes
If two different plugins will try to return different action for same eventhandler last will be chosen.
Extension doesn't support late load so after reload you must recreate nextbots
All actions are cached by their parent action event handlers
Commands & ConVars
PHP Code:
/* Commands */
ext_actions_dump - dumps entities actions
ext_actions_offsets - prints every hooked function offset
ext_actions_listeners - dumps actions listeners
ext_actions_list - dumps every action that manager currently holds
/* ConVars */
ext_actions_debug - debugs action propagation (1 - Enable debug, 0 - Disable debug)
ext_actions_debug_processors - Logs processors (-2 - Disabled, -1 - Debug all, N - function vtable index to debug)
Examples
Block actions
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
if ( strcmp(name, "WitchAttack") == 0 )
{
/* Hook OnStart handler */
action.OnStart = OnStart;
}
}
public Action OnStart( BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result )
{
/* When WitchAttack actions starts force it to end */
result.type = DONE;
return Plugin_Changed;
}
Custom actions
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
if ( strcmp(name, "SurvivorAttack") == 0 )
action.OnStart = OnStart;
}
public Action OnStart( BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result )
{
/* We suspend WitchAttack action for our action */
/* That means WitchAttack will be like in frozen state */
/* It's will not be updated until our action is done */
public Action OnMyActionStart( BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result )
{
PrintToServer("We are started!");
return Plugin_Continue;
}
public Action OnMyActionUpdate( BehaviorAction action, int actor, float interval, ActionResult result )
{
PrintToServer("MyCustomAction is updating...");
if (GetRandomFloat() >= 0.5)
{
return action.Done("We are done");
}
return Plugin_Continue;
}
Changing original result
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, int actor, const char[] name )
{
if ( strcmp(name, "WitchIdle") == 0 || strcmp(name, "WitchAngry") == 0 )
{
/* We set post hook otherwise ActionDesiredResult will contain default values */
action.OnShovedPost = OnShovedPost;
}
}
public Action OnShovedPost( BehaviorAction action, int actor, int shover, ActionDesiredResult result )
{
if ( result.type == SUSPEND_FOR )
{
result.type = CONTINUE;
return Plugin_Changed;
}
return Plugin_Continue;
}
Making bots to heal only you or self only for BW state
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <actions>
stock int m_bIsOnThirdStrike;
public void OnPluginStart()
{
m_bIsOnThirdStrike = FindSendPropInfo("CTerrorPlayer", "m_bIsOnThirdStrike");
}
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
/* Hooking self healing action (when bot wants to heal self) */
if ( strcmp(name, "SurvivorHealSelf") == 0 )
action.OnStart = OnSelfAction;
/* Hooking take pills action (when bot wants to take pills) */
if ( strcmp(name, "SurvivorTakePills") == 0 )
action.OnStart = OnSelfAction;
/* Hooking give pills action (when bot wants to give pills) */
if ( strcmp(name, "SurvivorGivePillsToFriend") == 0 )
action.OnStartPost = OnFriendAction;
}
public Action OnSelfAction( BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result )
{
/* When bot will be about to start healing/taking pills we chech if he's black & white */
/* if he is then we allow to heal otherwise no */
result.type = GetEntData(action.Actor, m_bIsOnThirdStrike, 1) ? CONTINUE : DONE;
return Plugin_Handled;
}
public Action OnFriendAction( BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result )
{
/* When bot will be about to start healing/giving pills to someone, we chech if friend is black & white */
/* if friend is then we allow to give heal otherwise no */
int target = action.Get(0x34) & 0xFFF;
result.type = GetEntData(target, m_bIsOnThirdStrike, 1) ? CONTINUE : DONE;
return Plugin_Handled;
}
- Fixed InitialContainedAction handler for custom actions
I understand that with the help of your extension, can force a tank to attack a certain player or make him just stand still or run away from players or even make zombie friends for a survivors, I understand that the extension gives full control over the intelligence of entities that is embedded in the game engine?)
__________________
-
PHP Code:
public OnClientConnect(int Client) {
KickClient(Client, "sorry");
}
Using nb_move_to_cursor and nb_move_to_position seems to crash when a bot is spawned in when using this amazing extension.
And I for the life of me can not figure out how to use or what this is even supposed to do, Am somewhat new to messing with plugins at times. Any help on what it is supposed to do and how to use would be amazing!
PHP Code:
/* Used to iterate through all entity actions */
public static native void Actions( int entity, ActionsIteratorCallback callback );
And GetName() doesn't seem to work when getting the name of a result action like
Using nb_move_to_cursor and nb_move_to_position seems to crash when a bot is spawned in when using this amazing extension.
Thanks for report. Fixed
Quote:
Originally Posted by NightlyRaine
And I for the life of me can not figure out how to use or what this is even supposed to do, Am somewhat new to messing with plugins at times. Any help on what it is supposed to do and how to use would be amazing!
It will give every action that passed entity contains. There is no way to legally create ArrayList via extension so that's the only way how can you pass multiple objects without creating your own handle type.
How to use
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sdktools>
#include <actions>
public void OnPluginStart()
{
RegConsoleCmd("sm_actions", sm_actions);
}
public Action sm_actions( int client, int args )
{
int target = GetClientAimTarget(client, false);