Frictional Games Forum (read-only)
Game does not recognize inventory.hps file - 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: Game does not recognize inventory.hps file (/thread-56578.html)



Game does not recognize inventory.hps file - LagerShan - 11-08-2019

When trying to combine both items, the game does not seem to combine both items at all, nor give out a debug message.
I can post in the Code here and let me know what the problem is, thanks. I tried multiple ways to fix it but none worked so far.
And yeah, the items in game have the same name as what is put into the code. It does not combine the items whatsoever. Nothing functions. The file is also placed in the same folder of the map and hps file.
Code:
void OnGameStart()
{
    AddCombineCallback("", "HammerPiece_1", "HammerPiece2_1", "GetFullHammer", true);
}

void GetFullHammer(string &in asItemA, string &in asItemB)
{
    GiveItem("Hammer", "stone_hammer.ent", "FullHammer", "stone_hammer.tga", 1);
    PlayGuiSound("make_hammer", 1);
    RemoveItem(asItemA);
    RemoveItem(asItemB);
}



RE: Game does not recognize inventory.hps file - Mudbill - 11-10-2019

So if you put Print("Hello"); inside OnGameStart, does it print that into the hpl.log file in your documents?


RE: Game does not recognize inventory.hps file - LagerShan - 11-10-2019

(11-10-2019, 03:48 AM)Mudbill Wrote: So if you put Print("Hello"); inside OnGameStart, does it print that into the hpl.log file in your documents?

Thanks for replying, sadly no it doesn't.

Also, one more thing.
I updated my Code inside the inventory.hps considering there will be 3 items and 4 items inside the level and the game gets to pick to randomize one of them that will turn active. 
Not sure if I've done it right.

Code:
void GetFullHammer(string &in asItemA, string &in asItemB)
{
    GiveItem("Hammer", "stone_hammer.ent", "FullHammer", "stone_hammer.tga", 1);
    PlayGuiSound("make_hammer", 1);
    RemoveItem(asItemA);
    RemoveItem(asItemB);
}

void OnGameStart()
{
    for (int x=1; x<=3; x++)
   {
       for (int y=1; y<=4; y++)
           {
               AddCombineCallback("Hammer", "HammerPiece_"+x, "HammerPiece2_"+y, "GetFullHammer", true);
           }
    }
        Print("Hello");
}

Inside the Hps File of the level it's like this for the randomizer. Not that it matters but maybe it can help solving the problem easier.

Code:
int x = RandInt(1,3);
    SetEntityActive("HammerPiece_"+x, true);
    int xx = RandInt(1,4);
    SetEntityActive("HammerPiece2_"+xx, true);

The randomizer works perfectly in the game, the problem is, the inventory combining system isn't getting recognized. i also tried combining normal items without them being randomized and still doesn't function so not sure what I'm doing wrong here.
Thanks in advance.


RE: Game does not recognize inventory.hps file - Mudbill - 11-10-2019

Probably best to fix one issue before introducing another.

If the Print doesn't work, it seems to me like the file is never loaded. Make sure you don't have a hidden .txt extension or use an incorrect file format.


RE: Game does not recognize inventory.hps file - LagerShan - 11-10-2019

(11-10-2019, 04:00 PM)Mudbill Wrote: Probably best to fix one issue before introducing another.

If the Print doesn't work, it seems to me like the file is never loaded. Make sure you don't have a hidden .txt extension or use an incorrect file format.

Checked Hidden Items and file extensions, it's "inventory.hps" and it's inside the same folder the level and script file is in.


RE: Game does not recognize inventory.hps file - Mudbill - 11-10-2019

And when you test your CS, are you using "new game" or "continue" ?

I just tested it myself and worked fine.

PHP Code:
void OnGameStart() 
{
    Print(
"Test log from inventory.hps\n");


Make sure capitals are all lower-case in the file name. File should be in the folder specified by the MapsFolder in custom_story_settings.cfg

This should print this line somewhere in the hpl.log file for the current instance (which is "Main" unless you're loading the CS through a mod).

If it still doesn't work, send the hpl.log.


RE: Game does not recognize inventory.hps file - LagerShan - 11-10-2019

(11-10-2019, 08:22 PM)Mudbill Wrote: And when you test your CS, are you using "new game" or "continue" ?

I just tested it myself and worked fine.

PHP Code:
void OnGameStart() 
{
 
   Print("Test log from inventory.hps\n");


Make sure capitals are all lower-case in the file name. File should be in the folder specified by the MapsFolder in custom_story_settings.cfg

This should print this line somewhere in the hpl.log file for the current instance (which is "Main" unless you're loading the CS through a mod).

If it still doesn't work, send the hpl.log.
You're right, I just fixed it. The problem was that in the custom_story_settings.cfg, the map destination had Ch02, isntead of ch02 since that's how it actually is named in the folder. Althought if it was named incorrectly this whole time, then how did it find the map correctly even if the ch02 was written incorrectly?
Thanks alot of taking your time to help, can't believe I missed something like that. Althought didn't notice it would have been the problem considering it actually found and loaded the map correctly even if it was mispelled.


RE: Game does not recognize inventory.hps file - Mudbill - 11-12-2019

The game is pretty good at finding files as long as it knows where to look. If you give it the approximate location for maps, I think it is still able to find files nearby, like in a folder deeper than expected. I can't say for sure how the process works, but perhaps this robust locating can obfuscate some issues that would otherwise be obvious.