Frictional Games Forum (read-only)
[SCRIPT] Frustrating combination problem. - 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] Frustrating combination problem. (/thread-25426.html)



Frustrating combination problem. - Slanderous - 06-03-2014

Hey guys,

I was making a combination for my mod (connecting hollow needle + copper tube), made inventory.hps, placed it into my custom story's maps folder, and when I try to combine those items via inventory, it simply doesnt work and shows me "the combination does not work".

The item names 100% match the level editor ones, so you know, yeah.

My inventory.hps file

PHP Code:
///////////////////////////////////
////////////COMBINATIONS///////////
///////////////////////////////////

void Coppers(string &in asItemAstring &in asItemB)
{
RemoveItem(asItemA); RemoveItem(asItemB);
PlayGuiSound("15_make_hammer"1.0f);
GiveItemFromFile("copper_tube_and_needle""copper_tube_and_needle.ent");
GiveItem("copper_tube_and_needle""copper_tube_and_needle""copper_tube_and_needle""copper_tube_and_needle.tga"1);
}


////////////////////////////
// Run at the start of the game.
void OnGameStart()
{

/////COMBOS/////
AddCombineCallback("""item1""stone_chipper_1""Coppers"true);




RE: Frustrating combination problem. - Mudbill - 06-03-2014

It should be a simple thing to do. I can only guess the inventory.hps file isn't loaded. The script looks fine to me. You should try adding a DebugMessage in OnGameStart in the file, and using the development environment you can check to see if the file loads correctly. If the message doesn't appear, the problem is not internally of the file.

If you don't use the dev environment, you can use something else to check with. Just make it distinct.


RE: Frustrating combination problem. - DnALANGE - 06-04-2014

PHP Code:
GiveItem("copper_tube_and_needle""copper_tube_and_needle""copper_tube_and_needle""copper_tube_and_needle.tga"1);

---
--
-
Make the SECOND : "copper_tube_and_needle" in to -> Puzzle.
Like this :
PHP Code:
GiveItem("copper_tube_and_needle""Puzzle""copper_tube_and_needle""copper_tube_and_needle.tga"1);

---
--
-
Not sure about this :
PHP Code:
GiveItemFromFile("copper_tube_and_needle""copper_tube_and_needle.ent"); 
I have NEVER used it... Maybe you need to, but i only have the line GiveItem, there are spaces where to fill in what and where the engine should search.


RE: Frustrating combination problem. - Mudbill - 06-04-2014

Ah yes, regarding the actual script for giving the item, you should stick with the GiveItem line intead of GiveItemFromFile. The latter was meant for debugging. Also no need to use both, as that'll just give you two items. As DnALANGE said, change that string in the line to match these parameters:

PHP Code:
void GiveItem(stringasNamestringasTypestringasSubTypeNamestringasImageNamefloat afAmount); 

asName - internal name
asType - item to give
asSubTypeName - item name for .lang file
asImageName - For exemple: void GiveItem(string& asName, string& asType, “chemical_container_full”, “chemical_container_full.tga” , float afAmount); The image is from graphics\Item\chemical_container_full.tga : is the image which will appear in Inventory - img155.imageshack.us/img155/6871/20806785.jpg
afAmount - amount to give


RE: Frustrating combination problem. - Slanderous - 06-04-2014

I did what you told me here, guys, and it didn't work. I removed the GiveItemFromFileFunc, and changed the GiveItem function (the second word) to Puzzle, as Mudbill said. I also added a debug message to the inventory.hps, not sure if thats what i was meant to do, anyway my current script:

PHP Code:
///////////////////////////////////
////////////COMBINATIONS///////////
///////////////////////////////////

void Coppers(string &in asItemAstring &in asItemB)
{
RemoveItem(asItemA); RemoveItem(asItemB);
PlayGuiSound("15_make_hammer"1.0f);
GiveItem("copper_tube_and_needle""Puzzle""copper_tube_and_needle""copper_tube_and_needle.tga"1);
}


////////////////////////////
// Run at the start of the game.
void OnGameStart()
{

AddDebugMessage("This is a test debug message. Thanks to Mudbill and DnALANGE for help! Cheers!"false);
AddCombineCallback("""item1""stone_chipper_1""Coppers"true);




RE: Frustrating combination problem. - DnALANGE - 06-04-2014

I guess ive got you on Skype already right..
Ill send some stuff there and we will fix it.
redmaster12345 = skype

Here is my Inventor.hpl
PHP Code:
///////////////////////////////////
//Matches//
void Matchboxscript(string &in asItemAstring &in asItemB)
{
    
PlayGuiSound("19_attach_needle"1.0f);
    
    
AddPlayerSanity(10);
    
    
RemoveItem(asItemA); RemoveItem(asItemB);
    
    
GiveItem("FullyMatchBox""Puzzle""FullyMatchBox""FullMatchbox.tga"0);    
}
/////////////////////////////////



////////////////////////////
// Run at the start of the game.
void OnGameStart()
{

    
//---- Matches ----//
    
AddCombineCallback("Full""MatchBox_2""MatchBox_4""Matchboxscript"false);



---
Try add copper_tube_and_needle.tga", 1); // Change the 1 in 0 try that... ( look at my inventory )


RE: Frustrating combination problem. - Slanderous - 06-04-2014

(06-04-2014, 06:27 PM)DnALANGE Wrote: I guess ive got you on Skype already right..
Ill send some stuff there and we will fix it.
redmaster12345 = skype

Here is my Inventor.hpl
PHP Code:
///////////////////////////////////
//Matches//
void Matchboxscript(string &in asItemAstring &in asItemB)
{
    
PlayGuiSound("19_attach_needle"1.0f);
    
    
AddPlayerSanity(10);
    
    
RemoveItem(asItemA); RemoveItem(asItemB);
    
    
GiveItem("FullyMatchBox""Puzzle""FullyMatchBox""FullMatchbox.tga"0);    
}
/////////////////////////////////



////////////////////////////
// Run at the start of the game.
void OnGameStart()
{

    
//---- Matches ----//
    
AddCombineCallback("Full""MatchBox_2""MatchBox_4""Matchboxscript"false);



---
Try add copper_tube_and_needle.tga", 1); // Change the 1 in 0 try that... ( look at my inventory )

1) i sent you a request to add me on skype,

2) by using your script i remaked my whole inventory .hps file, now it looks like this:

PHP Code:
///////////////////////////////////
//Matches//
void Matchboxscript(string &in asItemAstring &in asItemB)
{
    
PlayGuiSound("15_make_hammer"1.0f);
    
    
AddPlayerSanity(10);
    
    
RemoveItem(asItemA); RemoveItem(asItemB);
    
    
GiveItem("copper_tube_and_needle""Puzzle""copper_tube_and_needle""copper_tube_and_needle.tga"0);    
}
/////////////////////////////////



////////////////////////////
// Run at the start of the game.
void OnGameStart()
{

    
//---- Matches ----//
    
AddCombineCallback("Full""item1""stone_chipper_1""Matchboxscript"false);



And it still does not work.


RE: Frustrating combination problem. - Romulator - 06-05-2014

PHP Code:
GiveItem("copper_tube_and_needle""Puzzle""copper_tube_and_needle""copper_tube_and_needle.tga"0); 

Why is the afAmount = 0? Are you not going to give an item for combining them?
That COULD be the problem, but is don't think it is - if it returns the "Combination doesn't work" message..


RE: Frustrating combination problem. - Mudbill - 06-05-2014

Check the log if it mentions any errors not being able to load the inventory.hps file. I still think the problem is that the file isn't loaded, because it should allow you to do the combination if the script loads the first line. Of course only if your names match, but you said they do.


RE: Frustrating combination problem. - Neelke - 06-05-2014

I had the same problem with the inventory.hps. So I did this. It basically checks if you don't have the copper tube and the hollow needle (which lefts with the code to check if you have the syringe instead or not). If you don't have a syringe either, it stops the script permanently. Until you give it a go again (with whatever puzzle youre trying to do).

Code:
if(!HasItem("copper_tube_1") && !HasItem("hollow_needle_1")){
        
        if(!HasItem("Syringe")){
            SetMessage("Ch03Lvl17", "NotEverythingNeeded", 0);
            return;
        }
        }
        RemoveItem("Syringe");
    
    //If player never combined the needle and copper tube
    RemoveItem("copper_tube_1");
    RemoveItem("hollow_needle_1");

I hope this is useful in any way.