Frictional Games Forum (read-only)
Combining Items Help - 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: Combining Items Help (/thread-9587.html)

Pages: 1 2


Combining Items Help - Selyp - 08-04-2011

Hey everyone. I know this has been asked before, but I cannot find a thread that will answer my questions. I am having trouble with a script for combining items. I have looked on the wiki at scripts, but my script is still not working, so I'm not sure whats wrong. Here is my inventory.hps file.

void OnStart()
{
AddCombineCallback("", "Vinegar", "PhosphoricAcid", "CombineFunc", true);
}
void CombineFunc (string &in asItemA, string& asItemB)
{
GiveSanityBoost();
RemoveItem("Vinegar");
RemoveItem("PhosphoricAcid");
GiveItem("bucket_of_tar", "Puzzle", "bucket_of_tar", "bucket_of_tar.tga", 0);
}

i have made sure that all of my items are the correct name, and the game doesn't crash when I enter, so I am assuming the script file itself is okay, I'm just not sure why the items won't combine. Any help would be greatly appreciated.

-Selyp


RE: Combining Items Help - MrPotatoHead - 08-04-2011

(08-04-2011, 05:43 AM)Selyp Wrote: void OnGameStart()

I think that should fix it.

Also make sure you put the inventory.HPS file in the custom_story/maps folder.


RE: Combining Items Help - MrCookieh - 08-04-2011

void OnStart() should work.

MrPotatoHead Wrote:Also make sure you put the inventory.HPS file in the custom_story/maps folder.

check this.


RE: Combining Items Help - Selyp - 08-04-2011

The inventory.hps file is in my maps folder inside the custom story folder. I'm stumped!




RE: Combining Items Help - Juby - 08-04-2011

(08-04-2011, 05:43 AM)Selyp Wrote:
Code:
void CombineFunc (string &in asItemA, string &in asItemB)

You forgot the "&in" for asItemB



RE: Combining Items Help - MrPotatoHead - 08-04-2011

(08-04-2011, 10:44 PM)Selyp Wrote: The inventory.hps file is in my maps folder inside the custom story folder. I'm stumped!

Did you change OnStart to OnGameStart? I just tried it out and my combination didn't work when I used OnStart.


RE: Combining Items Help - Selyp - 08-05-2011

(08-04-2011, 10:51 PM)Juby Wrote:
(08-04-2011, 05:43 AM)Selyp Wrote:
Code:
void CombineFunc (string &in asItemA, string &in asItemB)

You forgot the "&in" for asItemB

Ah that must be it. I'll try it out when I get home from work! Thank you!

(08-04-2011, 10:56 PM)MrPotatoHead Wrote:
(08-04-2011, 10:44 PM)Selyp Wrote: The inventory.hps file is in my maps folder inside the custom story folder. I'm stumped!

Did you change OnStart to OnGameStart? I just tried it out and my combination didn't work when I used OnStart.

I'll try this also when I get home. I'll let you know if it works!




RE: Combining Items Help - Selyp - 08-05-2011

Made both changes. Still no luck Sad

Also tried doing it in the .hps for the map instead of using inventory.hps and that didn't work either...

Anyone have any ideas?

Script now looks like this

void OnGameStart()
{
AddCombineCallback("", "Vinegar", "PhosphoricAcid", "CombineFunc", true);
}
void CombineFunc (string &in asItemA, string &in asItemB)
{
GiveSanityBoost();
RemoveItem("Vinegar");
RemoveItem("PhosphoricAcid");
GiveItem("bucket_of_tar", "Puzzle", "bucket_of_tar", "bucket_of_tar.tga", 0);
}


RE: Combining Items Help - MrPotatoHead - 08-05-2011

Your script seems fine, I just tried it with my own item and had no problems with it.

Check the item names in the level editor. When you place an item, the editor automatically adds _1 to it (Vinegar_1). Make sure the names match.


RE: Combining Items Help - Selyp - 08-06-2011

(08-05-2011, 10:08 AM)MrPotatoHead Wrote: Your script seems fine, I just tried it with my own item and had no problems with it.

Check the item names in the level editor. When you place an item, the editor automatically adds _1 to it (Vinegar_1). Make sure the names match.

The names are the same, I just checked them again. That's why I'm so confused!

Would there be any problem from the fact that you pick up the Vinegar, and the Phosphoric acid in different maps? I have the script in the inventory.hps file so I assume it should work no matter which map area you're in, but the items are found in different areas. Not sure if that should affect anything though...