Frictional Games Forum (read-only)

Full Version: trouble with combining items
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what I want to happen is have the hammer (found in the level) be use on the bed to chip of a piece of metal (stone chipper) an then be able to combine those to produce a crowbar and hammer (kind of bend the metal and what not) getting the chipper works fine. it's the AddCombineCallback that seems to be not working at all

PHP Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("""stone_hammer_1""bed_simple_1""getiron"true);
}
void getiron(string &in asItemstring &in asEntity)
{
GiveItem("stone_chipper""stone_chipper""stone_chipper""stone_chipper.tga"1);
RemoveUseItemCallback("stone_hammer_1");
AddCombineCallback("makecrowbar""stone_hammer_1""stone_chipper""makecrowbar"false);
SetMessage("Messages""Jail1"2);
CreateParticleSystemAtEntity("""ps_hit_metal.ps""bed_simple_1"false);
}
void makecrowbar(string &in asItemAstring &in asItemB)
{
GiveItem("crowbar""crowbar""crowbar""crowbar.tga"1);
RemoveItem("stone_chipper");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
 
}[/
php 
]
You need to make an inventory.hps and put the combine callbacks in there. Also, you'll need to put OnGameStart() instead of OnStart(). Here's a video tutorial made by Your Computer: http://www.youtube.com/watch?v=VtgSk36Sa8E
I tried it first in the inventory.hps first actually.
the addcombinecallback and the makecrowbar parts are exactly the same
Well, it shouldn't work in the map.hps.
Inventory.hps is the only place it should be. You probably made a mistake in there.
ok, i removed the function for combining from jail.hps and put in into the inventory.hps it now looks like this.
PHP Code:
void OnGameStart()
{
AddCombineCallback("""stone_hammer_1""stone_chipper""makecrowbar"false);
}
void makecrowbar(string &in asItemAstring &in asItemB)
{
GiveItem("crowbar""crowbar""crowbar""crowbar.tga"1);
RemoveItem("stone_chipper");

it still doesn't work though