Frictional Games Forum (read-only)
[SCRIPT] trouble with combining items - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] trouble with combining items (/thread-20745.html)



trouble with combining items - PixelHurricane - 03-14-2013

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 
]


RE: trouble with combining items - NaxEla - 03-14-2013

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


RE: trouble with combining items - PixelHurricane - 03-14-2013

I tried it first in the inventory.hps first actually.
the addcombinecallback and the makecrowbar parts are exactly the same


RE: trouble with combining items - FlawlessHappiness - 03-15-2013

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.


RE: trouble with combining items - PixelHurricane - 03-15-2013

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