Frictional Games Forum (read-only)
GiveItem not working - 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: GiveItem not working (/thread-15695.html)



GiveItem not working - Damascus - 05-29-2012

This is quickly becoming infuriating. I am triggering a script that is supposed to remove one item and replace it with another, but only the GiveItem is not working at all. Here's my script.

PHP Code:
void PourPrecip(string &in precipstring &in acid_machine_bottle_empty04_2)
{
    
SetEntityActive("acid_machine_bottle_empty04_2"false);
    
SetEntityActive("acid_machine_bottle04_2"true);
    
RemoveItem("precip");
    
GiveItem("emptiness""glass_container""emptiness""glass_container.tga"1);
    
AddLocalVarInt("PrecipAdded"1);
    
PlaySoundAtEntity("""puzzle_add_chemical.snt""acid_machine_bottle04_2"1false);


Works: GiveItem("emptiness", "glass_container_mix_done", "emptiness", "glass_container_mix_done.tga", 1);
Doesn't work: GiveItem("emptiness", "glass_container", "emptiness", "glass_container.tga", 1);

What in the love of all things holy.
Everything else in this function is working perfectly, but it won't give me the Glass Jar. I've also tried using "glass_container.ent" instead of "glass_container" but that won't work either.


RE: GiveItem not working - Putmalk - 05-29-2012

Everything else in that function is working perfectly? I'm shocked, the parameters of the function are wrong (I am assuming this is called from an AddUseItemCallback and not a function that you created yourself).

Anywho, should probably change that 1 to a 0. I freaking hate GiveItem function. GiveItemFromFile is so much simplier.


RE: GiveItem not working - Damascus - 05-29-2012

I'm not sure why I chose to use that syntax, but it works as long as the internal names match up. asEntity is usually preferred since it substitutes as whatever entity triggers the function.

Anyway, I tried using a "glass_container_mix_done" and it works. Switched back to "glass_container" and it doesn't. Whatever the problem is, it's with just this one item.


RE: GiveItem not working - Your Computer - 05-29-2012

There's no such image as glass_container.tga.


RE: GiveItem not working - FlawlessHappiness - 05-29-2012

I've had that problem too! It's called glass_container_empty.tga Wink


RE: GiveItem not working - Damascus - 05-29-2012

Ahh I see! Thanks for the help!

Also I've been avoiding GiveItemFromFile because the wiki page states that it "creates the actual item and then destroys it," but now that I see that that isn't the case, I'll be using that from now on.


RE: GiveItem not working - Putmalk - 05-29-2012

(05-29-2012, 07:37 AM)Damascus Wrote: Ahh I see! Thanks for the help!

Also I've been avoiding GiveItemFromFile because the wiki page states that it "creates the actual item and then destroys it," but now that I see that that isn't the case, I'll be using that from now on.
Well it doesn't destroy it, but it doesn't rename it, either. So use it for like tinderboxes or something. XD


RE: GiveItem not working - FlawlessHappiness - 05-29-2012

You have to undstand that when you use that script you cannot add a CustomSubTypeItemName.


RE: GiveItem not working - Damascus - 05-29-2012

Yeah, I see that. Luckily I can at least use it for the empty glass jar because it doesn't need renamed.