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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Scripting help
Turner64 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Apr 2012
Reputation: 0
#1
Scripting help

Hi, I have had this scripting problem for a while now and I have been searching on the internet for solutions but I have not yet found one. I have turned to this website for a solution, I'm hoping someone here can help me. My scripting looks all right but when I get on Amnesia: The Dark Descent I get a FATAL ERROR: (29,1) unexpected token '{' I will post my script below.

void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);
}

void OnEnter()
{

}

void OnLeave()
{

}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
}
////////////////////////////
//void OnStart()
{
AddEntityCollideCallback("Player", "push", "Push", true, 1);
AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
}


void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(30000, 0, 0, false);
}


void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_12", true, true);
SetSwingDoorLocked("mansion_12", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}
04-14-2012, 11:05 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: Scripting help


"//void OnStart()"


Noob scripting tutorial: From Noob to Pro

04-14-2012, 11:07 PM
Find
Xanthos Offline
Senior Member

Posts: 318
Threads: 9
Joined: Mar 2012
Reputation: 8
#3
RE: Scripting help

Why is there two of the
OnStart
OnLeave
OnEnter
?
EDIT: Or is it two scripts?

(This post was last modified: 04-14-2012, 11:09 PM by Xanthos.)
04-14-2012, 11:08 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Scripting help

Is this the same script file? because you can only have 1 of OnStart, OnEnter and OnLeave

04-14-2012, 11:09 PM
Find
Turner64 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Apr 2012
Reputation: 0
#5
RE: Scripting help

It's two scripts in one hps folder for the same map.
oh ok so what your saying is I need two hps folders for one map?
(This post was last modified: 04-14-2012, 11:13 PM by Turner64.)
04-14-2012, 11:11 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#6
RE: Scripting help

No it's supposed to look like this:


void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "push", "Push", true, 1);
AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
}

void ActivateMonster(string &in item)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "Idle");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "Idle");
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(30000, 0, 0, false);
}

void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_12", true, true);
SetSwingDoorLocked("mansion_12", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}

(This post was last modified: 04-14-2012, 11:16 PM by SilentStriker.)
04-14-2012, 11:16 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#7
RE: Scripting help

(04-14-2012, 11:11 PM)Turner64 Wrote: It's two scripts in one hps folder for the same map.
oh ok so what your saying is I need two hps folders for one map?
What we're saying is that you should merge them, because you can only have one function of each. What on earth are "hps folders"??


Noob scripting tutorial: From Noob to Pro

04-14-2012, 11:18 PM
Find
Turner64 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Apr 2012
Reputation: 0
#8
RE: Scripting help

It work!!! Thank you all who help me with this promblem and SilentStriker thank you for putting a working script up for me.
04-15-2012, 12:10 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: Scripting help

You're welcome Smile

04-15-2012, 12:11 AM
Find
Turner64 Offline
Junior Member

Posts: 4
Threads: 1
Joined: Apr 2012
Reputation: 0
#10
RE: Scripting help

SilentStriker Ill message you if i need anything else is that alright?
04-15-2012, 12:13 AM
Find




Users browsing this thread: 3 Guest(s)