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

[ANY] Trigger Multiple Commands (1.9) [20-Dec-2023]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
3844
Plugin Version:
1.9
Plugin Category:
Gameplay
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    8 
    Plugin Description:
    Create trigger_multiple boxes which execute commands when entered by players.
    Old 08-20-2013 , 11:18   [ANY] Trigger Multiple Commands (1.9) [20-Dec-2023]
    Reply With Quote #1






    About:
    • Save up to 32 trigger boxes (trigger_multiple entities) which execute commands when activated by players walking into them.
    • Lots of options to choose from. View menu screenshot for details.
    • The data config is saved to sm_trigger.cfg in your servers \sourcemod\data\ folder.


    Engine Support:
    • This plugin should work for most game engines supported by SourceMod. But some may not have the "CreateEntityByName" function or support the "trigger_multiple" entity.
    • If the game engine you use does not support this plugin or needs some adjustments (for example team names and numbers), please let me know.
    • This plugin supports team names for: L4D/L4D2/TF2/CSS/CSGO/DoD:S/HL2DM/INS/ZPS/AOC/DM/FF/GE:S/HID/NT/ND/SGTLS.


    Thanks:
    • gilmon - Tons of help testing.
    • Herbie - Lots of help testing.
    • wominater - Lots of help testing.
    • disawar1
    • Chatyak
    • Sev


    Admin Commands: (requires "z" flag)

    PHP Code:
    sm_trigger          // Displays a menu with options to edit and position triggers.
    sm_trigger_add      // Add a command to the currently selected trigger. Usage: sm_trigger_add <command>
    sm_trigger_dupe     // Create a trigger where you are standing and duplicate the settings from another trigger. Optional: [index] to duplicate specified trigger index.
    sm_trigger_flags    // Usage: sm_trigger_flags <flags>. Displays the bit sum flags (from data config), eg: sm_trigger_flags 13107720
    sm_trigger_reload   // Resets the plugin, removing all triggers and reloading the maps data config. 

    CVars:

    Saved to sm_trigger.cfg in your servers \cfg\sourcemod\ folder.

    PHP Code:
    // 0=Plugin off, 1=Plugin on.
    sm_trigger_allow "1"

    // Color of the laser box when displaying the trigger. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
    sm_trigger_color "255 0 0"

    // Used for the laser beam to display Trigger Boxes.
    sm_trigger_mat_beam "materials/sprites/laserbeam.vmt"

    // Used for the laser beam to display Trigger Boxes.
    sm_trigger_mat_halo "materials/sprites/halo01.vmt"

    // The model to use for the bounding box, the larger the better, will be invisible and is used as the maximum size for a trigger box.
    sm_trigger_model "models/props/cs_militia/silo_01.mdl"

    // How does the Activate Chance affect the Refire Count when the chance fails to activate? 0=Do not add to the Refire Count. 1=Add to the Refire Count on Chance fail.
    sm_trigger_refire "0"

    // Trigger Multiple Commands plugin version.
    sm_trigger_version 


    How to use:
    • Add a new trigger and command by using the sm_trigger_add command. See below for examples.
    • Follow the menu to setup the trigger. Once complete you can access the main menu using the sm_trigger command.
    • Edit more options in the main menu for example to set the trigger box size.
    • Command arguments can be added with single and/or double quotes.
    • Create some test triggers and you'll see it's quite easy to use.



    Example commands:
    Code:
    // This will kill the player who walks into the box.
    sm_trigger_add sm_slay @me
    
    // You can use single and double quotes within the string. All of these are valid:
    sm_trigger_add say "Hello World"  // This is the best way since you can use more than 1 command.
    sm_trigger_add say Hello World    // This will work fine with the plugin for a single command.
    sm_trigger_add "say Hello World"  // This is bad.. The plugin will strip the first and last quote so best to avoid doing this.
    
    // Use the semicolon to split up and execute multiple commands.
    sm_trigger_add say "Hello world"; sm_cvar sv_alltalk '1'
    sm_trigger_add say "Hello world"; sm_cvar sv_alltalk "0"
    
    // You can make players/bots do things in-game with entities, for example pressing a button when they reach a certain area.
    // Use Stripper:Source to dump the map so you can find the targetname of what you want to activate.
    // See Valve's Developer Community wiki for details on the Ent_Fire command.
    
    // Triggers the elevator door to open on Dead Center map (c1m1_hotel) in Left4Dead2.
    sm_trigger_add Ent_Fire elevator_door_button1 press
    // Triggers the roller coaster to start on Dark Carnival map (c2m3_coaster) in Left4Dead2.
    sm_trigger_add Ent_Fire minifinale_button press


    Changes:
    Code:
    1.9 (20-Dec-2023)
        - Added option to fire triggers "Once per player", under the refire options menu. Requested by "replay_84".
    
    1.8 (01-Oct-2023)
        - Added a new menu option which allows requiring all players to be present to activate. Requested by "replay_84".
        - Added a debug option (requires recompile) to log various data when activating a trigger to determine where it fails.
        - Changed command "sm_trigger_dupe" to allow specifying an index to duplicate that trigger.
        - Duplicated triggers now copy the size of the trigger instead of setting to the default size.
        - Now when the plugin is late loaded, triggers will detect players inside and fire after being created if the criteria was met.
        - Lots of thanks to "replay_84" for tons of testing and reporting back.
    
    1.7 (02-Sep-2022)
        - Fixed client not connected errors. Thanks to "jjambo789" for reporting.
    
    1.6 (03-Jun-2022)
        - Fixed client not connected errors. Thanks to "ZBzibing" for reporting.
    
    1.5 (20-Apr-2021)
        - Fixed compile errors on SourceMod 1.11.
    
    1.4 (04-Jun-2020)
        - Fixed cvar config "sm_trigger.cfg" not being created.
        - Fixed previous version updates breaking the Show/Hide trigger beams.
        - Thanks to "Tonblader" for reporting.
    
    1.3 (10-May-2020)
        - Various changes to tidy up code.
        - Various optimizations and fixes.
    
    1.2 (05-May-2018)
        - Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
    
    1.1y (05-Sep-2016)
        - Update by "YoNer":
        - Added code that parses the command and replaces {me} with the clients ID.
        - This makes server commands execute commands on the player that activated the trigger.
    
    1.1 (25-Aug-2013)
        - Added command "sm_trigger_dupe" to create a trigger where you are and take the settings from another trigger.
        - Doubled the maximum string length for commands (to 128 chars).
        - Fixed the plugin not loading trigger boxes in Team Fortress 2.
    
    1.0 (20-Aug-2012)
        - Initial release.


    Installation:
    1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
    Attached Files
    File Type: sp Get Plugin or Get Source (sm_trigger_multiple_commands.sp - 145 views - 85.0 KB)
    __________________

    Last edited by Silvers; 12-19-2023 at 23:32.
    Silvers is offline
    friagram
    Veteran Member
    Join Date: Sep 2012
    Location: Silicon Valley
    Old 08-20-2013 , 11:32   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #2

    Seems a very odd way to do this. You have a lot of arrays of huge sizes, and then you hook single entity output.
    Why not just hook starttouch and endtouch, and store all of your triggers in tries or adt arrays? Obviously if it is hooked it is being tracked as one of your triggers, so just find it in the array...

    You can also just use a switch for hook type, so different callbacks do different things - right after you create the triggers, or when you edit/recreate them. Then you do not have to track as much stuff, since the callback will just do it.
    __________________
    Profile - Plugins
    Add me on steam if you are seeking sp/map/model commissions.
    friagram is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-20-2013 , 11:34   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #3

    I don't know how to use ADT arrays. Oh well. Edit: Also it's not very much memory anyway, does it matter so much?
    __________________

    Last edited by Silvers; 08-20-2013 at 11:35.
    Silvers is offline
    friagram
    Veteran Member
    Join Date: Sep 2012
    Location: Silicon Valley
    Old 08-20-2013 , 11:49   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #4

    Lots of arrays of 2048 is kind of a lot, but in the grand scheme of things it does not matter.
    Edit: my bad you set max entities to 64, typicaly this define is 2048, which is the engine max

    Adt arrays are ok, pretty good for stuff like this, esp if you use conservative things like onstarttouch and onendtouch that only fire rarely, since they are a little slow (though barely). They are simple to use though, and once you try, you will probably start using them a lot.

    http://docs.sourcemod.net/api/index....ad=file&id=46&
    Tries are great for storing information by keys, but they are by text strings, so you can use it for things like steam ids. You cannot index them like traditional arrays, if you really need to for some reason, you can do it with an adt array. Usually however, you just pull a value from the trie... Like check if a steam id is in it, and what the value is.

    http://docs.sourcemod.net/api/index....ad=file&id=35&
    Adt arrays are pretty much the same as traditional arrays, but you can dynamically resize them. There are also some useful functions for searching them.
    __________________
    Profile - Plugins
    Add me on steam if you are seeking sp/map/model commissions.

    Last edited by friagram; 08-20-2013 at 11:53.
    friagram is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-20-2013 , 11:53   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #5

    I should have made an effort to learn a while ago to learnt ADT arrays but laziness got the better of me though. Thanks for the info I'll check it out. It's unlikely I'll ever change this plugin to use them. Edit: Oh yeah this would have been much better and easier to use, what a shame. What's done is done lol.

    Edit2: Oh yeah I don't let people spawn more than 64, that's a limit I set in all my plugins which spawn stuff. But I see how ADT would be better without a limit and dynamically increasing the array size.
    __________________

    Last edited by Silvers; 08-20-2013 at 12:24.
    Silvers is offline
    XenTerSiO
    SourceMod Donor
    Join Date: Nov 2011
    Location: Black Mesa
    Old 08-20-2013 , 15:13   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #6

    Thanks! This plugin COOL!
    XenTerSiO is offline
    XenTerSiO
    SourceMod Donor
    Join Date: Nov 2011
    Location: Black Mesa
    Old 08-20-2013 , 15:26   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #7

    Could you add file translation?
    XenTerSiO is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-21-2013 , 10:37   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #8

    Translations would be a nightmare, rather than creating the menus once, I would have to create them every time they were used. It's something I won't do. The plugin only sends texts to admins which is another reason I didn't add translations.

    Nothings ever good enough, everyone wants the 1001 options you didn't add.
    __________________

    Last edited by Silvers; 08-21-2013 at 10:38.
    Silvers is offline
    scorpadorp
    SourceMod Donor
    Join Date: May 2012
    Location: NC
    Old 08-21-2013 , 22:23   Re: [ANY] Trigger Multiple Commands (1.0) [20-Aug-2013]
    Reply With Quote #9

    When I create a trigger box and save it, a new round seems to delete it and the menu keeps saying "No saved triggers were found."

    Any ideas?
    scorpadorp is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-24-2013 , 19:21   Re: [ANY] Trigger Multiple Commands (1.1) [25-Aug-2013]
    Reply With Quote #10

    Thanks for the bug report. Fixed.


    1.1 (25-Aug-2013)
    - Added command "sm_trigger_dupe" to create a trigger where you are and take the settings from another trigger.
    - Doubled the maximum string length for commands (to 128 chars).
    - Fixed the plugin not loading trigger boxes in Team Fortress 2.


    I may end up changing this to use dynamic arrays and strings.
    __________________
    Silvers 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:06.


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