Silly scripting - 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: Silly scripting (/thread-9866.html) |
Silly scripting - GoDl1Kelol - 08-19-2011 Okay, I've been trying to get a key to open a door for a century, here's my script void OnStart() { AddUseItemCallback("", "keyfordoor", "mansion_2", "UsedKeyOnDoor", true); SetEntityCallbackFunc("keyfordoor", "OnPickup"); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_2", false, true); PlaySoundAtEntity("", "unlock_door.snt", "mansion_2", 0, false); RemoveItem("keyfordoor"); } void OnPickup(string &in asEntity, string &in type) { SetEntityActive("monster", true); ShowEnemyPlayerPosition("monster"); } I entered it many times and it didn't work and now all of a sudden it shows up with an error 12:13 ERR: keyfordoor not declared I could really use some help for this RE: Silly scripting - Rapture - 08-19-2011 Is "keyfordoor" the name of the key? I would normally leave it its default name. Code: void OnStart() Code: void UsedKeyOnDoor(string &in asItem, string &in asEntity) Code: void OnPickup(string &in asEntity, string &in type) That should make it work. RE: Silly scripting - GoDl1Kelol - 08-19-2011 That's weird, I changed the name of the key everywhere and I still get the same error Can't load script file...: Keyfordoor not declared EDIT: I removed the script file too and tried running it like that and it still says it...wat EDIT: Okay now it's normal, and the door just opened but the monster didn't spawn, lemme see my stuff EDIT: I just moved these: up with the other ones and it worked SetEntityActive("monster", true); ShowEnemyPlayerPosition("monster"); |