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


Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ATDD-Scripting
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#1
Shocked  ATDD-Scripting

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?

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
09-22-2013, 09:00 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: ATDD-Scripting

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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 09-22-2013, 09:34 AM by PutraenusAlivius.)
09-22-2013, 09:32 AM
Find
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#3
RE: ATDD-Scripting

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.

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
09-22-2013, 10:17 AM
Find
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#4
RE: ATDD-Scripting

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

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
09-22-2013, 04:11 PM
Find
DamnNoHtml Offline
Senior Member

Posts: 469
Threads: 34
Joined: Sep 2010
Reputation: 16
#5
RE: ATDD-Scripting

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:

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

}

Creator of Wake, Through the Portal, Insomnia, and Cycles What to do with HPL3....
09-22-2013, 06:43 PM
Find
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#6
RE: ATDD-Scripting

(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:

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.

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
02-09-2014, 08:23 PM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#7
RE: ATDD-Scripting

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.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
(This post was last modified: 02-12-2014, 04:13 PM by Wapez.)
02-09-2014, 08:41 PM
Find
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#8
RE: ATDD-Scripting

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.

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
02-09-2014, 08:59 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#9
RE: ATDD-Scripting

(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.

02-10-2014, 02:04 AM
Find
LordOfDragons Offline
Senior Member

Posts: 501
Threads: 14
Joined: Aug 2013
Reputation: 13
#10
RE: ATDD-Scripting

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?

The question that will never be answered:
SOMA WHY ARE YOU SO BEAUTIFUL? ;_;
02-10-2014, 12:32 PM
Find




Users browsing this thread: 3 Guest(s)