Key Not Being Removed From Inventory After Use - 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 Not Being Removed From Inventory After Use (/thread-19478.html) |
Key Not Being Removed From Inventory After Use - AGP - 12-07-2012 Just as the title says, I have an issue with a level door key not being destroyed after its use (in the 00_map). I checked my files and it seems to be scripted correctly, but then again, I'm new to this, so I'm more than likely wrong. I attempted to just make a script file for the next map and remove the item from the inventory there (the 01_map) by using the following script: void RemoveItem("leveldoorkey_1"); That didn't work so I removed the void and the map loaded with the key still in the inventory. Moved it to the void OnStart section, still nothing. Okay, so my hps scripts look like this: AddUseItemCallback("OpenDoor", "leveldoor1_key", "leveldoor1", "UnlockLevelDoor", true); From what I understand, the last parameter is for auto removal of the item once it's been used. Help will be greatly appreciated and met with a very outstanding "thank you!" RE: Key Not Being Removed From Inventory After Use - Your Computer - 12-07-2012 The last parameter is for the callback to be removed when the item is used on the entity. In other words, the connection between the key and the door is removed when the key is used on the door. If you used the parameter variables, you wouldn't have to worry about manually typing in the entity names. Also, we need to see more of your code. RE: Key Not Being Removed From Inventory After Use - The chaser - 12-07-2012 Errr... nope. It is: void OnStart() { AddUseItemCallback("OpenDoor", "leveldoor1_key", "leveldoor1", "UnlockLevelDoor", true); } void UnlockLevelDoor (string &in asItem, string &in asEntity) { ///Door stuff RemoveItem("leveldoor1_key"); } It would be certainly better if you posted the whole script but, by what I can see, that's the issue. RE: Key Not Being Removed From Inventory After Use - FlawlessHappiness - 12-07-2012 With simple key-to-door scripts you can write RemoveItem(asItem); This will remove the item that you just used RE: Key Not Being Removed From Inventory After Use - AGP - 12-07-2012 Thanks to everyone who replied! It's been fixed. It was a simple matter of forgetting a semi-colon at the end of RemoveItem("leveldoor1_key"); I had had it in there before but didn't add the ;... so *facepalm*. But thank you all for helping! =D =D |