Frictional Games Forum (read-only)
GiveItem Function 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: GiveItem Function Help (/thread-7695.html)



GiveItem Function Help - Kyle - 04-29-2011

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);
}



RE: GiveItem Function Help - palistov - 04-30-2011

asType is a classification for the item, such as "Puzzle", "LampOil", etc. Open the ModelEditor and you can view the possible types.


RE: GiveItem Function Help - Kyle - 04-30-2011

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.


RE: GiveItem Function Help - Anxt - 04-30-2011

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.


RE: GiveItem Function Help - Kyle - 04-30-2011

(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


RE: GiveItem Function Help - palistov - 04-30-2011

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.