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
Script Help Using the GiveItem function?
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#1
Using the GiveItem function?

Been searching a bit and I can't find out how to get it to work.

void GiveItem(string& asName, string& asType, string& asSubTypeName, string& asImageName, float afAmount);
Adds an item to the inventory of the player. Note that the item does not have to exist as entity in the world to be able to do this.
asName - internal name
asType - item to give
asSubTypeName - item name for .lang file
asImageName -
afAmount - amount to give
(from the FG wiki)
PHP Code: (Select All)
void FillContFunc (string &in asItemstring &in asEntity)
{
    
RemoveItem(asItem);
    
GiveItem("FullCont""glass_container_mix_done""glasscontainer_full"""1);

What's wrong with this? It removes the empty glass container but it doesn't give me the filled one.

I know how to use GiveItemFromFile but then I don't get my custom set name and description, besides it says on the FG wiki that script is mostly for debug purposes. (I do use the GiveItemFromFile function to get the items otherwise when In debug mode)



Current - Castle Darkuan
Other - F*cked Map
01-26-2012, 02:34 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Using the GiveItem function?

Needs to have an image file. Browse the Amnesia files (redist/graphics/items if I'm not mistaken) and pick one out.

01-26-2012, 03:10 PM
Find
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#3
RE: Using the GiveItem function?

(01-26-2012, 03:10 PM)palistov Wrote: Needs to have an image file. Browse the Amnesia files (redist/graphics/items if I'm not mistaken) and pick one out.
It must have an image even though it's one of the default items?


Current - Castle Darkuan
Other - F*cked Map
01-26-2012, 03:12 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#4
RE: Using the GiveItem function?

Yep, as far as I know.

01-26-2012, 03:15 PM
Find
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#5
RE: Using the GiveItem function?

Changed it to:

PHP Code: (Select All)
void FillContFunc (string &in asItemstring &in asEntity)
{
    
RemoveItem(asItem);
    
GiveItem("FullCont""glass_container_mix_done""glasscontainer_full""glass_container_mix_full.tga"1);


Still doesn't work. It doesn't give me an error or anything, it works to use the empty container but it doesn't return anything..

Nevermind! I'm stupid. I wrote "glass_container_mix_full.tga" but it was "glass_container_mix_done.tga". My bad. Works now.

Thank you very much.

Current - Castle Darkuan
Other - F*cked Map
(This post was last modified: 01-26-2012, 03:16 PM by Shadowfied.)
01-26-2012, 03:15 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: Using the GiveItem function?

Anytime Wink

01-26-2012, 03:22 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#7
RE: Using the GiveItem function?

(Arise, Great Old One!)
What does the asType parameter do?
You see, while I know what the other parameters do, I can set asType to whatever, and my key will still work fine.

Noob scripting tutorial: From Noob to Pro

04-20-2012, 09:13 PM
Find
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#8
RE: Using the GiveItem function?

It says that it is the name of the item and the subType is the item name in the .lang file.

Current - Castle Darkuan
Other - F*cked Map
04-20-2012, 09:36 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#9
RE: Using the GiveItem function?

(04-20-2012, 09:36 PM)Shadowfied Wrote: It says that it is the name of the item and the subType is the item name in the .lang file.
Yes, I read the wiki too, but "name of the item" in what context? What does it do?


Noob scripting tutorial: From Noob to Pro

04-20-2012, 10:45 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#10
RE: Using the GiveItem function?

The entity type "Item" has subtypes: Puzzle, PotionHealth, PotionOil, Key and a few others I can't think of off the top of my head. Basically designates what the item does. Not sure why this is required, but it can't hurt to put the appropriate subtype.

04-20-2012, 10:58 PM
Find




Users browsing this thread: 2 Guest(s)