Frictional Games Forum (read-only)
Key will now not work - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Key will now not work (/thread-13351.html)



Key will now not work - A.I. - 02-15-2012

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");
}


RE: 'key' Not Declared - Obliviator27 - 02-15-2012

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.



RE: 'key' Not Declared - A.I. - 02-15-2012

Ohh thanks, it now works, this makes me feel a bit dumb......


RE: 'key' Not Declared - Obliviator27 - 02-15-2012

(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





RE: 'key' Not Declared - A.I. - 02-15-2012

(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?


RE: Key will now not work - flamez3 - 02-15-2012

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)



RE: Key will now not work - A.I. - 02-15-2012

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)?


RE: Key will now not work - flamez3 - 02-15-2012

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.



RE: Key will now not work - A.I. - 02-15-2012

OHH THANK YOU!!! THANK YOU THANK YOU!!! It works correctly so no more problems Smile