Script Didn't 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Script Didn't Work... (/thread-4992.html) |
Script Didn't Work... - Kyle - 10-10-2010 Here's the script... I tried to combine two scripts for a locked door and for another door that is supposed to shut, but it wouldn't let me load the level. void OnStart() { AddEntityCollideCallback("Player" , "ScriptArea_1" , "CollideRoomTwo" , true, 1); } void CollideRoomTwo(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("cellar_wood01_1", true, true); GiveSanityDamage(25, true); } { AddUseItemCallback("", "awesomekey_2" , "lockedcellardoor1" , "UsedKeyOnDoor" , true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("lockedcellardoor1" , false, true); PlaySoundAtEntity("", "unlock_door" , "lockedcellardoor1" , 0, false); RemoveItem(awesomekey_2); } void OnEnter() { } void OnLeave() { RE: Script Didn't Work... - Neurological - 10-10-2010 I'm not a script expert but I think you missed the closing branch on OnLeave, and maybe you should add: Code: AddUseItemCallback("", "awesomekey_2" , "lockedcellardoor1" , "UsedKeyOnDoor" , true); under OnStart right after: Code: AddEntityCollideCallback("Player" , "ScriptArea_1" , "CollideRoomTwo" , true, 1); So in the end the full script would look like this: Code: void OnStart() RE: Script Didn't Work... - Kyle - 10-10-2010 Nope, didn't work The error says: FATAL ERROR: Could not load script file 'custom_stories/Exploration/maps/ch01/C:/Program Files(x86)/Steam/SteamApps/common/amnesia the dark descent/custom_stories/Exploration/Maps/ch01/Exploration02.hps'! main (18, 12) : ERR: 'awesomekey_2' is not declared RE: Script Didn't Work... - Neurological - 10-10-2010 (10-10-2010, 02:39 AM)Kyle Wrote: Nope, didn't work Try this: Code: void OnStart() RE: Script Didn't Work... - Kyle - 10-10-2010 Thanks very much! It works perfectly! |