KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
Error at door slam script
I get a fatal error when loading a map. It says
"main (19, 1) :ERR : Unexpected Token '}'
This is how my script looks like:
Quote:////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I've sincerely no idea where the error might be, since i directly copied the script from a tutorial at the wiki.
Current Projects:
DADDY - 10%
|
|
07-07-2012, 09:01 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: Error at door slam script
You have an extra "}" after the function
func_slam. I removed it:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I rate it 3 memes.
|
|
07-07-2012, 09:04 PM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: Error at door slam script
(07-07-2012, 09:04 PM)andyrockin123 Wrote: You have an extra "}" after the function
func_slam. I removed it:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
} Thanks, now it doesn't send me a FATAL ERROR. But now the door doesn't slam ._. ¿Must i place an script area on the map?
Current Projects:
DADDY - 10%
|
|
07-07-2012, 09:36 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: Error at door slam script
As far as the level editor goes, (according to your script) you should have a door named "door2", and a script_area (that is big enough so that the player will collide with it) named "script_slam". Make sure you have both of those and that they're named accordingly.
Upon colliding with the script area, the script should trigger properly.
I rate it 3 memes.
|
|
07-07-2012, 09:39 PM |
|
KingCrimson
Junior Member
Posts: 45
Threads: 14
Joined: Jul 2012
Reputation:
0
|
RE: Error at door slam script
Worked! About the script area, it was on the tutorial but i didn't see it lol. Thanks for helping
Current Projects:
DADDY - 10%
|
|
07-07-2012, 09:48 PM |
|
|