AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D, L4D2] No Death Check Until Dead (https://forums.alliedmods.net/showthread.php?t=142432)

dcx2 09-21-2012 13:28

Re: [L4D, L4D2] No Death Check Until Dead
 
I'm not sure what you're trying to accomplish with your updates. Is my version somehow broken? I have no problem with it, we use this literally all the time, and we even switch with the bots using sb_takecontrol.

GsiX mentioned something about the EventHookMode_Pre, but in all of my experience modding L4D2, I have never seen the hook modes do anything useful. I see he recommends a timer after dying before clearing director_no_death_check (DNDC). I believe when I was isolating the all dead glitch, even changing DNDC after everyone was dead wouldn't solve the problem. I was *required* to temporarily clear DNDC every time a round starts, for at least 1.5 seconds, before I could allow it to be re-enabled. Then I could clear DNDC immediately upon player death and I *never* got the all dead glitch.

I'm not sure, but after reviewing the thread, I think you're trying to use scenario_end to circumvent the all dead glitch, and forcing scenario_end makes me uncomfortable, personally. For example, have you tested this in versus, scavenge, and survival to see what scenario_end does in those game modes?

I shy away from forcing allow_all_bot_survivor_team (AABST) to 1 every time deathcheck_bots == 0. I'm not sure if there are any other consequences associated with this cvar (aside from bots moving through the map when no humans are alive). That is why I only temporarily enable it when the door is closed and there are no humans alive. For others, it might be worth enabling AABST when no humans are alive even without the safe room door, so that the bots can go open a rescue closet for the player (and consider disabling AABST if you enabled it once they are rescued). However, we use sb_takecontrol (or sm_respawn if we're lazy), so this is not a concern for us.

I also recommend caching cvar values. If you look at my version, you will see that when I use HookConVarChange I also cache the new value of the cvar in a variable, this way I do not need to call GetConVarInt all the time. If possible, I also recommend adding the IsAllowedGameMode template that I took from SilverShot; this way admins can disable this plugin for versus if they want to.

IsClientConnected() is unnecessary if you use IsClientInGame(). IsClientInGame() returns false if a client is not connected, so there is no point in using IsClientConnected() first. https://forums.alliedmods.net/showthread.php?t=132438

@GsiX, you do not need to restart your game. Go to your server console window and type "sm plugins unload l4d_2_deathcheck; sm plugins load l4d_2_deathcheck; sm plugins refresh" and the plugin will be reloaded. This is easy for non-SDKHooks plugins, if you're using SDKHooks then it is more complicated and you will need an extra function to hook everyone after the plugin has late loaded. Fortunately this plugin doesn't use SDKHooks so it's easy.

Instead of commenting out debugging lines, I find it easier to use a debugging cvar. If you don't want a cvar, you could use macros to conditionally add/remove code by changing one #define at the top and recompiling, but I like cvars so that I can enable and disable debug output on-the-fly while in game. Additionally, if some other admin can reproduce a bug, they could enable the debugging output to provide additional information for the plugin developer.

Finally, when it comes to recommended plugins, you may want to add Survivor Bot Takeover to your list. This allows non-admin players to take control of a bot after they die. http://forums.alliedmods.net/showthread.php?p=1192594

GsiX 09-21-2012 15:06

Re: [L4D, L4D2] No Death Check Until Dead
 
It's okay i found a solution on my problem. Instead of check player on round_start or OnMapStart() or create timer all of them doesn't work for me so i tweak the plugin and check if there is 1 alive human on map for the first time, the plugin will kick in and start functioning, stop otherwise. Every time the round_end either all player are dead or stop the round by force, plugin will detect and automatically unload and stop functioning, it will come back load and functioning on the next round the plugin found 1 alive human. This way i don't need to worry about plugin kick twice or restart the map by force because there is always 1 human to be checked before we do next action.

And as i mentioned before, its not a game glitch so stop looking for game glitch.. it a sourcemod failure. The event bypass "EventHookMode_Pre", that why the old methood fail to set "director_no_death_check" back to "0" and result to non ending game. In english language, the plugin fail to set the cvar back to "0" before the event fired. It's rare so almost imposible to reproduce it.

dcx2 09-21-2012 15:25

Re: [L4D, L4D2] No Death Check Until Dead
 
Again, I have never seen EventHookMode_Pre make any difference for L4D2. Contrary to all Sourcemod documentation, modifying any arguments in a _Pre hook will have no effect on L4D2 whatsoever, that is why we need SDKHooks to do stuff like that. And if _Pre was the problem, changing it to _Post would have solved the problem. I remain unconvinced that it is a Sourcemod problem, especially in light of my own experience trying to solve the all dead glitch.

In my extensive testing, when a round begins DNDC MUST be set to 0 for a significant amount of time (at least 1.5 seconds proved to be safe). I cannot recall my precise method of reproducing the bug, but it typically involved starting a round, and then slaying myself, waiting a bit, then slaying all the bots.

