Quote:
Originally Posted by cravenge
I'm still wrapping my head around your extension since it's a little bit confusing for me to be honest even with examples given.
|
Off-top
I started working on this extension 3 years ago and still don't quite understand some thing about actions. For everyone who wants to learn about them i would suggest to start with debugging what actions are used and how they are work with each other.
Spoiler
PHP Code:
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
PrintToChatAll("OnActionCreated %s", name);
}
public void OnActionDestroyed( BehaviorAction action, int actor, const char[] name )
{
PrintToChatAll("OnActionDestroyed %s", name);
}
Next step will be probably try to do something with action like blocking it or change something. For example code below will complete InfectedDying action after original OnStart function call and this will result that infected
will never become ragdoll since InfectedDying::Update is not called
Spoiler
PHP Code:
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
if ( strcmp(name, "InfectedDying") == 0 )
action.OnStart = OnStart;
}
public Action OnStart( BehaviorAction action, BehaviorAction priorAction, ActionResult result )
{
result.type = DONE;
return Plugin_Changed;
}
About crash mentioned in topic you can just block it and kill charger but it's not the best idea to block action since probably some plugin breaks something that causes this crash so crash will happen again with some other action.
PHP Code:
#include <actions>
public void OnActionCreated( BehaviorAction action, int actor, const char[] name )
{
if ( strcmp(name, "ChargerReturnToNavMesh") == 0 )
action.OnStart = OnStart;
}
public Action OnStart( BehaviorAction action, BehaviorAction priorAction, ActionResult result )
{
ForcePlayerSuicide(action.Actor);
result.type = DONE;
return Plugin_Handled; // Plugin_Handled will block calling original function
}
__________________