Frictional Games Forum (read-only)
Inventory Script File (How to combine two 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: Inventory Script File (How to combine two items) (/thread-5127.html)

Pages: 1 2


Inventory Script File (How to combine two items) - anzki - 10-20-2010

I have tried to make two items to combine and found a thread where Jens told someone to put the script to inventory file. Well I made such file and tried to make items to combine, and I got the combine part working; it does not complain that "this combination does not work". However the function does not happen, so they combine(I think) but nothing happens.

Here is inventory file:
Spoiler below!

Code:
void OnGameStart()
{
AddCombineCallback("", "glass_container_blood_1", "wooden_bucket_filled_1", "MakeExplosion", false);
}
void MakeExplosion(string& asName, string& asItemA, string& asItemB, string& asFunction, bool abAutoDestroy)
{
   GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone", 1.0f);
   RemoveItem(asItemA); RemoveItem(asItemB);
}


But do I need to add something to level script file also... Or what is wrong with that code?

EDIT: And should I place the "inventory.hps" to some specific folder?

EDIT2:I had forgotten "()" behind "OnGameStart", added them and tested; no effect...


RE: Inventory Script File - house - 10-20-2010

void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.


RE: Inventory Script File - anzki - 10-20-2010

(10-20-2010, 08:08 PM)house Wrote: void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.

Yeah but it is in "inventory.hps" file that is used for every map, and in original games inventory file there was void OnGameStart() Big Grin

EDIT: Anyway tried that also; didn't work...


RE: Inventory Script File - Pandemoneus - 10-20-2010

Try
Code:
void MakeExplosion(string& asName, string& asItemA, string& asItemB)

instead of what you got there.


RE: Inventory Script File - anzki - 10-21-2010

Nope still not working.
Here is an example of original game "inventory.hps" file:
Code:
void CombineHammer(string &in asItemA, string &in asItemB)
{
    PlayGuiSound("15_make_hammer", 1.0f);
    
    AddPlayerSanity(10);
    
    RemoveItem(asItemA); RemoveItem(asItemB);
    
    GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);    
}

void OnGameStart()
{
AddCombineCallback("stonechipperhammer", "stone_chipper_1", "stone_hammer_1", "CombineHammer", false);
}

Also tried; "void MakeExplosion(string &in asItemA, string &in asItemB)" and it did not work either.


RE: Inventory Script File (How to combine two items) - anzki - 10-22-2010

I would be grateful if someone on Frictional Games could explain this.


RE: Inventory Script File - house - 10-23-2010

(10-20-2010, 08:21 PM)anzki Wrote:
(10-20-2010, 08:08 PM)house Wrote: void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.

Yeah but it is in "inventory.hps" file that is used for every map, and in original games inventory file there was void OnGameStart() Big Grin

EDIT: Anyway tried that also; didn't work...

Oh, I just found out about Inventory.hps. Sorry! Blush

Anyways, Maybe this will help. I see that you made this ya in the inventory.hps?
GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone", 1.0f);

I think glass_container_mix_notdone needs a .tga at the end of it like:
GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone.tga", 1.0f);

This may not work. But aleast we can give it a try.


RE: Inventory Script File (How to combine two items) - anzki - 10-23-2010

Above didn't work... Also the .tga is optional; got another function working without it. (UseItemCallback, where player is given item.)


RE: Inventory Script File (How to combine two items) - anzki - 10-27-2010

Gawd... No one knows this??!


RE: Inventory Script File (How to combine two items) - Arvaga - 10-27-2010

I made it work but only using the main's folder inventory file (you know, the one with all the game's combinations).
I tried it with a script in a map but it would do what you described (no complaints about combination not working, but the function wouldn't execute).
And I tried to make an inventory.hps in my custom story's folder (along with custom_story_settings.cfg) but it wouldn't work that way =/ (usual combination not working message would show).

Does your inventory.hps file works? (and with "works" I mean does your custom story runs it?)