Frictional Games Forum (read-only)

Full Version: GiveItem Function Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I created a inventory.hps file and made it to where it gives you two different items after you combine the other items. So ceremony_knife_2 and ContainerChem01 combine, and what is left should be ceremony_knife and chemical_container that are both motified with my .lang file with "KnifeGoo" and "EmptyContainer" being used.

GiveItem(string& asName, string& asType, string& asSubTypeName, string& asImageName, float afAmount);

I don't understand what it means by "string& asType".

inventory.hps file:
Code:
void OnGameStart()
{
AddCombineCallback("", "ceremony_knife_2", "ContainerChem01", "KnifeContainerCombine", false);
}
void KnifeContainerCombine(string &in asItemA, string &in asItemB)
{
GiveItem("", "ceremony_knife", "KnifeGoo", "", 1);
GiveItem("", "chemical_container", "EmptyContainer", "", 1);
RemoveItem(asItemA);
RemoveItem(asItemB);
}
asType is a classification for the item, such as "Puzzle", "LampOil", etc. Open the ModelEditor and you can view the possible types.
Thanks! I'll look it up! Smile
Eh, it didn't work, the items I want the player to have are not there. I guess I'll just make a script that allows the player to place both items on a table and then take it from there.
That's the work around I had to use. I wanted to allow a combination of a hammer and chipper, and it worked pre-Justine, but since then the function has changed and wasn't working. I still haven't found a way to make it work.
(04-30-2011, 04:28 AM)Anxt Wrote: [ -> ]That's the work around I had to use. I wanted to allow a combination of a hammer and chipper, and it worked pre-Justine, but since then the function has changed and wasn't working. I still haven't found a way to make it work.

Ah... Just completed most of the scripting. It's funny how "GiveItem" takes only a few minutes to set up, and yet the workaround I've done took a few hours.

While I'm at it, I might as well describe it. So I added a local variable that checks to see if the player interacted with the items and the local variable also was set up to put a message on the screen if the player collides with the area that is near the table if they interacted with those objects. Then I set up the table to allow the player to place the items and then the knife doing a little prop rotation in the container.

Ugh... I'm so tired... But still, scripting is fun enough to stay up the whole night for it! Big Grin
Actually I think I gave you misinformation. I think asSubTypeName is the classification. asType must be something else. Use the function GiveItemFromFile() instead. That lets choose an item file, which is what I think you're trying to do.