You said you reviewed my version of the plugin, but did you actually try it on your server and manage to reproduce the all dead glitch?

GsiX 09-21-2012 15:32

Re: [L4D, L4D2] No Death Check Until Dead
 
Quote:

Originally Posted by dcx2 (Post 1803537)
modifying any arguments in a _Pre hook will have no effect on L4D2 whatsoever

You are wrong... not all but we still can modify some of the result of information before the event fire.
Try this, hook the event player dead (infected die) and change the information of who is the killer. Change the killer to your ID so even your team mate kill them you got score.. :)

EDIT: I don't own a sever..

GsiX 09-21-2012 15:46

Re: [L4D, L4D2] No Death Check Until Dead
 
Quote:

Originally Posted by dcx2 (Post 1803545)
Are you sure you get the score, or does it just affect the messages that are passed to clients for them to display? I would be very surprised if you actually got credit for the kill in the game's stats.

Try this. In player_hurt, if you are hurt, change your damage to 0. You will still be hurt. This is because you need OnTakeDamage from SDKHooks in order to block taking damage.

Haven't try to check the score yet. I never play versus so i didn't check score. Your info make sense.

GsiX 09-21-2012 15:57

Re: [L4D, L4D2] No Death Check Until Dead
 
1 Attachment(s)
We actually hijacking his thread. Anyway, back to business this is how i did mine, in case you found useful info.

NOTE: This .sp only reference and its a raw plugin. If anyone wish to use "l4d2_deathcheck", download from the first page released by the original author instead.

chinagreenelvis 09-21-2012 16:06

Re: [L4D, L4D2] No Death Check Until Dead
 
Quote:

I'm not sure what you're trying to accomplish with your updates.
I'm trying to keep authoring my own plugin without substituting the complete work of someone else. I appreciate your efforts, but if you'd rather just create a new thread for your version, I'd have literally no problem with that.

Quote:

GsiX mentioned something about the EventHookMode_Pre, but in all of my experience modding L4D2, I have never seen the hook modes do anything useful.
EvenHookMode_Pre allowed setting no_death_check to 1 on a player death to work as long as there weren't many calculations that happened before it. I was able to make literally one if statement, anything more would cause it to not happen.

Quote:

I'm not sure, but after reviewing the thread, I think you're trying to use scenario_end to circumvent the all dead glitch, and forcing scenario_end makes me uncomfortable, personally. For example, have you tested this in versus, scavenge, and survival to see what scenario_end does in those game modes?
No, and if someone finds a problem in those modes and they report it, I'll consider trying to find another way. For now, this is the simplest way of doing it.

Quote:

I shy away from forcing allow_all_bot_survivor_team (AABST) to 1 every time deathcheck_bots == 0.
I chose this not only to prevent situations like the one you described, but also for people who don't want to bother taking over survivor bots and would rather just be rescued instead.

Quote:

I also recommend caching cvar values. If you look at my version, you will see that when I use HookConVarChange I also cache the new value of the cvar in a variable, this way I do not need to call GetConVarInt all the time. If possible, I also recommend adding the IsAllowedGameMode template that I took from SilverShot; this way admins can disable this plugin for versus if they want to.
Currently the plugin can be disabled using the cvar "deathcheck 0". I will probably add game mode checks to all of my plugins at some point, but for now, I'm just trying to make sure it works.

Quote:

IsClientConnected() is unnecessary if you use IsClientInGame().
Good to know.

Quote:

Instead of commenting out debugging lines, I find it easier to use a debugging cvar. If you don't want a cvar, you could use macros to conditionally add/remove code by changing one #define at the top and recompiling, but I like cvars so that I can enable and disable debug output on-the-fly while in game. Additionally, if some other admin can reproduce a bug, they could enable the debugging output to provide additional information for the plugin developer.
That's nice, but I don't. Most of the time I don't want every single message being displayed, so I uncomment the ones I need to.

Quote:

Finally, when it comes to recommended plugins, you may want to add Survivor Bot Takeover to your list. This allows non-admin players to take control of a bot after they die.
Good suggestion.

chinagreenelvis 09-21-2012 16:12

Re: [L4D, L4D2] No Death Check Until Dead
 
GsiX - What's the difference between using OnGameFrame to test for an alive player and using player_first_spawn to enable the plugin? Or are you getting restarts when deathcheck_bots is 0?

GsiX 09-21-2012 16:18

Re: [L4D, L4D2] No Death Check Until Dead
 
player_first_spawn directly check (DeadCheck) if there is alive human or not.. Sometime on lag condition (i keep restart my game).. the round will end because the bot spawn first..

GsiX 09-21-2012 16:21

Re: [L4D, L4D2] No Death Check Until Dead
 
if you use timer same effect caused by lag.. u must expect this to happen..

EDIT: sorry i meant to edit my post above

EDIT EDIT: another thing is, i dont know why if i use timer on round_start (first time game loaded) to check alive human.. the timer repeat broken half way cause the plugin to never start until u suicide and kill all the bot using admin command to end the round just to get the plugin to start.


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

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