Frictional Games Forum (read-only)

Full Version: Can someone take a look?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
PLEASE SEE 5th RESPONCE

Spoiler below!

Can someone help me out with this script, I have no clue what is wrong. I am honestly no good at this and keep getting something wrong please help if you can!

Quote: ////////////////////////////
// Run when entering map
void OnEnter(){
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);



SetPlayerSanity(10);
SetPlayerHealth(40);
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}

When I quickly watch this I can tell you should remove: "void wakeUp ()", and then put "}" after this line: "AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last".
There are lots of problems I can point out.Never put one function inside another or you will get tons of errors. So, it should be organized like this:

void OnEnter()
{
stuff
}


void beginStory(string &in asTimer)
{
stuff
}

Like JMFStorm said, get rid of "void wakeup ()", it serves no purpose.
Make sure every function has its own open and close bracket.
Make sure every number with a decimal is followed by "f": e.g. "10.0f".
I recommend that you don't use this script for the beginning, watch some Youtube tutorials, or read some beginner tutorials on the wiki, then when you get the scripts. Use this one.
Put the stuff in the void OnStart from the void OnEnter
I need some help here if anyone can take a look at this script and tell me what is wrong, I keep getting an error on line 38,56 and don't know what's wrong.

Spoiler below!
////////////////////////////
// Run when entering map
Void OnStart()

{
AddEntityCollideCallback("Player", "ScriptArea_1", "SetEntityActive", true, 1);
}

void OnEnter(){

FadeOut(20); // 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", 8.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);



SetPlayerSanity(10);
SetPlayerHealth(40);
}

////////////////////////////
//Insane statue effect

void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)

{
PlaySoundAtEntity("", "react_scare", "Player", 1.0f, false);

SetEntityActive ("deformed_man_5", false);
SetEntityActive ("deformed_man_6", false);
SetEntityActive ("deformed_man_7", false);
SetEntityActive ("deformed_man_8", false);
SetEntityActive ("deformed_man_9", false);
SetEntityActive ("deformed_man_10", false);
SetEntityActive ("deformed_man_11", false);
SetEntityActive ("deformed_man_12", false);
SetEntityActive ("deformed_man_13", false);
SetEntityActive ("deformed_man_14", false);
SetEntityActive ("deformed_man_15", false);
SetEntityActive ("deformed_man_16", false);
SetEntityActive ("deformed_man_17", false);
SetEntityActive ("deformed_man_18", false);
}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}
First of all, it's "void", not "Void".

Second of all, wtf is this?
Quote:void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)
I mean, what were you even trying to do here? Change an already existing function and then just add some additional parameters because they looked nice?

Understand what you're doing. That's my solution.
(05-12-2012, 02:17 AM)Cranky Old Man Wrote: [ -> ]First of all, it's "void", not "Void".

Second of all, wtf is this?
Quote:void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)
I mean, what were you even trying to do here? Change an already existing function and then just add some additional parameters because they looked nice?

Understand what you're doing. That's my solution.
"Understand what you're doing. That's my solution."

Well I ask for help to get a better understanding of what I am doing.

and

"void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)"

must have gotten jumbled up with something else when I was deleting something else. And I think it looks very nice! Thank you for thinking so too!
(05-12-2012, 02:30 AM)Cocomunches Wrote: [ -> ]
(05-12-2012, 02:17 AM)Cranky Old Man Wrote: [ -> ]First of all, it's "void", not "Void".

Second of all, wtf is this?
Quote:void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)
I mean, what were you even trying to do here? Change an already existing function and then just add some additional parameters because they looked nice?

Understand what you're doing. That's my solution.
"Understand what you're doing. That's my solution."

Well I ask for help to get a better understanding of what I am doing.

and

"void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)"

must have gotten jumbled up with something else when I was deleting something else. And I think it looks very nice! Thank you for thinking so too!
You don't just ask for help every time your code somehow doesn't work.
Begin from the beginning: Learn to script with the aid of manuals and tutorials.
Here's an online tutorial: From Noob to Pro
(05-12-2012, 02:39 AM)Cranky Old Man Wrote: [ -> ]
(05-12-2012, 02:30 AM)Cocomunches Wrote: [ -> ]
(05-12-2012, 02:17 AM)Cranky Old Man Wrote: [ -> ]First of all, it's "void", not "Void".

Second of all, wtf is this?
Quote:void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)
I mean, what were you even trying to do here? Change an already existing function and then just add some additional parameters because they looked nice?

Understand what you're doing. That's my solution.
"Understand what you're doing. That's my solution."

Well I ask for help to get a better understanding of what I am doing.

and

"void SetEntityActive(string& asName, bool abActive);(string &in asParent, string &in asChild, int alState)"

must have gotten jumbled up with something else when I was deleting something else. And I think it looks very nice! Thank you for thinking so too!
You don't just ask for help every time your code somehow doesn't work.
Begin from the beginning: Learn to script with the aid of manuals and tutorials.
Here's an online tutorial: From Noob to Pro
But of course I ask when I need help. You can choose not to help.
Pages: 1 2