Has anyone tried adding more info_survivor_position in other maps to see if this fixes it?
Edit: So I modified this plugin a bit;
Quote:
Originally Posted by Shadowysn
A long time ago, I made a private plugin that attempts to prevent Survivors from dying or getting incapped when the rescue cutscene plays.
It even adds extra info_survivor_position entities to The Sacrifice finale, but only for 8 survivors.
Maybe in the future, it could be updated to visually hide the survivors via SetTransmit or teleport the rest to a survivor that's already set to a position.
I modified the check done for The Sacrifice finale, instead I check entities for a valid info_survivor_position entity, I store the position of the first one found, and then made the extra ones use that position instead of the hardcoded one in the plugin, so far testing with bots it seems to have worked?
Screenshot
In this same exact finale before with real players, we had the bug.
Edited Code
PHP Code:
#pragma newdecls required
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PLUGIN_NAME_SHORT "Finale Finish Godmode"
#define PLUGIN_NAME "[L4D2] Finale Finish Godmode"
#define PLUGIN_AUTHOR "Shadowysn"
#define PLUGIN_DESC "Give godmode to survivors upon finale vehicle leaving."
#define PLUGIN_VERSION "1.0.0"
#define PLUGIN_URL ""
//releaseFromPos = CreateConVar("sm_finalefinish_start_releasefrompos", "1.0", "Release survivors from position on start?", FCVAR_ARCHIVE, true, 0.0, true, 1.0);
int finale_ent = FindEntityByClassname(-1, "trigger_finale");
int finale_ent_dlc3 = FindEntityByClassname(-1, "trigger_finale_dlc3");
if (!IsValidEntity(finale_ent) || IsValidEntity(finale_ent_dlc3)) return;
bool isSacrificeFinale = view_as<bool>(GetEntProp(finale_ent, Prop_Data, "m_bIsSacrificeFinale"));
if (isSacrificeFinale) return;
for (int loopclient = 1; loopclient <= MAXPLAYERS; loopclient++) {
if (!IsValidClient(loopclient)) continue;
if (!IsSurvivor(loopclient) || !IsPlayerAlive(loopclient)) continue;
int takedamage = GetEntProp(loopclient, Prop_Data, "m_takedamage");
if (takedamage <= 0) continue;
SetEntProp(loopclient, Prop_Send, "m_currentReviveCount", GetConVarInt(FindConVar(CVAR_INCAPMAX)));
SetEntProp(loopclient, Prop_Data, "m_takedamage", 0);
}
}
bool IsValidClient(int client, bool replaycheck = true)
{
if (!IsValidEntity(client)) return false;
if (client <= 0 || client > MaxClients) return false;
if (!IsClientInGame(client)) return false;
//if (GetEntProp(client, Prop_Send, "m_bIsCoaching")) return false;
if (replaycheck)
{
if (IsClientSourceTV(client) || IsClientReplay(client)) return false;
}
return true;
}
bool IsSurvivor(int client)
{
if (!IsValidClient(client)) return false;
if (GetClientTeam(client) == 2) return true;
return false;
}
Here's a plugin I wrote a few days ago that supports both Left 4 Dead games and requires Left 4 DHooks. On every finale map, it looks for info_survivor_position entities and saves their coordinates in a simple array. Once the map starts, an X number of extra survivor positions are created (determined by l4d_esfp_amount [default is 4 for a total of 8 survivor positions]) while looping through the array for coordinates. So far, every survivor that stays alive after the rescue vehicle leaves count as "escaped" in the stats crawl.
Note #1: Death Toll finale doesn't seem to have any info_survivor_positions so survivors sometimes get left behind when the boat leaves and the stats crawl doesn't always count them as "escaped." To fix this, I hooked the trigger_finale's (and finale_trigger in some cases) "EscapeVehicleLeaving" entity output to warp all survivors back to the saferoom with godmode when no info_survivor_positions are found by the time they escape, and most of the time it counts towards them escaping.
The only downside to this is when a custom campaign may have the same feature as Dark Carnival's finale where clients stuck in the hallway under the bleachers when the finale starts will get kicked. Fortunately for Dark Carnival's finale, there are info_survivor_positions so the "warp all survivors back to the saferoom with godmode" feature never triggers for that finale.
Note #2: Apparently some finales create up to 12 info_survivor_positions but extra survivors are never warped to them. My guess is because some of them are flagged for different purposes, so the function that VALVe uses to warp survivors to info_survivor_position entities never use them. Thankfully, the ones that this plugin creates are detected to be used for extra survivors. That's why the convar l4d_esfp_amount is used to determine the number of extra survivor positions to create rather than simply counting the number of positions already present and comparing it to the number of survivors. If only it were that simple...
There's definitely a much better method out there but this is all I could come up with for now.
Here's a plugin I wrote a few days ago that supports both Left 4 Dead games and requires Left 4 DHooks. On every finale map, it looks for info_survivor_position entities and saves their coordinates in a simple array. Once the map starts, an X number of extra survivor positions are created (determined by l4d_esfp_amount [default is 4 for a total of 8 survivor positions]) while looping through the array for coordinates. So far, every survivor that stays alive after the rescue vehicle leaves count as "escaped" in the stats crawl.
Note #1: Death Toll finale doesn't seem to have any info_survivor_positions so survivors sometimes get left behind when the boat leaves and the stats crawl doesn't always count them as "escaped." To fix this, I hooked the trigger_finale's (and finale_trigger in some cases) "EscapeVehicleLeaving" entity output to warp all survivors back to the saferoom with godmode when no info_survivor_positions are found by the time they escape, and most of the time it counts towards them escaping.
The only downside to this is when a custom campaign may have the same feature as Dark Carnival's finale where clients stuck in the hallway under the bleachers when the finale starts will get kicked. Fortunately for Dark Carnival's finale, there are info_survivor_positions so the "warp all survivors back to the saferoom with godmode" feature never triggers for that finale.
Note #2: Apparently some finales create up to 12 info_survivor_positions but extra survivors are never warped to them. My guess is because some of them are flagged for different purposes, so the function that VALVe uses to warp survivors to info_survivor_position entities never use them. Thankfully, the ones that this plugin creates are detected to be used for extra survivors. That's why the convar l4d_esfp_amount is used to determine the number of extra survivor positions to create rather than simply counting the number of positions already present and comparing it to the number of survivors. If only it were that simple...
There's definitely a much better method out there but this is all I could come up with for now.
Still getting the random deaths even with this loaded.
Examples
Last Stand - 4 bots (l4d1 crew) and me as a l4d2 survivor, the escape happens and it counts me as dead.
Blood Harvest - Same scenario as above, except it counted one of the bots as dead when the rescue vehicle left.
Still getting the random deaths even with this loaded.
Examples
Last Stand - 4 bots (l4d1 crew) and me as a l4d2 survivor, the escape happens and it counts me as dead.
Blood Harvest - Same scenario as above, except it counted one of the bots as dead when the rescue vehicle left.
It's most likely because m_takedamage 0 does not prevent incaps from happening if the damage is higher than the survivor's health.
That's why I had to set the survivors to the maximum amount of allowed incaps a.k.a. Black And White mode so the incapacitation checks don't get called.
PHP Code:
public void FinaleHook(const char[] output, int caller, int activator, float delay) { if (caller > MaxClients && IsValidEntity(caller)) { for (int iSurvivor = 1; iSurvivor <= MaxClients; iSurvivor++) { if (bIsSurvivor(iSurvivor)) { //PrintToServer("Gave %N godmode.", iSurvivor); //LogMessage("Gave %N godmode.", iSurvivor);
SetEntProp(iSurvivor, Prop_Data, "m_takedamage", 0, 1); // This doesn't prevent incaps
if (FindEntityByClassname(-1, "info_survivor_position") == -1) { //PrintToServer("Teleported %N back to saferoom: %.2f %.2f %.2f", iSurvivor, g_flSaferoomPosition[iSurvivor][0], g_flSaferoomPosition[iSurvivor][1], g_flSaferoomPosition[iSurvivor][2]); //LogMessage("Teleported %N back to saferoom: %.2f %.2f %.2f", iSurvivor, g_flSaferoomPosition[iSurvivor][0], g_flSaferoomPosition[iSurvivor][1], g_flSaferoomPosition[iSurvivor][2]);
So far it seems to work in base game campaigns, however we did Military Industrial Complex II V11 custom campaign and the bug happened there.
Can you verify if that campaign's finale has any info_survivor_position entities spawned in or if the teleportation failsafe isn't working? Have you tested the finale more than once; is it consistent or random? I'm not sure what requirements it has for counting extra survivors as "escaped." That's the tricky part about custom campaigns; they don't always follow standard VALVe procedure so not all plugins that seem compatible with the official campaigns are guaranteed to work fine on them.
Would spawning the missing "info_survivor_position" as required for number of clients work to fix the issue?
Once this issue is fixed someone should release as a plugin so it's noticed more and a standard version. This thread like many older unsupported plugins become confusing with so many different versions posted and people using different ones, it becomes a mess of knowing which one to use etc. Then people start modifying from different versions and we end up with 2 new versions based on completely different older versions, where 1 fixes X bugs and the other fixes Y bugs but both fail to fix XY bugs together. Seen this with several older popular plugins from inactive authors.
Would spawning the missing "info_survivor_position" as required for number of clients work to fix the issue?
Once this issue is fixed someone should release as a plugin so it's noticed more and a standard version. This thread like many older unsupported plugins become confusing with so many different versions posted and people using different ones, it becomes a mess of knowing which one to use etc. Then people start modifying from different versions and we end up with 2 new versions based on completely different older versions, where 1 fixes X bugs and the other fixes Y bugs but both fail to fix XY bugs together. Seen this with several older popular plugins from inactive authors.
Honestly, I'm unsure. If only the function that VALVe uses to spawn X info_survivor_position entities could be patched to modify how many it spawns. The way I've done it is dirty and isn't guaranteed to work on every finale map, but if we could directly access the function that creates these entities and tell it to spawn X numbers of positions, it should work on any finale map.