void OnStart() //The AddCallbacks were not within a void. Placed within OnStart().
{
AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);
AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
}
void PickupKey(string &in asEntity, string &in asItem)
{
AddQuest("quest1", "TestQuest");
AddUseItemCallback("", "MasterBedroomKey", "bedroomdoor","UseMasterBedroomKey", true);
AddEntityCollideCallback("Player", "AreaMemento", "EventQuest", true, 1);
} //Missing closing brace
void UseMasterBedroomKey(string &in asItem, string &in asEntity)
{
SetMessage("message", "message1", 3.0f); //Changed from integer to float. Does not affect the way it is run however.
}
AddTimer("", 1.1, "TimerDoorCanClose"); //AddTimer() can only be used within a routine (void). Collide with a scriptarea if necessary. Move it or give it a void as necessary.
//Moved brace to under the below void.
void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("Door", false);
}
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
}
void TimerPlaceCrowbar(string &in asTimer)
{
SetEntityActive("Joint", true);
PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}
void BreakDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Joint", false);
SetEntityActive("Broken", true);
SetSwingDoorLocked("Door", false, false);
SetSwingDoorClosed("Door", false, false);
SetSwingDoorDisableAutoClose("Door", true);
AddPropImpulse("Door", 0, 0, 3, "world");
CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "Areaeffect", false);
PlaySoundAtEntity("", "break_wood_metal", "Areaeffect", 0, false);
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
AddTimer("", 0.1, "TimerPushDoor");
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("Door", -4, 2, 1, "world");
AddTimer("", 1.1, "TimerDoorCanClose");
}
//void TimerDoorCanClose(string &in asTimer) //This code has been used before. May cause errors when called again in code.
//{ //It is easier to call a new timer and use that instead.
//SetSwingDoorDisableAutoClose("Door", false); //And it is missing a closing brace :P
//}
void touchdoor(string &in asEntity, string &in type)
{
AddQuest("door", "touchdoor");
}
void EventQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("area", "enterarea");
}
void touchdoor(string &in asEntity) //You cannot name two routines after the same void. Change this to touchdoor_2 or something.
{ //You will need to change any codes/messages as well which point to here.
AddQuest("door", "touchdoor");
}