Frictional Games Forum (read-only)

Full Version: Intro doesn't work or unexpected reason
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So what I want it! I want an intro to begin when starting my custom story.

everything is black and you can hear yourself talking and then when the speech ends, then you begin in a dungeon cell.

But the intro is not working for unexpected reason. this is what I did with the hps file

Code:
void OnStart()

{
AddEntityCollideCallback("Player","CollideOpeningDustDoor","AreaTriggerDoor_1",true,1);
AddEntityCollideCallback("JumpscareDoor", "AreaJumpscare", "SanityDec", true, 1);
AddEntityCollideCallback("Handle", "AreaConnect", "AttachLever", true, 1);
AddEntityCollideCallback("Player", "teleport", "changemap", true , 1);
AddEntityCollideCallback("Player", "AreaDoor", "EventDoor", true, 1);
AddEntityCollideCallback("Player", "AreaMemento", "EventQuest", true, 1);
AddEntityCollideCallback("Player", "entercastle", "Entercastle", true, 1);
SetPlayerActive(false);
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
FadeOut(0);


wakeUp();
}

void VoicesIntro1(string &in asTimer)
{
    AddEffectVoice("intro_1.ogg", "", "Voice", "intro1", false, "", 0, 0);
    AddEffectVoice("intro_2.ogg", "", "Voice", "intro2", false, "", 0, 0);
    AddEffectVoice("intro_3.ogg", "", "Voice", "intro3", false, "", 0, 0);
    AddEffectVoice("intro_4.ogg", "", "Voice", "intro4", false, "", 0, 0);
    AddTimer("logoin", 80, "LogoIn");
    AddTimer("logoinroses", 81.5, "LogoInRoses");
    AddTimer("logoout", 86, "LogoOut");
    AddTimer("teleportrealstart", 91, "TeleportRealStart");
}

void wakeUp()
{
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
PlayGuiSound("react_pant3.ogg", 1);
FadeSepiaColorTo(0, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.5, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);
    SetPlayerLampOil(32);
    GiveSanityDamage(80, false);
    GivePlayerDamage(30 , "" , false, false);
    SetPlayerMoveSpeedMul(0.83f);
    SetPlayerRunSpeedMul(0);
    //SetPlayerLookSpeedMul(0.5);
    FadeImageTrailTo(0,0.2f);
    PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1, false);
    AddUseItemCallback("", "HollowNeed", "CellDoor", "UseHollowNeedOnDoor", true);
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1.5f, false);
}

void UseHollowNeedOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("CellDoor", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
GiveSanityBoostSmall();
CompleteQuest("area", "enterarea");
AutoSave();
RemoveItem(asItem);
}


void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CellGuardGrunt", true);
AddEnemyPatrolNode("CellGuardGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_18",0.001f, "");
}


void AttachLever(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Lever", true);

    SetEntityActive(asParent, false);
    PlayGuiSound("04_place_wood.ogg", 1);
    AutoSave();
    SetEntityActive("Mount", false);

}

void UnlockDoor(string &in asEntity, int LeverState)
{
    if(LeverState == 1)
    {
        SetSwingDoorLocked("Open", false, true);
    SetPropStaticPhysics("Open", false);
      SetEntityActive("Message", false);
        GiveSanityBoostSmall();
        PlaySoundAtEntity("", "unlock_door.ogg", "Open", 0, false);
        SetLeverStuckState(asEntity, LeverState, false);
    }
}


void SanityDec(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("react_scare1.ogg", 1);
GiveSanityDamage(15, true);
}

void int01(string &in asEntity)
{
SetMessage("Messages", "Message", 5);
}

void changemap(string &in asParent, string &in asChild, int alState)
    {
        StopMusic(3.0, 0);
        ChangeMap("Lifeless_The Abandon2","PlayerStartArea_1","","");
    }


void EventDoor(string &in asParent, string &in asChild, int alState)
{
        SetSwingDoorClosed("Door", false, false);
        SetSwingDoorDisableAutoClose("Door", true);

        PlaySoundAtEntity("creak", "joint_door_move_special.snt", "Door", 1, false);
    PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
    PlaySoundAtEntity("scare", "react_scare.snt", "Player", 0.75f, false);
    PlaySoundAtEntity("SoundBong", "scare_tingeling.snt", "Player", 0.0f, false);
    PlayMusic("18_amb.ogg", true, 1.0f, 0, 0, true);
    CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_push.ps", "Door", false);
    CreateParticleSystemAtEntity("PSDoor_4", "ps_dust_push.ps", "Door", false);
    GiveSanityDamage(10, true);    

        AddTimer("", 2, "TimerStopSound");
        AddTimer("Door", 0, "TimerMoveDoor");
}

void TimerMoveDoor(string &in asTimer)
{
        if(GetLocalVarInt("VarDoor") == 50) return;
        AddLocalVarInt("VarDoor", 1);

        AddTimer(asTimer, 0.03, "TimerMoveDoor");

        AddPropForce(asTimer, 70, 0, 0, "world");
}

void TimerStopSound(string &in asTimer)
{
        StopSound("creak", 0.4);
}


void PickUpLantern(string &in asEntity, string &in type)
{
    AddQuest("lantern", "pickuplantern");
}

void EventQuest(string &in asParent, string &in asChild, int alState)
{
    AddQuest("area", "enterarea");
}

void OnLeave()
{    
    SetupLoadScreen("LoadingScreen", "LoadScreen1", 0, "LoadScreen1_1.jpg");
}

and the lang file,
Code:
<CATEGORY Name="Voice">
        <Entry Name="intro1">Hello, my name is john and I'm a journalist.</Entry>
        <Entry Name="intro2">I love collecting pictures of all kinds of castles. Modern, Old and Big.</Entry>
        <Entry Name="intro3">One day I heard about this strange castle which was located in the western side of the woods, when I went there a strange figuire appeared, wacking me in the head. I fainted</Entry>
        <Entry Name="intro4">That's when I found myself in a dungeon cell. I felt like I've been here before, I gotta get out, and that's when my journay begins.</Entry>
    </CATEGORY>

soc an anybody tell em why the intro isn't working?
Uhmm... WHAT DOES happen when you run the code?

Like, do you hear the voices? Do you wake up? What actually happens at the beginning?
It doesn't get an error, It just starts the custom story of me waking up in a cell, no voices, no subtitles but the tinderboxes does appear. and it doesn't begin black screen. but the intro did not play! I want the intro to play then after wake up in a cell
BTW You spelled journey wrong
Anyways, It might be lack of }'s but i can't find any solutions where it wouldn't crash.
Sound files might be wonky
It could be this
Spoiler below!


wakeUp();
}

Because it's connected to the OnStart
As far as I know, you haven't added your VoicesIntro timer at all in the whole OnStart() area, just the wakeup(); part, which the game should skip to straight away.

I would also remove those four timers at the end of the VoicesIntro sub, because as far as I can tell, they don't exactly have a purpose, at least, not in the code.