Frictional Games Forum (read-only)
ATDD-Scripting - 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: ATDD-Scripting (/thread-23321.html)

Pages: 1 2


ATDD-Scripting - LordOfDragons - 09-22-2013

Hello guys, after i created my first cs (Just 5 minutes of gameplay) im finally ready to create a bigger thing.
But i got a question: I want the player to wake up in his bedroom and i dont know how to script that at all. Its a bit difficult

Could someone help?


RE: ATDD-Scripting - PutraenusAlivius - 09-22-2013

http://www.frictionalgames.com/forum/thread-4626.html

Don't post in that thread. Post here if you have any problems.

EDIT: Nevermind that. The thread is closed.


RE: ATDD-Scripting - LordOfDragons - 09-22-2013

Oh, sorry if i posted it in the wrong section. Didnt see that thread when checking the forum...
When its wrong, im sure a mod will move it :L

Could someone help btw? Im rly stuck right now.


RE: ATDD-Scripting - LordOfDragons - 09-22-2013

I dont know where to put the script text exactly...


RE: ATDD-Scripting - DamnNoHtml - 09-22-2013

You have a create an .hps file with the same name as your map. So, if your map is named 01_house.map, you would make a file called 01_house.hps. (To do that, open notepad, hit save as, change .txt to 'All Files' and then type 01_house.hps.

There, you open the script file, and enter this:

Code:
void OnStart() {
      wakeUp()
}

void wakeUp () {

    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)

    FadeIn(20);      // Amount of seconds the fade in takes

    FadeImageTrailTo(2, 2);

    FadeSepiaColorTo(100, 4);

    SetPlayerActive(false);    

    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head

    FadeRadialBlurTo(0.15, 2);

    SetPlayerCrouching(true);              // Simulates being on the ground

    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);

}



RE: ATDD-Scripting - LordOfDragons - 02-09-2014

(09-22-2013, 06:43 PM)DamnNoHtml Wrote: You have a create an .hps file with the same name as your map. So, if your map is named 01_house.map, you would make a file called 01_house.hps. (To do that, open notepad, hit save as, change .txt to 'All Files' and then type 01_house.hps.

There, you open the script file, and enter this:

Code:
void OnStart() {
      wakeUp()
}

void wakeUp () {

    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)

    FadeIn(20);      // Amount of seconds the fade in takes

    FadeImageTrailTo(2, 2);

    FadeSepiaColorTo(100, 4);

    SetPlayerActive(false);    

    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head

    FadeRadialBlurTo(0.15, 2);

    SetPlayerCrouching(true);              // Simulates being on the ground

    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);

}

So i just have to put that into my .hps file? I mean exactly like that.


RE: ATDD-Scripting - Wapez - 02-09-2014

Yes, and when you copied that and put it in your map you need to write this below it:

void OnEnter()
{

}

void OnLeave()
{

}

It's a simple wake up function but it works. Personally I would use a switch loop for best effect.


RE: ATDD-Scripting - LordOfDragons - 02-09-2014

Hm that script is new to me, so i dont get it. If i could see a tutorial or something like that it would be easier to understand where to put it.

I guess i have to put it on void onStart() but i dont rly know. I will test, but there prob will be some errors.


RE: ATDD-Scripting - Mudbill - 02-10-2014

(02-09-2014, 08:41 PM)Wapez Wrote: Yes, and when you copied that and put it in your map you need to write this below it:

void OnEnter();
{

}

void OnLeave();
{

}

It's a simple wake up function but it works. Personally I would use a switch loop for best effect.

I'm guessing the semi-colons were just typos.

@OP
They are not supposed to be there though. These are also not required, but if you want to run scripts as the player is re-entering or leaving the level, use those. OnStart is only ran the first time the player loads the map, in case you didn't know.


RE: ATDD-Scripting - LordOfDragons - 02-10-2014

Yes but i just dont get how to write it in there correctly... Anyone got a tutorial i can watch, to see how to do it?