Frictional Games Forum (read-only)

Full Version: Key scripting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Peoples
Of course by the title you know im a noob at Custom story making Tongue
So i want a locked door and you need a key. I followed a tutorial on how to do it, but when i coded it, The custom story crashed. If you can respond Thanks. I might need more help with more Questions soooo if you want to you can add me on:
Steam: Redzombie18
Skype:brianliebrand
Thanks
Redzombie18
(07-18-2012, 04:35 AM)Redzombie18 Wrote: [ -> ]Hello Peoples
Of course by the title you know im a noob at Custom story making Tongue
So i want a locked door and you need a key. I followed a tutorial on how to do it, but when i coded it, The custom story crashed. If you can respond Thanks. I might need more help with more Questions soooo if you want to you can add me on:
Steam: Redzombie18
Skype:brianliebrand
Thanks
Redzombie18
void OnStart()
{
AddUseItemCallback("", "nameofkey", "nameofdoor", "KeyOnDoor", true);
}



void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "nameofdoor", 0, false);
AddPlayerSanity(25);
RemoveItem("nameofkey");
}

Welcome To the forums Smile