Raised This Month: $51 Target: $400
 12% 

[TF2 & L4D & L4D2] Actions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
NightlyRaine
New Member
Join Date: Jan 2020
Location: Kansas USA
Old 03-24-2022 , 17:49   Re: [L4D2] Actions
Reply With Quote #11

This is how I was trying to use GetName(), if I change result.action.GetName(name, sizeof name); to action.GetName(name, sizeof name); it works, but I can't get the result name.

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

#include <actions>

public void OnActionCreatedBehaviorAction actionint actor, const char[] name )
{
    if ( 
strcmp(name"SurvivorLegsStayClose") == )
    {
        
action.OnUpdatePost SurvivorLegsStayClose_OnUpdatePost;
    }


/* ----------------------------------------------------------------------------------------------------*/
/* SurvivorLegsStayClose */
/* ----------------------------------------------------------------------------------------------------*/
public Action SurvivorLegsStayClose_OnUpdatePostBehaviorAction actionfloat intervalActionResult result )
{    
    if ( 
result.IsRequestingChange() )
    {
        if ( 
result.action != INVALID_ACTION )
        {
            
char name[ACTION_NAME_LENGTH];
            
result.action.GetName(namesizeof name);
            
PrintToServer"%s"name );
        }
    }

    return 
Plugin_Continue;

In game Console
PHP Code:

L 03
/24/2022 16:36:31: [SMException reportedInvalid action passed (66C1B5F0)
L 03/24/2022 16:36:31: [SMBlamingGetNameExample.smx
L 03
/24/2022 16:36:31: [SMCall stack trace:
L 03/24/2022 16:36:31: [SM]   [0BehaviorAction.GetName
L 03
/24/2022 16:36:31: [SM]   [1Line 27F:\SteamLibrary\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\scripting\GetNameExample.sp::SurvivorLegsStayClose_OnUpdatePost
133.27
Rochelle:: SurvivorLegsStayClose caused SurvivorLegsStayClose to SUSPEND_FOR SurvivorLegsRegroup  (I'm too far away from the closest human survivor)
133.27: Rochelle::  SUSPENDING SurvivorLegsStayClose
133.27: Rochelle::  SUSPENDING SurvivorLegsMoveOn
133.27: Rochelle::  STARTING SurvivorLegsRegroup
SurvivorLegsRegroup<<SurvivorLegsStayClose( SurvivorLegsMoveOn ) 

And side question, would it be possible to change actions to other existing exactions?
Like when SurvivorLegsMoveOn Suspends_For SurvivorLegsBattleStations, would it be possible to get it to suspend for L4D1SurvivorLegsBattlesStations? Or SurvivorLegsWait? Asking so I know what all is possible.
NightlyRaine is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode