Frictional Games Forum (read-only)

Full Version: Game keeps crashing.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My game keeps crashing when I try to test something out, its a script related problem, I know, but I dont know wat is wrong, I cant find wat is causing the problem, I was making a key for a door, and when I tried to test it, it crashed.

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("MetalKey", "Door1", "Func01", false);
}

void Func01(string &in asItem, string &in asEntity)
{
RemoveItem(MetalKey);
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{


It crashes and sais MetalKey is not defined. wtf?

}
Have you made your extra-english file for the key?

+

SetSwingDoorLocked(asEntity, false, true);
should be
SetSwingDoorLocked("Door1", false, true);
You're wrong X4anco. Khan, try this:

Code:
void OnEnter()
{
     AddUseItemCallback("MetalKey", "Door1", "Func01", false);
}
void Func01(string &in asItem, string &in asEntity)
{
     RemoveItem(asItem);
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
}
Whooops Big Grin
Still crashed Sad
Alright, I know why, It's because there's no OnStart function. xD

Code:
void OnStart()
{
     AddUseItemCallback("MetalKey", "Door1", "Func01", false);
}
void Func01(string &in asItem, string &in asEntity)
{
     RemoveItem(asItem);
     SetSwingDoorLocked(asEntity, false, true);
     PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
}