Why isn't this script working? - 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: Why isn't this script working? (/thread-12486.html) |
Why isn't this script working? - Shadowfied - 01-09-2012 Hi. I'm working on a custom story where In one level I have an empty bucket placed, which the player needs to pick up and go fill it using a pump. So I put a script area around the pump, ticked the "Item Interaction" option and made this script: (This is in the void OnStart() area) AddUseItemCallback("", "bucket_empty_1", "AreaFillBucket", "FillBucketFunc", true); Then outside of the onstart area: void FillBucketFunc(string &in asItem, string &in asEntity) { PlaySoundAtEntity("", "04_water_puff.snt", AreaFillBucket", 0.0f, true); RemoveItem(asItem); GiveItemFromFile("filled_bucket", "wooden_bucket_filled.ent"); } But when I try to enter the level the game crashes giving me an error saying: "FATAL ERROR: Could not load script file ~~~~~~ ExecuteString(1, 1) : ERR : No matching signatures to 'OnEnter()' ExecuteString (1, 1) : ERR : No matching signatures to 'OnLeave()' main (21, 1) : ERR : Unexpected end of file" Here is the entire script (it's a new level so it's tiny) Spoiler below!
Also if I remove the "void FillBucketFunc" part the map works.. What did I do wrong? Thanks in advance. RE: Why isn't this script working? - flamez3 - 01-09-2012 RemoveItem(asItem); it needs quotation marks around asItem. And you missed the other quotation mark around AreaFillBucket Quote:void OnStart() There is the script that you should use RE: Why isn't this script working? - Shadowfied - 01-09-2012 Thank you very much. That's what happens when you start scripting 6 am. I can get into the level now and the script works, I get the filled bucket but the empty bucket is still there..Any idea on how to fix that? Edit: Nevermind. Removed the quotations around "asItem" and now it gets removed. So it works, thanks again. RE: Why isn't this script working? - flamez3 - 01-09-2012 (01-09-2012, 09:20 AM)Shadowfied Wrote: Removed the quotations around "asItem" and now it gets removed. So it worksOops, wrong advice |