AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D] Achievement Notifier (https://forums.alliedmods.net/showthread.php?t=81992)

Fexii 12-14-2008 22:10

[L4D] Achievement Notifier
 
6 Attachment(s)
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.


Antithasys 12-14-2008 22:16

Re: [L4D] Achievement Notifier
 
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.

Fexii 12-14-2008 22:59

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Antithasys (Post 727553)
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.

Antithasys 12-15-2008 00:44

Re: [L4D] Achievement Notifier
 
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;



Fexii 12-15-2008 01:50

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Antithasys (Post 727599)
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. :mrgreen:

Posting update with the new console command hook.

Antithasys 12-15-2008 15:37

Re: [L4D] Achievement Notifier
 
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.

Fexii 12-15-2008 18:10

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Antithasys (Post 727859)
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!

L4DHelp 12-17-2008 08:26

Re: [L4D] Achievement Notifier
 
This is a brilliant idea! I am deffinatly going to use this on my server, thank you Fexii :D

+1

Zigian 12-22-2008 13:25

Re: [L4D] Achievement Notifier
 
Any work going on to get this to monitor the "Nothing Special" achievement?

Fexii 12-22-2008 23:17

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Zigian (Post 731512)
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 :mrgreen:

Antithasys 12-23-2008 01:02

Re: [L4D] Achievement Notifier
 
I think the events you are looking for are:

player_now_it (got slimed)
player_no_longer_it (no longer slimed)

If they get damaged by infected during that time wouldn't that do it?

Zigian 12-23-2008 15:15

Re: [L4D] Achievement Notifier
 
Very cool. Looking forward to an update. I hope the response above helps. Thanks for the plugin!!!

Zigian 12-23-2008 21:36

Re: [L4D] Achievement Notifier
 
For some reason, when the server goes to the next map in a campaign, it's killing the achievements. Anyone have this problem before?

L4DHelp 12-28-2008 10:13

Re: [L4D] Achievement Notifier
 
Any news on more achievements?

ApocalypseDan 01-12-2009 07:04

Re: [L4D] Achievement Notifier
 
Hi everyone i have just rented my 1st L4D server and like the sounds of this plugin when i went to my FTP in my L4D game folder there was no addons folder so i do i just add the folders needed to run this plugin

L4D/addons/sourcemod/plugins/ then add the file to this and the same for the translation ?

I am new to plugins so i am very sorry to be such a newbie many thanks in advance

ApocalypseDan :oops:

bman87 01-12-2009 08:34

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by ApocalypseDan (Post 742689)
Hi everyone i have just rented my 1st L4D server and like the sounds of this plugin when i went to my FTP in my L4D game folder there was no addons folder so i do i just add the folders needed to run this plugin

L4D/addons/sourcemod/plugins/ then add the file to this and the same for the translation ?

I am new to plugins so i am very sorry to be such a newbie many thanks in advance

ApocalypseDan :oops:

First you need to install MetaMod:Source and SourceMod. After that you will have the folders.

http://wiki.alliedmods.net/Installing_Metamod:Source
http://wiki.alliedmods.net/Installing_SourceMod

Make sure you use SM 1.2, this version supports L4D.
http://www.sourcemod.net/snapshots-1.2.php

Durzel 01-12-2009 08:48

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Antithasys (Post 727599)
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;



As elegant as this is the only problem I can forsee is that it requires users to have access to the console. Some players don't even know what the console is, much less how to enable it and which key brings it down. Telling those people just to type a command in say is a lot easier than trying to teach them to bring up the console and type a command.

Code wise though the console command method is a lot more elegant.

bl4nk 01-12-2009 19:25

Re: [L4D] Achievement Notifier
 
Hooking a console command allows you to call it via chat trigger (in this case you would still do !achievements in chat).

omadhaun 01-18-2009 20:41

Re: [L4D] Achievement Notifier
 
Any update as to how the "Nothing Special" achievement is being added to the plugin? To be honest, I wouldn't mind using a copy that works with everything but the boomer vomit for testing.

Vicious Angel 01-19-2009 10:32

Re: [L4D] Achievement Notifier
 
Hi Fexii, hi guys

What an awsome plugin you've made here :)

I have one little problem with it tho. I have exactly the same problem as Zigian described a few posts earlier.

More precisely, i tried easy and normal no mercy campain and each time we moved on to the second round, Safety First and Stomach Upset were prevented for no reason (we were not hit by boomers and didn't make any team attack during first round).

I'm running the latest 1.2.0.2534 sourcemod snapshot with the latest metamod 1.7.0 version and i have only three plugins running (including yours)

* Achievement Notifier (http://forums.alliedmods.net/showthread.php?p=727548)
* Voting Manager (http://forums.alliedmods.net/showthread.php?p=718773)
* Unscrambler (http://forums.alliedmods.net/showthread.php?p=730278)

If any of you guys have a thought on that it's very welcome.

Vicious Angel 01-19-2009 14:51

Re: [L4D] Achievement Notifier
 
I had a closer look to your code and i think this fonction is not working :

PHP Code:

public OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
isMapTransition true;


I think it's not going into the function so the variable isMapTransition is still false instead of being true.

The thing is i dunno if it's caused by the sourcemod 1.2.0.2534 version or if it's not the proper function called ?

blah604 01-20-2009 21:02

Re: [L4D] Achievement Notifier
 
so not all the achievement can be achieved by this.

omadhaun 01-20-2009 21:06

Re: [L4D] Achievement Notifier
 
Currently, it is designed to notify the players running a campaign regarding which achievements are currently possible based on their actions to that point.

However, this version only notifies players about the following achievement's status:
Safety First
Untouchables
Stomach Upset

blah604 01-20-2009 23:26

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by omadhaun (Post 747381)
Currently, it is designed to notify the players running a campaign regarding which achievements are currently possible based on their actions to that point.

However, this version only notifies players about the following achievement's status:
Safety First
Untouchables
Stomach Upset

like the HUD? on tf2? i thought this helps you get the achievement w/o doing it just type !achievements

omadhaun 01-22-2009 23:30

Re: [L4D] Achievement Notifier
 
Yes, it is similar to the TF2's HUD in the sense that you can see which of the selected achievements are possible at any moment during a campaign on a server running this plug-in.

Unfortunately it doesn't keep the cheev status on the screen at all times. It notifies you when a cheev is no longer possible, and when manually called up using the "!achievements" say command.

ApocalypseDan 01-25-2009 10:05

Re: [L4D] Achievement Notifier
 
Just to let you know When you enter a safe room the Safety first achievment becomes unobtainable but it dose not mean any one has shot any one.
Great pluging though many thanks

omadhaun 01-26-2009 22:05

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by ApocalypseDan (Post 749845)
Just to let you know When you enter a safe room the Safety first achievment becomes unobtainable but it dose not mean any one has shot any one.
Great pluging though many thanks

Yes, this also affects Stomach Upset. Something is not working in the code with the "isMapTransition" or so it seems.

Vicious Angel 01-31-2009 07:00

Re: [L4D] Achievement Notifier
 
1 Attachment(s)
I found out what was the problem. Each new round the plugin is executed 2 times (certainly due to L4D itself). The direct consequence to this is that instead of being TRUE, isMapTransition is FALSE.

The solution i found is to use an integer counter rather than a boolean.

I've attached my corrected plugin. It works :)

rennex 02-04-2009 20:54

Re: [L4D] Achievement Notifier
 
Quote:

Originally Posted by Vicious Angel (Post 753125)
I've attached my corrected plugin. It works :)

Looks like your code sets EndRoundCounter to zero whenever any vote passes (line 221). You can remove that line, since ResetAllAchievements() is called if the vote was to restart the campaign.

I can't comment on the other changes, I'll take your word that they work :wink:

Fexii: we want Nothing Special! Please hurry :mrgreen:

Wild1234 03-07-2009 18:01

Re: [L4D] Achievement Notifier
 
1 Attachment(s)
Quote:

Originally Posted by rennex (Post 755923)
Looks like your code sets EndRoundCounter to zero whenever any vote passes (line 221). You can remove that line, since ResetAllAchievements() is called if the vote was to restart the campaign.

I can't comment on the other changes, I'll take your word that they work :wink:

Fexii: we want Nothing Special! Please hurry :mrgreen:

Well, here is a little attempt I made to make it track nothing special. Don't think it will count an attack from a witch as she oddly seems to count the same as being hit by a normal zombie on the player_hurt event. But if you don't notice when she hits you, you have more problems than just trying to get that achievement:)

Seems to work from the testing I've done so far, hopefully somebody will find this useful.

ZNemesis 03-26-2009 01:36

Re: [L4D] Achievement Notifier
 
1 Attachment(s)
I have independantly written an update to this mod which includes Nothing Special.

Compared to the other versions of this mod:
* Being incapacitated now disqualifies you for achievements correctly
* Nothing Special is not disqualified if you are hit while someone else has vomit on them
* Voting to restart the campaign will not reset the achievements (until the new round starts)
* Performance improvements

I have extensively tested my mod.

I don't know if witch damage counts towards disqualification of Nothing Special. I'm going to go with random Gamespot forum poster and say it doesn't, but I've added the code anyway, so its a simple uncomment to enable it.

Thanks to everyone else who worked on this mod, so I didn't have to learn SourceMod from scratch.

Dark Kill 1s 04-16-2009 10:53

Re: [L4D] Achievement Notifier
 
this looks really great,
and if i understand it good,
then i can join a randon server and this will just work?

Roachy 05-04-2009 01:00

Re: [L4D] Achievement Notifier
 
I'm running ZNemesis' mod of this plugin, with the witch code uncommented (because I was always under the impression that witch damage counted as ruining the Nothing Special achievement), and it seems to crash the server on map change sometimes.

Any ideas?

slims 05-09-2009 09:23

Re: [L4D] Achievement Notifier
 
This is the worst plugin ever. I love the idea, but when implemented on a 1.0.1.3 server it cost me hours of game time. Every version in this thread causes the server to crash at one map change or another, nullifying entire campaign achievements. The ones that claim to track Safety First correctly in fact just track it correctly until the 3rd level, where they break too. The Nothing Special mods crash on the second level every time.

I'm a developer myself so I understand not having time to dedicate, especially if you already have the achievement.
This is mostly a warning to those who want to use this to help them along in their achievements - DONT!

BarkerJr 05-09-2009 16:57

Re: [L4D] Achievement Notifier
 
It doesn't crash for me. And it's running on 120 servers, so you may be blaming the wrong plugin.

ZNemesis 05-12-2009 08:08

Re: [L4D] Achievement Notifier
 
1 Attachment(s)
I am attempting to replicate the crashes people are experiencing. So far, I have gotten it to crash under Vista x64, I have no idea why it is different to XP x86, where it doesn't crash. Also when a client connects to a dedicated server on the same computer, it can crash. I don't have a Linux machine to test the dedicated server there.

In the meantime, here is a small update:
  • Will no longer track achievements in survival mode or custom versus maps.

PatPeter 06-22-2010 21:47

Re: [L4D] Achievement Notifier
 
Alright I have questions for everyone and the two below.

To everyone:
I used this plugin on a server not my own months ago. We tried to get barf bagged. Now obviously if you get barfed and you all die it resets the achievement counter in VALVe's achievement system. This plugin didn't. When we got barfed, we purposely wiped and it still said we were ineligible, it did not reset.

So my question is is this fixed in the OP's or anyone else's (4 other versions) posted?

To you two:
Quote:

Originally Posted by Wild1234 (Post 776080)
Well, here is a little attempt I made to make it track nothing special. Don't think it will count an attack from a witch as she oddly seems to count the same as being hit by a normal zombie on the player_hurt event. But if you don't notice when she hits you, you have more problems than just trying to get that achievement:)

Seems to work from the testing I've done so far, hopefully somebody will find this useful.

Did you work on your plugin from Vicious Angel's version of the plugin or the OP?

Also, for the witch I would try to register from when the witch activates to when a player incaps (teammates save him) or dies (if the player was B&W). If the witch incaps a player (player_hurt has the source of the damage does it not?), Nothing Special is ineligible. If the witch kills someone (player_death) then Noting Special is ineligible.

Quote:

Originally Posted by ZNemesis (Post 789278)
I have independantly written an update to this mod which includes Nothing Special.

Compared to the other versions of this mod:
* Being incapacitated now disqualifies you for achievements correctly
* Nothing Special is not disqualified if you are hit while someone else has vomit on them
* Voting to restart the campaign will not reset the achievements (until the new round starts)
* Performance improvements

I have extensively tested my mod.

I don't know if witch damage counts towards disqualification of Nothing Special. I'm going to go with random Gamespot forum poster and say it doesn't, but I've added the code anyway, so its a simple uncomment to enable it.

Thanks to everyone else who worked on this mod, so I didn't have to learn SourceMod from scratch.

So you based this post off the OP's and not Vicious Angel's? Or did you really start the entire thing from scratch?

GameSpot is a horrible source, witches and tanks do indeed nullify Nothing Special.

Quote:

Originally Posted by ZNemesis (Post 826128)
I am attempting to replicate the crashes people are experiencing. So far, I have gotten it to crash under Vista x64, I have no idea why it is different to XP x86, where it doesn't crash. Also when a client connects to a dedicated server on the same computer, it can crash. I don't have a Linux machine to test the dedicated server there.

In the meantime, here is a small update:
  • Will no longer track achievements in survival mode or custom versus maps.

Custom versus maps don't track achievements?

nedd 08-02-2010 18:38

Re: [L4D] Achievement Notifier
 
I use this plugin on my server, works well.
Thanks Fexii and ZNemesis.


Quote:

Originally Posted by PatPeter (Post 1216759)
GameSpot is a horrible source, witches and tanks do indeed nullify Nothing Special.

Tanks nullify, witches do not.

Use the report function in the console when playing to see for yourself.


All times are GMT -4. The time now is 06:43.

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