Frictional Games Forum (read-only)
Combine Items [SOLVED] - 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: Combine Items [SOLVED] (/thread-6456.html)



Combine Items [SOLVED] - Phoroneus - 02-02-2011

After finding a decent resource here:
http://www.frictionalgames.com/forum/thread-4593.html
and a similar (and yet-unanswered) question here:
http://www.frictionalgames.com/forum/thread-5127.html

I'm left asking:
How do inventory.hps files work? I'm attempting to set up a combination of two items and while I've reached the point at which the items no longer complain that they cannot be combined, they're not removed and I'm not given the combination item.

After much fiddling and brute-force trial-and-error attempts, I've set everything back to the way it "should" be (imitating the original inventory.hps and map.hps files) and am rewarded with nothing more than the lack of an error message when trying to combine.

Recompiling the script and .lang files gives the error:
Script output for Inventory
main(13, 28) : ERR : Unexpected end of file

This is my inventory file in full (don't worry it's short). Anyone see any typos or anything I might've missed that would bring the wrath of the error gods down on me?
Spoiler below!
Code:
//Level 00 - Entryway//
//Combine ember and fuel//
void CombineTrashcan(string &in asItemA, string &in asItemB)
{
    AddPlayerSanity(10);
    RemoveItem(asItemA); RemoveItem(asItemB);
    GiveItem("LitBucket", "Puzzle", "metal_bucket_lit", "metal_bucket_lit.tga", 0);
    AddDebugMessage("Combined items!", false);
}
//////////////////////////

void OnGameStart()
{
    AddCombineCallback("emberandpaper", "EmberBucket", "ScrapPaper", "CombineTrashcan", false);
}


EDIT: I found the problem. It turned out I was editing a copy of the inventory file rather than the one inside my custom_stories/story_name/maps/ folder. Also I used two different names for the same combination, which I've fixed in my code above.


RE: Combine Items [SOLVED] - jens - 02-02-2011

Do you need the OnStart at all in an inventory file?


RE: Combine Items [SOLVED] - Phoroneus - 02-02-2011

(02-02-2011, 07:07 AM)jens Wrote: Do you need the OnStart at all in an inventory file?

Probably not. I was basing mine off of the ones I'd found that were reported to have worked. Fortunately I've fixed my error in file placement, so it's working now (with the exception of the .lang file entries for the given items... those don't seem to want to appear). There isn't an OnStart() in the original (FG-created) one, so I might as well take it out.

Good catch, Jens.