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?
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.
I dont know where to put the script text exactly...
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);
}
(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.
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.
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.
(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.
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?