Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Not all commands work in a function (EffectVoices)
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#1
Not all commands work in a function (EffectVoices)

So I'm trying to do some effects (radial blur and sepia) inbetween a series of effect voices. The problem is they don't work. The function (ContinueDialogue1) is called for sure, since the dialogue continues, but for some reason the effects put in the same func don't work. They work if I put them in the beggining (Dialogue2).

Any ideas ?

PHP Code: (Select All)
void Dialogue2(string &in asEntity)
{
    
AddEffectVoice("Academy_Speech_1""""Dialogues""Academy_Speech_1"false"Player"0.0f25.0f);
    
PlayMusic("02_thegreatunderground.ogg"false1.0f0.4f2false);
    
AddEffectVoice("Academy_Speech_2""""Dialogues""Academy_Speech_2"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_3""""Dialogues""Academy_Speech_3"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_4""""Dialogues""Academy_Speech_4"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_5""""Dialogues""Academy_Speech_5"false"Player"0.0f25.0f);
    
SetEffectVoiceOverCallback("ContinueDialogue1");
}
void ContinueDialogue1()
{
    
FadeRadialBlurTo(0.05f0.1f);
    
FadeSepiaColorTo(1.0f0.5f);
    
ContinueDialogue();
}
void ContinueDialogue()
{
    
AddEffectVoice("Academy_Speech_6""""Dialogues""Academy_Speech_6"false"Player"0.0f25.0f);
///and so on...


07-30-2016, 09:19 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Not all commands work in a function (EffectVoices)

It might have something to do with the fact that AddEffectVoice queues up the voices, so the order of execution might not be what you expect. Perhaps another way to do this is to use timers?

If you add a timer at the start that is just as long as your first piece of dialogue, then it should trigger once it's done.

07-31-2016, 12:45 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#3
RE: Not all commands work in a function (EffectVoices)

Yeah, I guess it's down to timers again.
Although everything else besides visual effects works, so I'm kinda disappointed.

07-31-2016, 02:13 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Not all commands work in a function (EffectVoices)

So you mean that the PlayMusic function you have doesn't run unless it's at the top of Dialogue2 ?

07-31-2016, 02:51 PM
Find
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#5
RE: Not all commands work in a function (EffectVoices)

I don't think PlayMusic counts as a "visual effect", though. So by what he said, it should work.
07-31-2016, 03:00 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#6
RE: Not all commands work in a function (EffectVoices)

Yup, music works. I can't see any mistakes that I could have made, so this is probably a bug and I have to work it around.

07-31-2016, 03:50 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: Not all commands work in a function (EffectVoices)

I thought the script you posted included what wasn't working. So you added the visual effects inbetween the voice lines?

Well, not sure why they wouldn't run at all, but even if they did, they would all run at the same time at the start of that script. It wouldn't have waited until the voice started before being executed, because the voice lines do not stall the script. So if you for example had FadeSepiaColorTo > 1 in the middle and FadeSepiaColorTo > 0 at the end, it would set it to 1 and 0 at the same time, effectively nullifying itself. Could that be what happened?

Could you post the script you tried that wasn't working?

(This post was last modified: 07-31-2016, 04:19 PM by Mudbill.)
07-31-2016, 04:18 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#8
RE: Not all commands work in a function (EffectVoices)

This is the script.
I want the sepia to happen in the middle of the speech, so I used
PHP Code: (Select All)
SetEffectVoiceOverCallback("ContinueDialogue1"); 
The function ContinueDialogue1 is called, because the next part of the speech
PHP Code: (Select All)
ContinueDialogue(); 
works.
However,
PHP Code: (Select All)
FadeRadialBlurTo(0.05f0.1f);
 
FadeSepiaColorTo(1.0f0.5f); 
Don't work for some reason, even though they're in the same func as
PHP Code: (Select All)
ContinueDialogue(); 
, which works.

To specify, the script doesn't cause a bug, just the visual effects don't kick in.

(This post was last modified: 07-31-2016, 04:56 PM by Darkfire.)
07-31-2016, 04:54 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: Not all commands work in a function (EffectVoices)

Could you post the entire script though? It's kinda hard to follow when split up like that. I also don't see the ContinueDialog() anywhere else, only the constructor for ContinueDialog1(). If you need to comment on something in between the script, I prefer using //comments instead, as an example.

(This post was last modified: 07-31-2016, 06:07 PM by Mudbill.)
07-31-2016, 06:06 PM
Find
Darkfire Offline
Senior Member

Posts: 371
Threads: 22
Joined: May 2014
Reputation: 15
#10
RE: Not all commands work in a function (EffectVoices)

But... ContinueDialogue() is right down there...

Dialogue2 is called with a SetEntityPlayerInteractCallback, saying just in case.

Here's the whole script, but it's 400 lines long and everything else inside is irrelevant, so what for ? Sorry for being an ass

Spoiler below!
PHP Code: (Select All)
void OnStart()
{
    
TeleportPlayer("PlayerStartArea_1");
    
CompleteQuest("Academy""FindAcademy");
    
    
AddCombineCallback("ladder""ladder1""ladder2""CombineLadder"false);
    
AddCombineCallback("ladder""ladder1""ladder3""CombineLadder"false);
    
AddCombineCallback("ladder""ladder3""ladder2""CombineLadder"false);
    
    
SetGlobalVarInt("LadVar"0);
    
    
//GiveItem("Key2", "chemical_container_full.ent", "pick", "chemical_container_full.tga", 1);
    
    
SetEntityPlayerInteractCallback("KainamKey""Dialogue"true);
    
SetEntityPlayerInteractCallback("PurpleOrb""Dialogue2"true);
    
    
////////////////////////////Item interactions
    
AddUseItemCallback("kiki""crowbar2""padlock""UnbreakableMessage"false);
    
AddUseItemCallback("koko""crowbar2""padlock_acid""BreakPadlock"false);
    
AddUseItemCallback("acidididi""Jar""FillAcidJar""FillJar"false);
    
AddUseItemCallback("kaka""acid""padlock""Melt"false);
    
AddUseItemCallback("hgh""ladder_complete""Penis""InsertLadder"false);
    
    
//doors
    
AddUseItemCallback("""StorageKey""Storage""OpenDoor"false);
    
AddUseItemCallback("""LabKey""LabDoor""OpenDoor"false);
    
AddUseItemCallback("""StudyKey""mansion_12""OpenDoor"false);
    
AddUseItemCallback("""item""door""OpenDoor"false);
    
    
AddUseItemCallback("""Key2""mansion_1""PickLock"false);
    
AddUseItemCallback("""Key2""mansion_2""PickLock"false);
    
AddUseItemCallback("""Key2""mansion_3""PickLock"false);
    
AddUseItemCallback("""Key2""FancyDoor_12""PickLock"false);
    
    
AddUseItemCallback("""Key2""padlock""LockPickMessage"false);
    
AddUseItemCallback("""Key2""padlock_acid""LockPickMessage"false);
    
AddUseItemCallback("""Key2""Storage""LockPickMessage"false);
    
AddUseItemCallback("""Key2""LabDoor""LockPickMessage"false);
    
AddUseItemCallback("""Key2""mansion_12""LockPickMessage"false);
    
AddUseItemCallback("""Key2""FancyDoor_4""LockPickMessage"false);
    
AddUseItemCallback("""Key2""FancyDoor_11""LockPickMessage"false);
    
AddUseItemCallback("""Key2""mansion_5""LockPickMessage"false);
    
AddUseItemCallback("""Key2""mansion_6""LockPickMessage"false);
    
AddUseItemCallback("""Key2""castle_1""LockPickMessage"false);
    
AddUseItemCallback("""Key2""castle_2""LockPickMessage"false);
    
    
//end doors
    /////////////////////////////
    
    
if(HasItem("crowbar2") == false)
    {
        
SetEntityActive("crowbar2"true);
    }
    
AddTimer("wegorz"0.1f"ShowEasterEggCount");
}

void LockPickMessage(string &in asItemstring &in asEntity)
{
    
SetMessage("Messages""Locked4"3);
}

void OnLeave()
{
    
StopMusic(1.0f1);
    
StopMusic(1.0f2);
    
SetupLoadScreen("LoadingScreens""LoadScreen12"0"");
}

void ShowEasterEggCount(string &in asTimer)
{
    if(
ScriptDebugOn())
    {
        
AddDebugMessage("Number of Poems:" +GetGlobalVarInt("LyricsVar"), true);
    }
    
    
AddTimer("wegorz2"0.1f"ShowEasterEggCount");
    
}

void OnEnter()
{

    
PlayMusic("22_amb"true1.0f0.0f1false);
    
AutoSave();
    
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_31"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_7"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_2"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_3"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_4"3.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_6"7.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_7"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_31"50.0f"");
    
    
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_1"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_2"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_3"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_4"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_5"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_51"2.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_53"7.01f"");
    
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_52"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_17"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_24"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_26"0.01f"");
    
    
}

void DisplayEE(string &in asEntity)
{
    
SetMessage("Messages""EasterL"6);
    if(
GetGlobalVarInt ("LyricsVar") == 0)
    {
        
SetMessage("Messages""EasterL"6);
    }
    else
    {
        
SetMessage("Messages""EasterL2"3);
    }
    
AddGlobalVarInt("LyricsVar"1);
}

void OpenDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""Player"0false);
    
RemoveItem(asItem);
    
AddPlayerSanity( -1);
    
AddPlayerSanity16);
    
    
AutoSave();
}

void PickLock(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""Player"0false);
}

void PickMessage(string &in asEntity)
{
    
SetMessage("Messages""Lousy"0);
}

//////////////OPEN THE ATTIC GATE//////////////////

void UnbreakableMessage(string &in asItemstring &in asEntity)
{
    
SetMessage("Messages""Popup33"3);
}
void BreakPadlock(string &in asItemstring &in asEntity)
{
    
PlaySoundAtEntity("""16_ladder_imp3""padlock_acid"0.01ffalse);
    
SetEntityActive("padlock_acid"false);
    
SetEntityActive("padlock_broken"true);
    
SetPropStaticPhysics("gate"false);
    
AddPlayerSanity(-1.0f);
    
GiveSanityBoost();
    
    
AutoSave();
    
}
void Melt(string &in asItemstring &in asEntity)
{
    
SetPropActiveAndFade("padlock"false2.0f);
    
SetPropActiveAndFade("padlock_acid"true1.0f);
    
PlaySoundAtEntity("""puzzle_acid""padlock_acid"0.01ffalse);
    
FadeLightTo("AcidLight"0.0f1.0f0.3f1.0f, -11);
    
AddTimer(""1.1f"TurnOffLight");
    
RemoveItem(asItem);
    
    
AutoSave();
}

void FillJar(string &in asItemstring &in asEntity)
{
    
RemoveItem(asItem);
    
PlayGuiSound("puzzle_acid_success.snt"1.0f);
    
GiveItem("acid""chemical_container_full.ent""jar3""chemical_container_full.tga"1);
    
    
AutoSave();
}

void TurnOffLight(string &in asTimer)
{
    
FadeLightTo("AcidLight"0.0f0.0f0.0f0.0f, -11);
}


////////////////END OPENING THE GATE///////////////



void End(string &in asEntity)
{
    
//StartCredits("Kai_Engel_-_02_-_Melancholy_Aftersounds.ogg", false, "Endings", "Ending1", 3);
    //StartCredits("", false, "Endings", "Ending1", 3);
}

void AddLadVar(string &in asEntity)
{
    
AddGlobalVarInt("LadVar"1);

}



///////////DIALOGUE///////////

void Dialogue(string &in asEntity)
{
    
AddEffectVoice("Academy_warning_1""""Dialogues""Academy_Warning_1"false"Player"0.0f25.0f);
    if(
HasItem("PurpleOrb") == false)
    {
        
AddEffectVoice("Academy_warning_2""""Dialogues""Academy_Warning_2"false"Player"0.0f25.0f);
    }
    else
    {
        
SetLevelDoorLocked("level_wood_2"false);
        
SetLevelDoorLocked("level_wood_1"false);
    }
    
AddEffectVoice("Academy_warning_3""""Dialogues""Academy_Warning_3"false"Player"0.0f25.0f);
    
SetEffectVoiceOverCallback("EventMusic");
}
void EventMusic()
{
    
PlayMusic("19_event_brute.ogg"false1.0f0.4f2false);
    
AddEffectVoice("Academy_warning_4""""Dialogues""Academy_Warning_4"false"Player"0.0f25.0f);
    
    
CompleteQuest("laboratory""LaboratoryKey");
    
    
CheckPoint("""KeyTeleport""Respawn""DeathHint""Entry2");
    
    
AddTimer("sdgd"3.0f"Spawn");
    
    
AutoSave();
    
    
}

void Spawn(string &in asTimer)
{
    
SetEntityActive("servant_brute_1"true);
    
SetEntityActive("servant_brute_2"true);
    
    
SetEntityActive("pot_plant_small01_5"true);
    
SetEntityActive("chair_nice02_12"true);
    
    
AddEntityCollideCallback("ScriptArea_1""servant_brute_2""StopGrunt"true1);
}

void Respawn(string &in asNameint alCount
{
    if(
alCount 4)
    {
        
PlayMusic("19_event_brute.ogg"false1.0f0.4f2false);
        
AddTimer("sdgd"3.0f"Spawn");
    }
    
    if(
GetEntitiesCollide("mansion_12""ScriptArea_3") == false)
    {
        
CreateEntityAtArea("mansion_12""mansion.ent""ScriptArea_3"false);
    }
    if(
GetEntitiesCollide("ScriptArea_2""pot_plant_small01_5") == false)
    {
        
CreateEntityAtArea("pot_plant_small01_5""pot_plant_small01.ent""ScriptArea_2"false);
    }
    
SetEntityActive("pot_plant_small01_5"true);
    
SetEntityActive("chair_nice02_12"true);
    
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_31"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_7"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_2"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_3"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_4"3.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_6"7.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_7"0.01f"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_31"50.0f"");
    
    
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_1"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_2"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_3"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_4"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_5"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_51"2.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_53"7.01f"");
    
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_52"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_17"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_24"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_26"0.01f"");
}

void StopGrunt(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive(asParenttrue);
    
AddEntityCollideCallback("ScriptArea_4""Player""AddNodes"false1);
    
AddEntityCollideCallback("ScriptArea_5""Player""Attack"false1);
}

void AddNodes(string &in asParentstring &in asChildint alState)
{
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_52"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_17"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_24"0.01f"");
    
AddEnemyPatrolNode("servant_brute_2""PathNodeArea_26"0.01f"");

}

void Attack(string &in asParentstring &in asChildint alState)
{
    
ClearEnemyPatrolNodes("servant_brute_2");
    
ShowEnemyPlayerPosition("servant_brute_2");
}


void Dialogue2(string &in asEntity)
{
    
FadeLightTo("PointLight_58"0.0f0.0f0.0f0.0f0.0f1.0f);
    
FadeLightTo("PointLight_6"0.0f0.0f0.0f0.0f0.0f1.0f);
    
    
AutoSave();
    
    
AddEffectVoice("Academy_Speech_1""""Dialogues""Academy_Speech_1"false"Player"0.0f25.0f);
    
PlayMusic("02_thegreatunderground.ogg"false1.0f0.4f2false);
    
AddEffectVoice("Academy_Speech_2""""Dialogues""Academy_Speech_2"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_3""""Dialogues""Academy_Speech_3"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_4""""Dialogues""Academy_Speech_4"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_5""""Dialogues""Academy_Speech_5"false"Player"0.0f25.0f);
    
SetEffectVoiceOverCallback("ContinueDialogue1");
}
void ContinueDialogue1()
{
    
FadeRadialBlurTo(0.05f0.1f);
    
FadeSepiaColorTo(1.0f0.5f);
    
ContinueDialogue();
}
void ContinueDialogue()
{
    
    
AddEffectVoice("Academy_Speech_6""""Dialogues""Academy_Speech_6"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_7""""Dialogues""Academy_Speech_7"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_8""""Dialogues""Academy_Speech_8"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_9""""Dialogues""Academy_Speech_9"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_10""""Dialogues""Academy_Speech_10"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_11""""Dialogues""Academy_Speech_11"false"Player"0.0f25.0f);
    if(
HasItem("KainamKey") == false)
    {
        
AddEffectVoice("Academy_Speech_12""""Dialogues""Academy_Speech_12"false"Player"0.0f25.0f);
        
//add memento
    
}
    else
    {
        
SetLevelDoorLocked("level_wood_2"false);
        
SetLevelDoorLocked("level_wood_1"false);
    }
    
AddEffectVoice("Academy_Speech_13""""Dialogues""Academy_Speech_13"false"Player"0.0f25.0f);
    
AddEffectVoice("Academy_Speech_14""""Dialogues""Academy_Speech_14"false"Player"0.0f25.0f);
    
    
FadeRadialBlurTo(0.0f0.0f);
    
FadeSepiaColorTo(0.0f0.0f);
    
SetEffectVoiceOverCallback("ContinueDialogue2");
}
void ContinueDialogue2()
{
    
SetEntityActive("GoOut"true);
    
SetEntityPlayerInteractCallback("GoOut""TeleportBack"false);
}

void TeleportBack(string &in asEntity)
{
    
AddTimer("fadetimer"1.2f"TeleportProper");
    
AddTimer("tptimer"1.1f"TeleportProper");
    
FadeOut(1.0f);
    
PlayGuiSound("player_climb.snt"1.0f);
    
StopMusic(0.5f2);
}

void TeleportProper(string &in asTimer)
{
    if(
asTimer == "tptimer")
    {
        
TeleportPlayer("PlayerStartArea_2");
    }
    if(
asTimer == "fadetimer")
    {
        
FadeIn(1.0f);
    }
}



///////////END DIALOGUE



void InsertLadder(string &in asItemstring &in asEntity)
{
    
RemoveItem(asItem);
    
PlayGuiSound("puzzle_place_jar.snt"1.0f);
    
SetEntityActive("ladder_static_1"true);
    
SetEntityActive("LadderArea_1"true);
    
SetEntityActive("Penis"false);
    
    
AutoSave();
    



07-31-2016, 07:26 PM
Find




Users browsing this thread: 1 Guest(s)