12-22-2011, 10:56 PM
Hey guys,
EDIT: Updated the script and managed to remove the error for line 20 but my current error is it points to the bracket below void doorclosebang
I've got an issue when I start my level, I want to make a door slam when I walk into a specific area and play a sound when it happens. I am getting an error on line 20 and line 25. Which are both curly brackets. I'm not sure what this means. This is my code below. The 20th line can be seen below //Triggers
PS: I'm new to PHP/C++ and I think this a good starting point. I'm good with VB and Ok ish with C#. So far i've found this the easiest code to understand and read fluently but this kind of issue I am unsure of. I'm sure it is something simple and silly. =)
Thanks
EDIT: Updated the script and managed to remove the error for line 20 but my current error is it points to the bracket below void doorclosebang
I've got an issue when I start my level, I want to make a door slam when I walk into a specific area and play a sound when it happens. I am getting an error on line 20 and line 25. Which are both curly brackets. I'm not sure what this means. This is my code below. The 20th line can be seen below //Triggers
PS: I'm new to PHP/C++ and I think this a good starting point. I'm good with VB and Ok ish with C#. So far i've found this the easiest code to understand and read fluently but this kind of issue I am unsure of. I'm sure it is something simple and silly. =)
Thanks
PHP Code:
////////////////////////////////
// Run when starting the map
void OnStart()
////////////////////////////////
// Entities
{
AddUseItemCallback("", "Bedroom_Key", "Bedroom_Key_Door", "UsedKeyOnDoor", true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor
AddEntityCollideCallback("Player", "DoorCloseArea1", "DoorCloseBang", true, 1); // Declaring when a player walks into an area called "Name" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity) //Declaring the Key as a string
{
SetSwingDoorLocked("Bedroom_Key_Door", false, true); //Sets what door the key works on and it can only be used once
PlaySoundAtEntity("", "unlock_door", "Bedroom_Key_Door", 0, false); //Plays sound when the key is used on the door
RemoveItem("Bedroom_Key"); //Removes the key after it has been used
}
////////////////////////////////
// Triggers
void DoorCloseBang(string &in asParent, string &in asChild, int alState);
{
SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close
PlaySoundAtEntity("", "bang", "DoorCloseBang", 0, false); //Create banging on the door sound when the door shuts
}
////////////////////////////////
// Run when entering the map
void OnEnter()
{
}
////////////////////////////////
// Run when leaving the map
void OnLeave()
{
}