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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GiveItem Function Help
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#1
GiveItem Function Help

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

04-29-2011, 10:55 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: GiveItem Function Help

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

04-30-2011, 02:54 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#3
RE: GiveItem Function Help

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.

(This post was last modified: 04-30-2011, 03:05 AM by Kyle.)
04-30-2011, 02:58 AM
Find
Anxt Offline
Senior Member

Posts: 588
Threads: 12
Joined: Mar 2011
Reputation: 10
#4
RE: GiveItem Function Help

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.

04-30-2011, 04:28 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#5
RE: GiveItem Function Help

(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

(This post was last modified: 04-30-2011, 04:38 AM by Kyle.)
04-30-2011, 04:38 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: GiveItem Function Help

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.

04-30-2011, 05:13 AM
Find




Users browsing this thread: 2 Guest(s)