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
[SOLVED]Scripting problem with playing sound
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#2
RE: [HELP]Scripting problem with playing sound

(08-10-2011, 07:59 PM)Dobbydoo Wrote: I want to make a sound play when I walk to a chair, but I get a strange error everytime I try. I don't know what I have done wrong and I've been trying to find a solution for hours Sad
The error message I get is: main (13,1) : ERR : Unexpected token '{'

Here is my coding:

Spoiler below!
void OnStart()

{
AddEntityCollideCallback("Player", "PlayerCollide", "Sound", true, 1);
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "05_event_door_bang.snt", "Player", 0, false);
}

///////////////////////////////////////////////////////////////////////
{
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster_grunt", true);

AddEnemyPatrolNode("monster_grunt", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_8", 0, "");
}

/////////////////////////////////////////////////////////////////////


Try this:

void OnStart()

{
AddEntityCollideCallback("Player", "PlayerCollide", "Sound", true, 1);
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "05_event_door_bang.snt", "Player", 0, false);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false);
RemoveItem("key_1");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("monster_grunt", true);
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("monster_grunt", "PathNodeArea_8", 0, "");
}

“Life is a game, play it”
(This post was last modified: 08-10-2011, 08:05 PM by HumiliatioN.)
08-10-2011, 08:05 PM
Find


Messages In This Thread
RE: [HELP]Scripting problem with playing sound - by HumiliatioN - 08-10-2011, 08:05 PM



Users browsing this thread: 1 Guest(s)