LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
|
09-22-2013, 09:32 AM |
|
LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
DamnNoHtml
Senior Member
Posts: 469
Threads: 34
Joined: Sep 2010
Reputation:
16
|
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 |
|
LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
Wapez
Senior Member
Posts: 360
Threads: 37
Joined: Mar 2012
Reputation:
19
|
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.
(This post was last modified: 02-12-2014, 04:13 PM by Wapez.)
|
|
02-09-2014, 08:41 PM |
|
LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
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 |
|
LordOfDragons
Senior Member
Posts: 501
Threads: 14
Joined: Aug 2013
Reputation:
13
|
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 |
|
|