Raised This Month: $32 Target: $400
 8% 

[ANY] Trigger v1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author
WhosAsking
Member
Join Date: May 2011
Plugin ID:
3847
Plugin Version:
1.1
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    29 
    Plugin Description:
    Allows for the triggering of any entity's input. Wildcards accepted. Like "ent_fire" but without having to enable cheats.
    Old 08-22-2013 , 12:54   [ANY] Trigger v1.1
    Reply With Quote #1

    Although I have been using SourceMod and coding private plugins for some time, this is my very first public release, but I felt it to be useful enough to release at large.

    The inspiration for this plugin was the "Trigger Mapentities" plugin written by HSFighter. It had been a useful device for map development and testing, not to mention the occasional prank. However, we soon learned its limitations, such as requiring the class name to be able to fire the event. It also couldn't accept input values.

    This is the result of my development to create a better version. It basically mimics the function of the "ent_fire" cheat command, enabling the triggering of any and all matching entities complete with optional input, but without spoiling your session by activating cheat mode.

    I only delve into Team Fortress 2, but the basic nature of this plugin should render it mod-agnostic.
    No CVARs are used other than the version CVAR "sm_trigger_version".
    It's as simple as loading it to enable the commands and unloading it to remove them.

    The plugin provides three commands, all with ROOT flag restrictions (easy to change in the source) due to their technical or powerful nature:

    • sm_trigger <entity> [input] [value]
      This is the command as described. Just use an entity's name or * wildcard and an input and value if desired. You can target an entity number with "#<number>" or an entity in your sights with "@aim".
    • sm_findentity <entity>
      This is a debugging command I used alongside this one and uses the same entity tracking feature. It will list all entities matching your input, complete with number, actual name, and class name.
    • sm_aimentity
      (In-game only) Another debugging command based on code from a private debugging plugin I made for myself. It will identify any solid entity you are aiming at and give you information about it, allowing you to record and Trigger it later if you wish.
    UPDATE: 2013/09/12 - v1.1 Released. Now supports numeric entity targets using the "#" prefix as well as the "@aim" target for targets in sights . This allows for the triggering of unnamed entities. Also added the "sm_aimentity" command to learn about an entity in your sights and greatly expanded the list of default actions.

    Standard disclaimers apply. You assume all responsibility for the use of this plugin. Having said that, I sincerely hope this plugin is of use to anyone. I know it has been for myself.
    Attached Files
    File Type: sp Get Plugin or Get Source (trigger.sp - 1493 views - 21.8 KB)

    Last edited by WhosAsking; 09-13-2013 at 05:16. Reason: Updated to v1.1
    WhosAsking is offline
    Snaggle
    AlliedModders Donor
    Join Date: Jul 2010
    Location: England
    Old 08-22-2013 , 15:45   Re: [ANY] Trigger v1.0
    Reply With Quote #2

    A very handy plugin indeed. Useful for triggering those eastereggs!
    Snaggle is offline
    KyleS
    SourceMod Plugin Approver
    Join Date: Jul 2009
    Location: Segmentation Fault.
    Old 10-16-2013 , 13:46   Re: [ANY] Trigger v1.1
    Reply With Quote #3

    sizeof is a compile-time operator I see you're doing manual counting using while loops and the like which isn't required, but sizeof saves a lot of headache

    I don't understand why you can't use FindEntityByClassname, but I'm going to assume there's a good reason for it as you're pulling in sdktools anyways.

    PHP Code:
    // A return of -2 means the game doesn't implement
            // this feature.
            
    case -2:
            {
                
    ReplyToCommand(Client"\x03[Trigger]\x01 Aiming is not implemented in this game.");
            }
            
    // A return of -1 means no entity was targeted.
            
    case -1:
            {
                
    ReplyToCommand(Client"\x03[Trigger]\x01 No solid entity targeted.");
            } 
    You may want to use your defines here ;) You may also want to pass the argument sizes in the prototype, such as
    PHP Code:
    TriggerEntity(const Client, const EntityString:Input[ARG_SIZE], const String:Value[ARG_SIZE], String:ClassName[ARG_SIZE]) 
    sizeof avoids bugs instead of manually passing the size along.

    Regardless, seems relatively sane, nice job!

    Last edited by KyleS; 10-16-2013 at 13:46.
    KyleS is offline
    WhosAsking
    Member
    Join Date: May 2011
    Old 10-18-2013 , 12:32   Re: [ANY] Trigger v1.1
    Reply With Quote #4

    I was specifically AVOIDING using that because an entity match can match entities of DIFFERENT classes (IOW, the same name may apply to a logic_case and a logic_relay). ent_fire doesn't filter by class, neither does the base event logic system, so mine doesn't filter either. Besides, I don't think FindEntityByClassname works non non-edicts like logic_case, which was one of the problems I had with Trigger Mapentities.

    The code you see for finding entities is essentially copied from SMLib, but I avoid using SMLib itself to reduce the overhead, and I can see why they used this technique. It's basically the only way to go.

    As for the other code, I'll look at tweaking it.

    I'll look into sizeof. My coding base is C, however, and I'd always been taught there that sizeof counts in bytes, which is why it's used in memory operations. My array is of strings and other variable-length constructs which, in my thinking, can throw off sizeof.

    Oh, the -2 and -1? Those are defined returns from GetClientAimTarget(), the function I use to aim at an entity. The descriptions I use are based on the API documentation (-1 if no entity is being aimed at. -2 if the function is not supported). GetClientAimTarget is one reason I still use SDKTools.

    One last thing: ClassName here is an OUTPUT, meant to report the class of a found entity for reporting (for atypical matching).

    Last edited by WhosAsking; 10-18-2013 at 13:11. Reason: Realized where the -2 and -1 come from.
    WhosAsking is offline
    Shadowysn
    Senior Member
    Join Date: Sep 2015
    Location: Location:
    Old 12-20-2021 , 07:19   Re: [ANY] Trigger v1.2
    Reply With Quote #5

    Converted to new-syntax for SM 1.11, should work on SM 1.10.
    Added classname-targeting to sm_trigger and sm_findentity that functions similar to ent_fire.
    Attached Files
    File Type: sp Get Plugin or Get Source (trigger.sp - 175 views - 23.0 KB)
    __________________
    ragdoll spam, that is all

    Steam profile, where I game, obviously.
    Youtube channel, where I do Stick Death Maze animations and some other stuff.
    no plugin requests, sorry


    My Plugins:
    -search list-
    Modified Plugins:
    1 | 2 | 3 | 4

    Last edited by Shadowysn; 12-21-2021 at 03:12.
    Shadowysn is offline
    ZBzibing
    Senior Member
    Join Date: Dec 2012
    Old 05-27-2022 , 05:41   Re: [ANY] Trigger v1.1
    Reply With Quote #6

    This is a good thing, if you can list the execution code triggered by him, it is convenient to call in other programs

    how to execute on server
    Code:
    sm_trigger filter_generator testactivator
    [Trigger Commands] Command can only be used in game on a dedicated server.
    [Trigger] Triggered input 'TestActivator' of 'filter_generator'.
    __________________
    Please forgive, If I'm not describing it accurately. I use google translate
    Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:

    Last edited by ZBzibing; 05-28-2022 at 00:17.
    ZBzibing is offline
    Reply



    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 02:11.


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