Frictional Games Forum (read-only)

Full Version: GiveItem not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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.
There's no such image as glass_container.tga.
I've had that problem too! It's called glass_container_empty.tga Wink
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.
(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
You have to undstand that when you use that script you cannot add a CustomSubTypeItemName.
Yeah, I see that. Luckily I can at least use it for the empty glass jar because it doesn't need renamed.