Frictional Games Forum (read-only)

Full Version: Combining Items Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
(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.
void OnStart() should work.

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

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

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

You forgot the "&in" for asItemB
(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.
(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!

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);
}
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.
(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...
Pages: 1 2