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
Problem with combining items
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#1
Problem with combining items

Hello everyone,

I want to combine 2 items in my inventory and remove both of them in return for a new item.

I tried some code i found in the Maps/Main/inventory.HPS file, but I can't get it to work in my custom story. I can combine any two items I want, but I can only receive items that are combined in the main story (orb, hand drill, copper tube and needle).

Is there a way to receive other items like keys and oil?
09-20-2010, 01:35 AM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#2
RE: Problem with combining items

(09-20-2010, 01:35 AM)Mofo Wrote: Hello everyone,

I want to combine 2 items in my inventory and remove both of them in return for a new item.

I tried some code i found in the Maps/Main/inventory.HPS file, but I can't get it to work in my custom story. I can combine any two items I want, but I can only receive items that are combined in the main story (orb, hand drill, copper tube and needle).

Is there a way to receive other items like keys and oil?

Well, did you actually add a callback?

[Image: 16455.png]
09-20-2010, 01:43 AM
Find
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#3
RE: Problem with combining items

(09-20-2010, 01:43 AM)MulleDK19 Wrote: Well, did you actually add a callback?

I did, here's the code inside my custom story hps:


void OnStart()
{
AddCombineCallback("hammerandkey", "key_laboratory_1", "stone_hammer_1", "CombineHammerAndKey", false);
}


void CombineHammerAndKey(string &in asItemA, string &in asItemB)
{
PlayGuiSound("15_make_hammer", 1.0f);

RemoveItem(asItemA); RemoveItem(asItemB);

GiveItem("straightened_key", "Puzzle", "straightened_key", "key_laboratory.tga", 0);
}
09-20-2010, 02:00 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#4
RE: Problem with combining items

If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works.
09-20-2010, 08:01 AM
Website Find
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#5
RE: Problem with combining items

(09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works.

Worked like a charm, thank you very much Big Grin
09-20-2010, 11:57 AM
Find
house Offline
Member

Posts: 195
Threads: 11
Joined: Oct 2010
Reputation: 1
#6
RE: Problem with combining items

(09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works.

Exactly what do you name the inventory file?
02-03-2011, 12:44 AM
Find
Mofo Offline
Member

Posts: 71
Threads: 4
Joined: Sep 2010
Reputation: 2
#7
RE: Problem with combining items

(02-03-2011, 12:44 AM)house Wrote:
(09-20-2010, 08:01 AM)jens Wrote: If I'm not confused, you need to add a inventory script file to your custom story and then add this code to it. Also add a AddDebugMessage("Combined items!", false); to your CombineHammerAndKey function to easier see if it works.

Exactly what do you name the inventory file?

custom_stories/*your_story_here*/maps/inventory.hps

If all else fails, I made you a custom story with a working custom combination.


Attached Files
.rar   Combination.rar (Size: 36.46 KB / Downloads: 165)
(This post was last modified: 02-03-2011, 05:18 PM by Mofo.)
02-03-2011, 03:42 AM
Find
house Offline
Member

Posts: 195
Threads: 11
Joined: Oct 2010
Reputation: 1
#8
RE: Problem with combining items

I'll try that. Thanks!
02-03-2011, 03:59 PM
Find




Users browsing this thread: 1 Guest(s)