Frictional Games Forum (read-only)
[SCRIPT] Does anybody know how I'm supposed to do this pls? [SOLVED] - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Does anybody know how I'm supposed to do this pls? [SOLVED] (/thread-24781.html)



Does anybody know how I'm supposed to do this pls? [SOLVED] - Radical Batz - 03-08-2014

Um what I want is an intro for my custom story to begin with everything black and you can't move

and the intro will be just voices playing with subtitles and when the intro ends I want the player to teleport to the map! easy as that but the problem is....... I don't know how to do that, I'm bad at scripting that's all.

I know scripting but I don't know how to do this intro actually so I've been wondering if you guys might help me a little bit pls

I don't know the code of it and I tried searching on the wiki, tutorials and engine scripts but I have no idea on what the code should be or this type of intro Huh

can you guys help? Sad

and don't be like "we can't do everything for you or sends a link to the wiki or stuff" i already tried!! OK? I just can't find the code for this intro and I think it should be easy for a black screen with just voices and subtitles, by the way the subtitles and voice are ready in the lang file#, all i need ius the script for the intro pls!

but couldn't it be much easier if you know the code and could give me the whole code and then I will fill it up, that all i you could pls


RE: Does anybody know how I'm supposed to do this pls? - 7heDubz - 03-08-2014

Hmmm... Try making a mock script and look through the engine scripts functions here. What you ask is really rather simple. I guarantee you can get it with a little effort.

Look under the following sections for the code you want

Player
Screen Effects


RE: Does anybody know how I'm supposed to do this pls? - Radical Batz - 03-08-2014

I can't seem to find it maybe it's

Code:
void AddEffectVoice(string& asVoiceFile, string& asEffectFile, string& asTextCat, string& asTextEntry,

to work but in my code I have a void onstart with void wake-up where even if I start the level with the voices and intro then the player will still get up because of the wake up code, is there a way to disable the wake up code in the beginning and then enable it after the intro is finished?


RE: Does anybody know how I'm supposed to do this pls? - Neelke - 03-08-2014

Well, if it's a timer, I used a custom script called ResumeEventTimer.

//Resumes an event timer after a step is over
void ResumeEventTimer(string &in asTimer, float afTime)
{
AddTimer(asTimer, afTime, asTimer);
}

string &in asTimer = name of the timer
float afTime = amount of time before starting the timer again

Example:

ResumeEventTimer("TimerWakeUp", 0.5f);

However, you need something that will stop the timer temporarly.


RE: Does anybody know how I'm supposed to do this pls? - Mudbill - 03-08-2014

This is actually very simple. Now, depending on whether you have any distracting elements in the level you want to teleport to, you might not even need to teleport the player because since the screen is black, they won't know they're there. If you do have something that can distract (like torch sound effects or similar), just have the player somewhere quiet and teleport him once it's done.

Firstly, you do something like this:
Code:
void OnStart()
{
    FadeOut(0);
    AddEffectVoice("voicefile", "", "SubtitleCategory", "SubtitleEntry",
false, "", 0, 5); //Repeat this line for as many voice files you have.
    SetEffectVoiceOverCallback("VoicesDone"); //This enables a callback that happens when the voices are done.
}

void VoicesDone()
{
    wakeup(); //Or whatever event that calls the wake up sequence.
}



RE: Does anybody know how I'm supposed to do this pls? - Radical Batz - 03-09-2014

I'm kind of getting this error when I sued Mudbill's scripts and made a teleport code

it gets me this error
Code:
---------------------------
FATAL ERROR
---------------------------
FATAL ERROR: Could not load script file 'custom_stories/Lifeless_The Abandon/maps/Lifeless_The Abandon.hps'!
main (28, 5) : ERR  : No matching signatures to 'wakeup()'

---------------------------
OK  
---------------------------



and this is the hps file, can anybody tell em what the problem is?
Code:
void OnStart()
{
    FadeOut(0);
    AddEffectVoice("intro_1", "", "Voice", "intro1",
false, "", 0, 5);
AddEffectVoice("intro_2", "", "Voice", "intro2",
false, "", 0, 5);
AddEffectVoice("intro_3", "", "Voice", "intro3",
false, "", 0, 5);
AddEffectVoice("intro_4", "", "Voice", "intro4",
false, "", 0, 5);
    SetEffectVoiceOverCallback("VoicesDone"); //This enables a callback that happens when the voices are done.
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);
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
AddTimer("voicesintro_1", 6, "VoicesIntro_1");
}

void VoicesDone()
{
TeleportPlayer("PlayerStartArea_2");
    wakeup();

}

void wakeUp()
{
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
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);
    SetPlayerHealth(50);
    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("cellartest","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");
}



RE: Does anybody know how I'm supposed to do this pls? - Neelke - 03-09-2014

wakeup()

wakeUp()

You forgot the big U. Smile


RE: Does anybody know how I'm supposed to do this pls? - Mudbill - 03-09-2014

Yeah, that wakeup(); call is yours, not mine, so I don't know of it. I just remembered you had something like it from another thread. Of course you must make it match yours.


RE: Does anybody know how I'm supposed to do this pls? - Radical Batz - 03-09-2014

Oh I'm sorry XD I didn't realize that it was was different from the other wakeUp. I should look more carefully. I'm sorry Mudbill, I hope you forgive me XD