Frictional Games Forum (read-only)

Full Version: Key will now not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
EDIT: I am struggling 20 minutes later with the door not opening I have looked at the script and look at my code looked at just about all the lines of code on the wiki and I still can't figure out what is wrong


void OnStart()
{
AddUseItemCallback("", "corridorkey", "corridordoor", "KeyOnDoor", true);
}

void MyFunc(string &in asName, int alCount)
{
SetSwingDoorLocked("corridordoor", false, true);
PlaySoundAtEntity("", "unlock_door", "corridordoor", 0, false);
RemoveItem("corridorkey");
}
You need to put them in Quotation marks.
"corridordoor" and "corridorkey"
By not doing this, you tell the engine that they are variables, as opposed to the strings that they are.
Ohh thanks, it now works, this makes me feel a bit dumb......
(02-15-2012, 03:25 AM)Vaelwing22 Wrote: [ -> ]Ohh thanks, it now works, this makes me feel a bit dumb......
Don't worry about it. When I first started, I couldn't figure out for the life of me why me extra_english.lang file didn't work. Turns out I misspelled Entry. We all start somewhere. Smile


(02-15-2012, 03:35 AM)Obliviator27 Wrote: [ -> ]
(02-15-2012, 03:25 AM)Vaelwing22 Wrote: [ -> ]Ohh thanks, it now works, this makes me feel a bit dumb......
Don't worry about it. When I first started, I couldn't figure out for the life of me why me extra_english.lang file didn't work. Turns out I misspelled Entry. We all start somewhere. Smile
Lol
Bump?
If you are wondering why it is not working still, it's because you have the incorrect syntax, use this:

(string &in asItem, string &in asEntity)
Still not working but I am not sure if it is void FUNCTION(string &in asItem, string &in asEntity) or void MyFunc(string &in asItem, string &in asEntity)?
void OnStart()
{
AddUseItemCallback("", "corridorkey", "corridordoor", "KeyOnDoor", true);
}


void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("corridordoor", false, true);
PlaySoundAtEntity("", "unlock_door", "corridordoor", 0, false);
RemoveItem("corridorkey");
}


You didn't name the functions properly and you didn't use the right syntax. Use the one above.
OHH THANK YOU!!! THANK YOU THANK YOU!!! It works correctly so no more problems Smile