Sadly you can not change the scene file once it has spawned. The alternative is to using CancelScene and then PerformScene with your wanted new scene file. If you know exactly which scene file you wish to use, instead of vocalize line, I would suggest using PerformSceneEx to make it happen exactly the next frame.
Thank you, this is exactly what I was looking for.
I think cancelling the scene and immediately performing the new one better fits my needs, as I need the survivors to react to the original scene if possible...
First, I'd like to sincerely thank you for your continued patience to all of my questions, not everybody takes the time to kindly and properly inform a stranger online
With that established...
I took your example code and used it to achieve a certain goal *cough*Fake Zoey*cough*.
However, I can't seem to get it to work as I want it to, here's part of the code...
Spoiler
PHP Code:
public OnSceneStageChanged(scene, SceneStages:stage) { if (stage != SceneStage_Spawned || GetSceneInitiator(scene) == SCENE_INITIATOR_PLUGIN /* Do not capture scenes spawned by the plugin, to prevent a loop */) { return }
decl String:scenefile[MAX_SCENEFILE_LENGTH]; GetSceneFile(scene, scenefile, sizeof(scenefile)); new float:preDelay = GetScenePreDelay(scene); new float:pitch = GetScenePitch(scene); new actor = GetActorFromScene(scene);
if (actor <= 0 || actor > MaxClients || !IsClientInGame(actor)) { return }
new i_RNG, i_Type; decl String:s_Model[64];
// Get survivor model GetEntPropString(actor, Prop_Data, "m_ModelName", s_Model, 64);
// Verifying if the Client is using Zoey's Character Model // If not, plugin won't affect the player if(!StrEqual(s_Model, "models/survivors/survivor_teenangst.mdl")) { return }
// Now we declare all of the scenes that INITIATOR_WORLD creates that we need to replace with Zoey's.
// Because some survivors have problems when clones exist, we use Nick, // as Multiple Nicks all vocalize properly
if(i_Type == 0) { i_RNG = GetRandomInt(1, 4); { switch (i_RNG) { case 1: s_Vocalize = "scenes/TeenGirl/IncapacitatedInitial01.vcd"; case 2: s_Vocalize = "scenes/TeenGirl/IncapacitatedInitial02.vcd"; case 3: s_Vocalize = "scenes/TeenGirl/IncapacitatedInitial03.vcd"; case 4: s_Vocalize = "scenes/TeenGirl/IncapacitatedInitial05.vcd"; } } }
else if(i_Type == 1) { i_RNG = GetRandomInt(1, 4); { switch (i_RNG) { case 1: s_Vocalize = "scenes/TeenGirl/IncapacitatedInjury01.vcd"; case 2: s_Vocalize = "scenes/TeenGirl/IncapacitatedInjury02.vcd"; case 3: s_Vocalize = "scenes/TeenGirl/IncapacitatedInjury03.vcd"; case 4: s_Vocalize = "scenes/TeenGirl/IncapacitatedInjury04.vcd"; } } }
else if(i_Type == 2) { i_RNG = GetRandomInt(1, 27); { switch (i_RNG) { case 1: s_Vocalize = "scenes/TeenGirl/Dying01.vcd"; case 2: s_Vocalize = "scenes/TeenGirl/Dying02.vcd"; case 3: s_Vocalize = "scenes/TeenGirl/Dying03.vcd"; case 4: s_Vocalize = "scenes/TeenGirl/Dying04.vcd"; case 5: s_Vocalize = "scenes/TeenGirl/Dying05.vcd"; case 6: s_Vocalize = "scenes/TeenGirl/Help01.vcd"; case 7: s_Vocalize = "scenes/TeenGirl/Help02.vcd" ; case 8: s_Vocalize = "scenes/TeenGirl/Help03.vcd" ; case 9: s_Vocalize = "scenes/TeenGirl/Help04.vcd" ; case 10: s_Vocalize = "scenes/TeenGirl/Help07.vcd" ; case 11: s_Vocalize = "scenes/TeenGirl/Help08.vcd" ; case 12: s_Vocalize = "scenes/TeenGirl/Help12.vcd"; case 13: s_Vocalize = "scenes/TeenGirl/Help13.vcd"; case 14: s_Vocalize = "scenes/TeenGirl/Help14.vcd"; case 15: s_Vocalize = "scenes/TeenGirl/Help15.vcd"; case 16: s_Vocalize = "scenes/TeenGirl/Help16.vcd"; case 17: s_Vocalize = "scenes/TeenGirl/Help17.vcd"; case 18: s_Vocalize = "scenes/TeenGirl/LedgeHangEnd02.vcd"; case 19: s_Vocalize = "scenes/TeenGirl/LedgeHangEnd06.vcd"; case 20: s_Vocalize = "scenes/TeenGirl/LedgeHangEnd17.vcd"; case 21: s_Vocalize = "scenes/TeenGirl/LedgeHangEnd21.vcd"; case 22: s_Vocalize = "scenes/TeenGirl/LedgeHangMiddle09.vcd"; case 23: s_Vocalize = "scenes/TeenGirl/LedgeHangStart03.vcd"; case 24: s_Vocalize = "scenes/TeenGirl/LedgeHangStart04.vcd"; case 25: s_Vocalize = "scenes/TeenGirl/LedgeHangStart05.vcd"; case 26: s_Vocalize = "scenes/TeenGirl/LedgeHangStart06.vcd"; case 27: s_Vocalize = "scenes/TeenGirl/LedgeHangStart10.vcd"; } } } else { PrintToChatAll( "i_Type was invalid!") return; }
if(actor > 0) /* Make sure the actor is valid, there are cases where the "world" uses vocalize lines, such as Whittalker or Virgil the talking boat. */ { CancelScene(scene); PerformSceneEx(actor, "", s_Vocalize, preDelay, pitch, SCENE_INITIATOR_PLUGIN) } }
This is just a snippet, there are more i_Types declared and replaced with switches, but I snipped them for the sake of condensation.
The scenes being looked out for are the EXACT scenes I have in my Talker Addon, however, sometimes the scenes are captured, and at other times, they're completely ignored?
Also, I don't know if this is important or not, but the following line give me a "Argument type mismatch" on compile;
PHP Code:
new float:preDelay = GetScenePreDelay(scene); new float:pitch = GetScenePitch(scene);
// And this line PerformSceneEx(actor, "", s_Vocalize, preDelay, pitch, SCENE_INITIATOR_PLUGIN)
I don't think I'm doing anything wrong, maybe it's how I set up the scene replacement?
I took your example code and used it to achieve a certain goal *cough*Fake Zoey*cough*.
While I am completely against this solution as it comes with a myriad of other problems, it should be possible. Do you mind me asking why you are not setting up a Linux dedicated server instead to completely side step this issue?
However I would probably change it so script would not have to continusly loop over strings but instead use a trie in this case since you already know which lines you wish to convert. I have typed up another loose example (e.g. not tested). Complete with debug function to hopefully help you out understand why it is not replacing lines.
Spoiler
PHP Code:
/* Includes */
#include <sourcemod>
#include <sceneprocessor>
/* Plugin Information */
public Plugin:myinfo = {
name = "Fake Zoey",
author = "DeathChaos25 & Buster \"Mr. Zero\" Nielsen",
description = "Implements a fake Zoey makeup to Nick",
version = "1.0.0",
url = "https://forums.alliedmods.net/showthread.php?t=241585"
}
/* Globals */
#define DEBUG 1 /* Change this to 0 to disable debug info to be printed */
#define DEBUG_TAG "Fake Zoey"
#define DEBUG_PRINT_FORMAT "[%s] %s"
public OnSceneStageChanged(scene, SceneStages:stage)
{
if (stage != SceneStage_Spawned || GetSceneInitiator(scene) == SCENE_INITIATOR_PLUGIN /* Do not capture scenes spawned by the plugin, to prevent a loop */)
return
new actor = GetActorFromScene(scene)
if (actor <= 0 || actor > MaxClients || !IsClientInGame(actor))
return
decl String:model[PLATFORM_MAX_PATH]
GetClientModel(actor, model, sizeof(model))
if (!StrEqual(model, MODEL_SURVIVOR_ZOEY))
return
decl String:sceneFile[MAX_SCENEFILE_LENGTH]
/* Never ever print uninitialized strings as it may contain anything
* from sensitive data to straight up crashing players game. Since the debug
* function prints 'newSceneFile' string if no replacement scene is found,
* we need to make sure the string at least is initialized which we do with
* the 'new' keyword. That insures an empty VALID string. Using the 'decl'
* keyword gives us a string very fast but said string have not been
* initialized first and may contain unsafe data for printing. Therefore
* use 'decl' for when you know what you are doing and need speed. 'new'
* if you are unsure whether the string will be initialized. Just a friendly
* tip :). */
new String:newSceneFile[MAX_SCENEFILE_LENGTH]
decl newSceneLen
GetSceneFile(scene, sceneFile, sizeof(sceneFile))
if (!GetTrieString(g_FakeCharacterLinesTrie, sceneFile, newSceneFile, sizeof(newSceneFile), newSceneLen) ||
newSceneLen == 0) {
#if DEBUG
Debug_PrintText("Not replacing scene (\"%s\") as no replacement scene (\"%s\", newSceneLen %d) can be found in trie.", sceneFile, newSceneFile, newSceneLen)
#endif
return
}
new Float:preDelay = GetScenePreDelay(scene)
new Float:pitch = GetScenePitch(scene)
#if DEBUG
Debug_PrintText("Cancelling old scene (\"%s\")...", sceneFile)
#endif
CancelScene(scene)
#if DEBUG
Debug_PrintText("Performing new scene (\"%s\", preDelay %.2f, pitch %.2f)...", newSceneFile, preDelay, pitch)
#endif
PerformSceneEx(actor, "", newSceneFile, preDelay, pitch /* SCENE_INITIATOR_PLUGIN is default and does not need to be specified */)
#if DEBUG
Debug_PrintText("Scene replaced for fake Zoey actor %N!", actor)
#endif
}
Also, I don't know if this is important or not, but the following line give me a "Argument type mismatch" on compile;
PHP Code:
new float:preDelay = GetScenePreDelay(scene);
new float:pitch = GetScenePitch(scene);
// And this line
PerformSceneEx(actor, "", s_Vocalize, preDelay, pitch, SCENE_INITIATOR_PLUGIN)
I don't think I'm doing anything wrong, maybe it's how I set up the scene replacement?
That is because you are using float: as a type. However that is a function to convert integers to floats. You want to use Float: (capitalized F) to mark variable as float data type.
PHP Code:
new myInterger = 3
new Float:myFloat = float(myInterger) /* Comes out as 3.0 */
Edit:
Also here are some tips if you are new to SourcePawn that I have personal found useful but feel free to skip it.
Over the years, I have come to learn that coding style is probably one of the more important things. If you look back at the various plugins I have made over the years is that I have slowly changed coding style, adopting various things from various authors of other plugins that I have learned from. However it often turns into a some kind of coding mosh pit when looking back and you have learned some new ways of writing code. I have personally found the Linux kernel coding style a really good style for SourcePawn. Of course I will not be a grammar nazi on this point and everyone got their own favourite style of writing, but as a piece of advise, I would suggest picking one and sticking to it. You will find it a lot easier to go back to previous scripts you have done in the past and bring them up to date.
If there is an easier way to accomplish the goal, then take it. SourcePawn can do some pretty cool stuff but over complicating a plugin for the sake of doing it the hard way, can be crippling difficult to debug later down the road. On that note I would also like to say that I personal prefer to do multiple plugins, each having 1000 lines, than one big plugin of 50000 lines. It is a lot easier on the eyes.
The API is your friend. Learn to love it. Search on it frequently. Some people are even nice enough to leave comments if some parameters happens to be confusingly named. Otherwise do not be afraid of asking in the scripting forum section, people are nice as long you search and read on the API first then ask a question.
While I am completely against this solution as it comes with a myriad of other problems, it should be possible. Do you mind me asking why you are not setting up a Linux dedicated server instead to completely side step this issue?
Edit:
Also here are some tips if you are new to SourcePawn that I have personal found useful but feel free to skip it.
Over the years, I have come to learn that coding style is probably one of the more important things. If you look back at the various plugins I have made over the years is that I have slowly changed coding style, adopting various things from various authors of other plugins that I have learned from. However it often turns into a some kind of coding mosh pit when looking back and you have learned some new ways of writing code. I have personally found the Linux kernel coding style a really good style for SourcePawn. Of course I will not be a grammar nazi on this point and everyone got their own favourite style of writing, but as a piece of advise, I would suggest picking one and sticking to it. You will find it a lot easier to go back to previous scripts you have done in the past and bring them up to date.
If there is an easier way to accomplish the goal, then take it. SourcePawn can do some pretty cool stuff but over complicating a plugin for the sake of doing it the hard way, can be crippling difficult to debug later down the road. On that note I would also like to say that I personal prefer to do multiple plugins, each having 1000 lines, than one big plugin of 50000 lines. It is a lot easier on the eyes.
The API is your friend. Learn to love it. Search on it frequently. Some people are even nice enough to leave comments if some parameters happens to be confusingly named. Otherwise do not be afraid of asking in the scripting forum section, people are nice as long you search and read on the API first then ask a question.
Thank You for your suggestions, I assure you I'll take all of your advice to heart.
I'm definitely most likely switching to Linux, but I want to see just how far a "Fake" Zoy can be achieved before moving on, as I understand that replacing almost every line from Nicks scenes can make the plugin as big as probably more than 100,000 lines...
I initially considered dividing it into "sections" (read: multiple plugins), but then my server would end up with around 20 plugins more that all technically do the same thing.
But yes, I am very new to coding in general, not just sourcepawn, but I am always willing to learn and experiment
Edit : Tried it out, various mixed results.
Firstly, it turns out that, even though the scene is correctly named "IncapacitatedInitial" (as it also named in ALL of the talker response files) the scene actually spawns as "incapacitatedinitial", case sensitive was being our demise here.
After getting the lines corrected, It worked... !
The first time only though, after that, the server crashes after successfully replacing the line, but before it vocalizes.
After the first crash, the same crash kept repeating without working again.
Firstly, it turns out that, even though the scene is correctly named "IncapacitatedInitial" (as it also named in ALL of the talker response files) the scene actually spawns as "incapacitatedinitial", case sensitive was being our demise here.
You can find all of the scene files in your local L4D2 folder under [...]\Steam\SteamApps\common\Left 4 Dead 2\left4dead2\scenes for L4D2 crew and [...]\Steam\SteamApps\common\Left 4 Dead 2\left4dead2_dlc2\scenes for L4D1 crew.
File paths are case sensitive as you have noticed and all scenes are in lower case.
Quote:
Originally Posted by DeathChaos25
The first time only though, after that, the server crashes after successfully replacing the line, but before it vocalizes.
After the first crash, the same crash kept repeating without working again.
If you based it on my script above, you should be able to find debug lines in the error logs. Do please share so we can see where the crash occurs. I have had issues in the past with Scene Processor killing scenes in a critical stage, causing the server to crash. We may have stumbled upon another one.
If you based it on my script above, you should be able to find debug lines in the error logs. Do please share so we can see where the crash occurs. I have had issues in the past with Scene Processor killing scenes in a critical stage, causing the server to crash. We may have stumbled upon another one.
Tested again, this time, the vocalizes worked perfectly for about 20 attempts or so, and just when I though it was safe, BAM!, insta crashes every attempt on server restart.
There aren't any error logs either, just regular logs, here they are,
Spoiler
Code:
L 08/20/2014 - 16:34:50: SourceMod log file session started (file "L20140820.log") (Version "1.6.0")
L 08/20/2014 - 16:34:50: -------- Mapchange to c2m1_highway --------
L 08/20/2014 - 16:38:25: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter15.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:38:28: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter17.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:38:30: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter01.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:39:04: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks03.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:39:11: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/sorry01.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:39:21: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial04.vcd")...
L 08/20/2014 - 16:39:21: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial04.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:39:21: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:39:26: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanksrochelle01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:30: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie06.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:35: [Fake_Zoey.smx] Not replacing scene ("scenes/mechanic/blank.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:37: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/no04.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:40: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid02.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:47: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 16:39:47: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:39:47: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:39:52: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:39:55: [Fake_Zoey.smx] Not replacing scene ("scenes/producer/blank.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:00: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid06.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:04: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial02.vcd")...
L 08/20/2014 - 16:40:04: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial02.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:40:04: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:40:09: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:11: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie16.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:16: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:29: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial03.vcd")...
L 08/20/2014 - 16:40:29: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial03.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:40:29: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:40:34: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:36: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie23.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:42: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid04.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:47: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 16:40:47: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:40:47: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:40:52: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:40:57: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/no07.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:01: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie18.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:08: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/no02.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:09: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/no11.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:14: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:18: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:18: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:24: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial03.vcd")...
L 08/20/2014 - 16:41:24: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial03.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:41:24: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:41:29: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:31: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial04.vcd")...
L 08/20/2014 - 16:41:31: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial04.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:41:31: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:41:36: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:38: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie304.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:44: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:48: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial02.vcd")...
L 08/20/2014 - 16:41:48: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial02.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:41:48: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:41:53: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:41:55: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial04.vcd")...
L 08/20/2014 - 16:41:55: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial04.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:41:55: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:42:01: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:03: [Fake_Zoey.smx] Not replacing scene ("scenes/producer/blank.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:08: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid07.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:10: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 16:42:10: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:42:10: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:42:15: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks01.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:22: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:25: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial03.vcd")...
L 08/20/2014 - 16:42:25: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial03.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:42:25: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:42:31: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks05.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:34: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/goingtodie10.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:36: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial02.vcd")...
L 08/20/2014 - 16:42:36: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial02.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:42:36: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:42:41: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/thanks03.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:48: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid07.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 16:42:52: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial03.vcd")...
L 08/20/2014 - 16:42:52: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial03.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:42:52: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:43:19: SourceMod log file session started (file "L20140820.log") (Version "1.6.0")
L 08/20/2014 - 16:43:19: -------- Mapchange to c1m1_hotel --------
L 08/20/2014 - 16:49:47: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter01.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:49:50: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/laughter16.vcd") as no replacement scene ("", newSceneLen 0) can be found in trie.
L 08/20/2014 - 16:50:10: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 16:50:10: [Fake_Zoey.smx] Performing new scene ("scenes/teengirl/incapacitatedinitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 16:50:10: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 16:51:35: SourceMod log file session started (file "L20140820.log") (Version "1.6.0")
L 08/20/2014 - 16:51:35: -------- Mapchange to c5m1_waterfront --------
L 08/20/2014 - 17:48:46: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial04.vcd")...
L 08/20/2014 - 17:48:46: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/IncapacitatedInitial04.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:48:47: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 17:48:52: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/thanks01.vcd")...
L 08/20/2014 - 17:48:52: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/Thanks01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:48:52: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 17:48:54: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 17:48:54: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/IncapacitatedInitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:48:54: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 17:48:59: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/dlc1_c6m3_finalel4d1items07.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 17:49:02: [Fake_Zoey.smx] Not replacing scene ("scenes/mechanic/blank.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 17:49:06: [Fake_Zoey.smx] Not replacing scene ("scenes/gambler/painrelieftfirstaid07.vcd") as no replacement scene ("", newSceneLen 42) can be found in trie.
L 08/20/2014 - 17:49:10: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial02.vcd")...
L 08/20/2014 - 17:49:10: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/IncapacitatedInitial02.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:49:10: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 17:50:13: SourceMod log file session started (file "L20140820.log") (Version "1.6.0")
L 08/20/2014 - 17:50:13: -------- Mapchange to c2m1_highway --------
L 08/20/2014 - 17:52:58: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 17:52:58: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/IncapacitatedInitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:52:58: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
L 08/20/2014 - 17:53:50: SourceMod log file session started (file "L20140820.log") (Version "1.6.0")
L 08/20/2014 - 17:53:50: -------- Mapchange to c2m1_highway --------
L 08/20/2014 - 17:56:13: [Fake_Zoey.smx] Cancelling old scene ("scenes/gambler/incapacitatedinitial01.vcd")...
L 08/20/2014 - 17:56:13: [Fake_Zoey.smx] Performing new scene ("scenes/TeenGirl/IncapacitatedInitial01.vcd", preDelay 0.00, pitch 1.00)...
L 08/20/2014 - 17:56:13: [Fake_Zoey.smx] Scene replaced for fake Zoey actor DeathChaos!
As you can see, on each attempt, I made some differences, most notably, the last one.
While the original scene that spawns HAS to be all lowercase, the replacement scene can be written correctly as from the talker file,
incapacitatedinitial can be replaced with IncapacitatedInitial, but not vice versa.
I also tried PerformScene (not Ex) and the same results, I even tried adding a vocalize command into PerformScene (and Ex) and still got the crash.
I don't know if it makes a difference, but, whenever SRCDS crashes, it takes me out of fullscreen and Windows gives me the "SRCDS has stopped working" error where it normally does not error on crash when I try to do stupid S*** like loading m_survivorCharacter 5
Also, I made a plugin some time ago that was meant to compliment this one, except that one deals with Radial Menus and Vocalizations, in that one, the replacement scenes are all also written with Uppercases where needed (like AskReady for example), here's what I mean;
public OnSceneStageChanged(scene, SceneStages:stage) { switch (stage) { case SceneStage_Started: { new client = GetActorFromScene(scene) if (client <= 0 || client > MaxClients || !IsClientInGame(client)) return
decl String:vocalize[MAX_VOCALIZE_LENGTH] if (GetSceneVocalize(scene, vocalize, sizeof(vocalize)) == 0) return
new Float:preDelay = GetScenePreDelay(scene) new i_RNG decl String:model[PLATFORM_MAX_PATH] GetClientModel(client, model, sizeof(model)) if (!StrEqual(model, MODEL_SURVIVOR_ZOEY)) return
new initiator = GetSceneInitiator(scene) if (initiator != client) return if (initiator == SCENE_INITIATOR_PLUGIN) return
decl String:s_Vocalize[60] = ""
if (StrEqual(vocalize, "PlayerAskReady", true)) { i_RNG = GetRandomInt(1, 10) switch (i_RNG) { case 1: s_Vocalize = "scenes/TeenGirl/AskReady03.vcd" case 2: s_Vocalize = "scenes/TeenGirl/AskReady11.vcd" case 3: s_Vocalize = "scenes/TeenGirl/AskReady12.vcd" case 4: s_Vocalize = "scenes/TeenGirl/AskReady13.vcd" case 5: s_Vocalize = "scenes/TeenGirl/AskReady14.vcd" case 6: s_Vocalize = "scenes/TeenGirl/AskReady15.vcd" case 7: s_Vocalize = "scenes/TeenGirl/AskReady17.vcd" case 8: s_Vocalize = "scenes/TeenGirl/AskReady18.vcd" case 9: s_Vocalize = "scenes/TeenGirl/AskReady19.vcd" case 10: s_Vocalize = "scenes/TeenGirl/AskReady21.vcd" }
}
else if (StrEqual(vocalize, "PlayerLaugh", true)) { i_RNG = GetRandomInt(1, 23) switch (i_RNG) { case 1: s_Vocalize = "scenes/TeenGirl/DLC2GasTanks03.vcd" case 2: s_Vocalize = "scenes/TeenGirl/Laughter01.vcd" case 3: s_Vocalize = "scenes/TeenGirl/Laughter02.vcd" case 4: s_Vocalize = "scenes/TeenGirl/Laughter03.vcd" case 5: s_Vocalize = "scenes/TeenGirl/Laughter04.vcd" case 6: s_Vocalize = "scenes/TeenGirl/Laughter05.vcd" case 7: s_Vocalize = "scenes/TeenGirl/Laughter06.vcd" case 8: s_Vocalize = "scenes/TeenGirl/Laughter07.vcd" case 9: s_Vocalize = "scenes/TeenGirl/Laughter08.vcd" case 10: s_Vocalize = "scenes/TeenGirl/Laughter09.vcd" case 11: s_Vocalize = "scenes/TeenGirl/Laughter10.vcd" case 12: s_Vocalize = "scenes/TeenGirl/Laughter11.vcd" case 13: s_Vocalize = "scenes/TeenGirl/Laughter12.vcd" case 14: s_Vocalize = "scenes/TeenGirl/Laughter13.vcd" case 15: s_Vocalize = "scenes/TeenGirl/Laughter14.vcd" case 16: s_Vocalize = "scenes/TeenGirl/Laughter15.vcd" case 17: s_Vocalize = "scenes/TeenGirl/Laughter17.vcd" case 18: s_Vocalize = "scenes/TeenGirl/Laughter18.vcd" case 19: s_Vocalize = "scenes/TeenGirl/Laughter19.vcd" case 20: s_Vocalize = "scenes/TeenGirl/Laughter20.vcd" case 21: s_Vocalize = "scenes/TeenGirl/Laughter16.vcd" case 22: s_Vocalize = "scenes/TeenGirl/Laughter21.vcd" case 23: s_Vocalize = "scenes/TeenGirl/PositiveNoise02.vcd" }
Again, just a snippet of an old plugin, but this one works flawlessly, I'm guessing it's because of the difference in how the scenes are created and sent to the actor?
Tested again, this time, the vocalizes worked perfectly for about 20 attempts or so, and just when I though it was safe, BAM!, insta crashes every attempt on server restart.
There aren't any error logs either, just regular logs, here they are,
Hm, I do not see anything unusual regarding the destruction and creation of scenes. If the server crashed due to the way Scene Processor kills the scene, as it did in the past, the logs would have stopped at "Cancelling scene...". Of course not fool proof and the previous bug might still be there.
Try changing the scene replacement time to SceneStage_Started instead of SceneStage_Spawned. I got a feeling that it may be the issue at hand.
On the off chance this is not the issue, lets make sure the files are precached. Throw precache_all_survivors 1 into your server config file. It may be Zoey scenes or sound files are not precached.
Hm, I do not see anything unusual regarding the destruction and creation of scenes. If the server crashed due to the way Scene Processor kills the scene, as it did in the past, the logs would have stopped at "Cancelling scene...". Of course not fool proof and the previous bug might still be there.
Try changing the scene replacement time to SceneStage_Started instead of SceneStage_Spawned. I got a feeling that it may be the issue at hand.
On the off chance this is not the issue, lets make sure the files are precached. Throw precache_all_survivors 1 into your server config file. It may be Zoey scenes or sound files are not precached.
Scenestage_Started did the trick, but i also threw the precache cvar into the config just in case.
I'll let you know if the crash rears it's ugly head again, but i have a feeling it won't, for now at least...
Edit : Going through the talker files, I found this section;
Spoiler
Response PlayerCallForRescueTeenGirl
{
speak "Player.TeenGirl_CallForRescue01" noscene //Anyone out there? I'm trapped in here!
speak "Player.TeenGirl_CallForRescue02" noscene //Please! I need some help! LET ME OUT OF HERE!!
speak "Player.TeenGirl_CallForRescue06" noscene //Help please! I need some help getting out of here!
speak "Player.TeenGirl_CallForRescue07" noscene //Someone? Anyone! Help! Please!
speak "Player.TeenGirl_CallForRescue14" noscene //Hello? Anyone out there? I need some help!
speak "Player.TeenGirl_CallForRescue16" noscene //Guys! GUYS! I'm over here! I'm trapped!
speak "Player.TeenGirl_LostCall01" noscene //Hello?
speak "Player.TeenGirl_LostCall010" noscene //Where are you guys?
speak "Player.TeenGirl_LostCall04" noscene //Is anyone there?
speak "Player.TeenGirl_LostCall06" noscene //Helloooo?
speak "Player.TeenGirl_LostCall07" noscene //Anyone Around?
speak "Player.TeenGirl_LostCall09" noscene //Hey guys, where are you?
speak "Player.TeenGirl_LostCall13" noscene //Guys?
}
However, it says noscene, I'm guessing SceneProcessor won't be able to pick and interrupt these lines, any Idea of what I could do for them?
However, it says noscene, I'm guessing SceneProcessor won't be able to pick and interrupt these lines, any Idea of what I could do for them?
If it is a spoken line, it will also spawn a scene entity, which the plugin will pick up.
See my "No Lost Call" plugin (attached) for an example of stopping L4D2 Survivors keep calling out for help when they are the only one (everyone else have changed to a L4D1 character).
And just for short form:
PHP Code:
public OnSceneStageChanged(scene, SceneStages:stage) { switch (stage) { case SceneStage_Started: { new client = GetActorFromScene(scene)
if (StrContains(file, "lostcall", false) == -1) { return }
CancelScene(scene) } } }
Also if I were you, when trying to find scenes, make a debug plugin that just prints all of the scenes out when created. On scene started, get scene file name and print it to chat. That way you will know if the scene processor can pick it up.
I took your suggestion in making a separate plugin that logs EVERY scene created, but I had assumed correctly, and the call for rescue lines don't actually spawn a scene, I guess that's something that we can't correct then.
For some reason, sometimes the replacement scene is delayed too much, like in the video, the incapacitatedinitial line was so delayed that it was interrupted by the incapacitatedhurt one instead, but that's a non issue as the delay is only noticeable when using grenades, as they are called almost after the grenade toss is done.
In case you're wondering what the plugin looks like right now...