Raised This Month: $7 Target: $400
 1% 

[L4D] Achievement Notifier


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Fexii
Junior Member
Join Date: Dec 2008
Plugin ID:
677
Plugin Version:
1.0
Plugin Category:
Statistical
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    1 
    Plugin Description:
    Displays notifications about achievement completion during gameplay
    Old 12-14-2008 , 22:10   [L4D] Achievement Notifier
    Reply With Quote #1

    Left 4 Dead Achievement Notifier
    by Fexii

    Description


    Achievements can be frustrating to complete because many of them require you to finish the entire campaign before finding out whether or not you've succeeded. This plugin patches this by providing messages as soon as an infraction against achievement completion occurs.

    Current Achievements Tracked
    SAFETY FIRST
    Play an entire campaign with no Survivors taking friendly fire damage.

    STOMACH UPSET
    All Survivors complete a campaign without being vomited on.

    UNTOUCHABLES
    No Survivors take damage after contacting the rescue vehicle.
    Install

    Place "achievementnotifier.smx" in your left4dead/addons/sourcemod/plugins folder.
    Place "achievementnotifier.phrases.txt" in your left4dead/addons/sourcemod/translations folder.

    Usage

    The plugin is automatically enabled when the server starts a campaign mode map. Whenever an achievement is prevented, a message with details will appear to all players.

    Saying "!achievements" during the game will show which achievements have been prevented and which are still attainable. This is disabled during versus mode.

    sm_achievement_notify <0/1> - Toggles the plugin. Requires a map restart when changed.
    sm_achievement_notify_connect_message <0/1> - Display a message when the user connects that tells them about the "!achievements" command.

    Changelog

    Version 1.0
    - Initial Release with Safety First, Stomach Upset, Untouchables
    - Fixed repeated hooks when the round starts
    - Now registers the command sm_achievements
    - Fixed leftover debug code that caused chat to appear whenever a player is hurt

    Notes

    Please let me know about bugs in this thread. The achievements system is somewhat buggy to begin with, but I'll do my best to model this plugin after the actual achievement requirements based on feedback.

    I plan to add more achievements over time, starting with the more frustrating ones first.

    Attached Files
    File Type: txt achievementnotifier.phrases.txt (598 Bytes, 3195 views)
    File Type: sp Get Plugin or Get Source (achievementnotifier.sp - 5537 views - 8.2 KB)

    Last edited by Fexii; 12-18-2008 at 11:05.
    Fexii is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 12-14-2008 , 22:16   Re: [L4D] Achievement Notifier
    Reply With Quote #2

    This is very helpful. Good job.

    One thing to note after a quick look. It looks like you hook events in round start and unhook when map ends... If round start occurs more than once in a map you will stack event hooks. Not a good thing.
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?

    Last edited by Antithasys; 12-14-2008 at 22:18.
    Antithasys is offline
    Fexii
    Junior Member
    Join Date: Dec 2008
    Old 12-14-2008 , 22:59   Re: [L4D] Achievement Notifier
    Reply With Quote #3

    Quote:
    Originally Posted by Antithasys View Post
    This is very helpful. Good job.

    One thing to note after a quick look. It looks like you hook events in round start and unhook when map ends... If round start occurs more than once in a map you will stack event hooks. Not a good thing.
    You're right, that's a problem I'll fix soon. Thanks!

    Edit: I added a one-liner since I already had the boolean sitting around whenever I hook. Hopefully that fixes it.

    Last edited by Fexii; 12-14-2008 at 23:03.
    Fexii is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 12-15-2008 , 00:44   Re: [L4D] Achievement Notifier
    Reply With Quote #4

    Further suggestions. I always wonder why people hook the say command when all they want is the chat trigger. Sourcemod does all this for you. Creating your own console command is the way to go.

    Replace:
    PHP Code:
    RegConsoleCmd("say"Command_SayChat);
     
    public 
    Action:Command_SayChat(clientargs)

     
    decl String:text[192];
     if (!
    GetConVarBool(cvPluginEnabled) ||
         
    IsChatTrigger() ||
      
    GetCmdArgString(textsizeof(text)) < 1)
      return 
    Plugin_Continue;
     
     
    ReplaceString(textsizeof(text), "\"""");
     
    ReplaceString(textsizeof(text), " """);
     
     if (
    StrEqual(text"!achievements"))
     {
      
    DisplayAchievements(client);
      return 
    Plugin_Handled;
     }
     
     return 
    Plugin_Continue;

    With:

    PHP Code:
    RegConsoleCmd("sm_achievements"Command_DisplayAchievements"Display Achievements");
     
    public 
    Action:Command_DisplayAchievements(clientargs)

     if (
    GetConVarBool(cvPluginEnabled))
         
    DisplayAchievements(client);
     return 
    Plugin_Handled;

    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?

    Last edited by DJ Tsunami; 12-15-2008 at 06:49. Reason: Fixed some errors in your code :P
    Antithasys is offline
    Fexii
    Junior Member
    Join Date: Dec 2008
    Old 12-15-2008 , 01:50   Re: [L4D] Achievement Notifier
    Reply With Quote #5

    Quote:
    Originally Posted by Antithasys View Post
    Further suggestions. I always wonder why people hook the say command when all they want is the chat trigger. Sourcemod does all this for you. Creating your own console command is the way to go.
    That's great! I literally found out about SourceMod yesterday, so thanks for pointing out newbie mistakes. Riding off examples only gets me so far and I appreciate the specific coding feedback.

    Posting update with the new console command hook.

    Last edited by Fexii; 12-15-2008 at 01:55.
    Fexii is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 12-15-2008 , 15:37   Re: [L4D] Achievement Notifier
    Reply With Quote #6

    One last suggestion. As an author I always like to track how many servers use my plugins. You can do this with a public cvar.

    PHP Code:
    public OnPluginStart()
    {
      
    CreateConVar("achnotifier_version"PLUGIN_VERSION"Achievement Notifier"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);

    That way the stats part of the forums and game-monitor.com will be able to track what servers, and how many of them, are using your plugin.

    A public cvar is not required, thou i think it should be , to be approved. Just a suggestion.

    I will wait a bit to approve this in case you decide to do it, as if you do it later it has to go thru the approval process again.
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?
    Antithasys is offline
    Fexii
    Junior Member
    Join Date: Dec 2008
    Old 12-15-2008 , 18:10   Re: [L4D] Achievement Notifier
    Reply With Quote #7

    Quote:
    Originally Posted by Antithasys View Post
    One last suggestion. As an author I always like to track how many servers use my plugins. You can do this with a public cvar.
    Thank you again

    Now that "public cvar" field makes much more sense!
    Fexii is offline
    L4DHelp
    Member
    Join Date: Dec 2008
    Old 12-17-2008 , 08:26   Re: [L4D] Achievement Notifier
    Reply With Quote #8

    This is a brilliant idea! I am deffinatly going to use this on my server, thank you Fexii

    +1
    L4DHelp is offline
    Zigian
    New Member
    Join Date: Dec 2008
    Old 12-22-2008 , 13:25   Re: [L4D] Achievement Notifier
    Reply With Quote #9

    Any work going on to get this to monitor the "Nothing Special" achievement?
    Zigian is offline
    Fexii
    Junior Member
    Join Date: Dec 2008
    Old 12-22-2008 , 23:17   Re: [L4D] Achievement Notifier
    Reply With Quote #10

    Quote:
    Originally Posted by Zigian View Post
    Any work going on to get this to monitor the "Nothing Special" achievement?
    I've been taking finals recently, so I haven't been able to add achievements yet. Nothing Special is definitely highest on my priority list. I tried implementing it about a week ago with problems.

    I'm having trouble detecting players getting hurt by boomers by the boomer sliming the player then having other zombies attack her. It counts against the Nothing Special achievement, but I don't see a straightforward way to detect it using Game Events. If any other SourceMod coders have advice I'd appreciate it
    Fexii is offline
    Reply


    Thread Tools
    Display Modes

    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 23:01.


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