![]() |
Problem with combining items - 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: Problem with combining items (/thread-4593.html) |
Problem with combining items - Mofo - 09-20-2010 Hello everyone, I want to combine 2 items in my inventory and remove both of them in return for a new item. I tried some code i found in the Maps/Main/inventory.HPS file, but I can't get it to work in my custom story. I can combine any two items I want, but I can only receive items that are combined in the main story (orb, hand drill, copper tube and needle). Is there a way to receive other items like keys and oil? RE: Problem with combining items - MulleDK19 - 09-20-2010 (09-20-2010, 01:35 AM)Mofo Wrote: Hello everyone, Well, did you actually add a callback? RE: Problem with combining items - Mofo - 09-20-2010 (09-20-2010, 01:43 AM)MulleDK19 Wrote: Well, did you actually add a callback? I did, here's the code inside my custom story hps: void OnStart() { AddCombineCallback("hammerandkey", "key_laboratory_1", "stone_hammer_1", "CombineHammerAndKey", false); } void CombineHammerAndKey(string &in asItemA, string &in asItemB) { PlayGuiSound("15_make_hammer", 1.0f); RemoveItem(asItemA); RemoveItem(asItemB); GiveItem("straightened_key", "Puzzle", "straightened_key", "key_laboratory.tga", 0); } RE: Problem with combining items - jens - 09-20-2010 If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works. RE: Problem with combining items - Mofo - 09-20-2010 (09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works. Worked like a charm, thank you very much ![]() RE: Problem with combining items - house - 02-03-2011 (09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works. Exactly what do you name the inventory file? RE: Problem with combining items - Mofo - 02-03-2011 (02-03-2011, 12:44 AM)house Wrote:(09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works. custom_stories/*your_story_here*/maps/inventory.hps If all else fails, I made you a custom story with a working custom combination. RE: Problem with combining items - house - 02-03-2011 I'll try that. Thanks! |