Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GiveItem not working
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#1
GiveItem not working

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: (Select All)
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.

(This post was last modified: 05-29-2012, 07:38 AM by Damascus.)
05-29-2012, 06:20 AM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#2
RE: GiveItem not working

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.

05-29-2012, 06:26 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#3
RE: GiveItem not working

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.

05-29-2012, 06:30 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: GiveItem not working

There's no such image as glass_container.tga.

Tutorials: From Noob to Pro
05-29-2012, 06:49 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: GiveItem not working

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

Trying is the first step to success.
(This post was last modified: 05-29-2012, 07:31 AM by FlawlessHappiness.)
05-29-2012, 07:31 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: GiveItem not working

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
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#7
RE: GiveItem not working

(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

05-29-2012, 01:31 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: GiveItem not working

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

Trying is the first step to success.
05-29-2012, 02:27 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#9
RE: GiveItem not working

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

05-29-2012, 07:21 PM
Find




Users browsing this thread: 3 Guest(s)