Frictional Games Forum
Combining A Drill? - Printable Version

+- Frictional Games Forum (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: Combining A Drill? (/thread-26298.html)

Pages: 1 2 3 4


Combining A Drill? - Amnesiaplayer - 09-23-2014

Hello.
I want to combine A drill with 3 Drill parts.
i'm sorry but i can't show my Script/inventory file... computer isn't avaible.
But i wanted to make that. The name f drills are like this
DrillA
DrillB
DrillC
i was watching some tutorial videos (Not whole)
Do i need to place the drill and other ONLY in the INVENTORY FILE? (i did it on lang file to)
And someone showed a tutorial about 2 things..
so A,B
and i copied the script and Added C
so it was i think
BucketA
BucketB
or something like that
(Blabla ("BucketA", "BucketB"*****
and i added The third but nor bucket but Drill so like this
(blablablaa ("DrillA", "DrillB, "DrillC"*****
And the drillparts name is only 1 time writen... I
didn't write anything in (tab) ENTITY...
Do i had to do this??
( it doesn't combine in-game )


RE: Combining A Drill? - Neelke - 09-24-2014

You have any script made for this? If so, please post it. We can't really do much for you without a script to look at.


RE: Combining A Drill? - Mudbill - 09-24-2014

In your inventory.hps file, add a combine callback to all three items. One for item A and B, one for B and C and one for C and A (so that you can use any part of each other). They all call the same callback.

In that callback, do an if-statement to make sure all three items are present in the player's inventory. Do something like
PHP Code:
if(HasItem("ItemA") && HasItem("ItemB") && HasItem("ItemC")) {
    
//Remove and give items.


Inside there, you do what you want to happen when they use them. Most likely you want to remove the drill parts and give the player the complete drill item. If you wish you can add an else block that displays a message if they do not have all parts. Right below the if-statement:
PHP Code:
else SetMessage("Message""NotAllItems"0); 
The category here is Message and the entry is NotAllItems. Rename them if you wish.


RE: Combining A Drill? - Amnesiaplayer - 09-24-2014

Wait... for Secure... I will post my Inventory File... Maybe i did something little wrong..

PHP Code:
void OnGameStart()
{
        
AddCombineCallback("Drill""DrillA""DrillB""DrillC" "CombineDrill"true);
}
 
void CombineDrill(string &in asItemAstring &in asItemBstring &in asItemC)
{
        
RemoveItem(asItemA);
        
RemoveItem(asItemB);
        
RemoveItem(asItemC);
 
        
GiveSanityBoost();
 
        
PlayGuiSound("12_make_drill"1);
 
        
GiveItem("Drill""Puzzle""Drill""hand_drill.tga"1);


What do i have to do.. now?

Quick Edit : This codes i have from your video Big Grin


RE: Combining A Drill? - Mudbill - 09-24-2014

AddCombineCallback only works with 2 items. You can't just add another string in the parameters because it was never made for three items, therefore it doesn't know what to do with the extra string. That's probably why it crashes. That's why I said you should add three combine callbacks, for item A and B, B and C, C and A. Like so:

PHP Code:
AddCombineCallback("DrillAB""DrillA""DrillB""CombineDrill"true);
AddCombineCallback("DrillBC""DrillB""DrillC""CombineDrill"true);
AddCombineCallback("DrillCA""DrillC""DrillA""CombineDrill"true); 

You must also remove the "string &in asItemC" from your callback syntax parameters, as it does not belong there. Also remove the "RemoveItem(asItemC);" or you'll crash there too.

Try doing what I explained up there from here.


RE: Combining A Drill? - Amnesiaplayer - 09-24-2014

Thanks Big Grin it worked. But the only trouble is... one part is still there xD ©
and yo usaid i had to delete this...

PHP Code:
void OnGameStart()
{
AddCombineCallback("DrillAB""DrillA""DrillB""CombineDrill"true);
AddCombineCallback("DrillBC""DrillB""DrillC""CombineDrill"true);
AddCombineCallback("DrillCA""DrillC""DrillA""CombineDrill"true); 
}
 
void CombineDrill(string &in asItemAstring &in asItemB)
{
        
RemoveItem(asItemA);
        
RemoveItem(asItemB);
      
        
GiveSanityBoost();
 
        
PlayGuiSound("12_make_drill"1);
 
        
GiveItem("Drill""Puzzle""Drill""hand_drill.tga"1);


Tongue


RE: Combining A Drill? - Mudbill - 09-24-2014

Yes, instead of using asItemA and B, use all three actual item names.

PHP Code:
RemoveItem("DrillA");
RemoveItem("DrillB");
RemoveItem("DrillC"); 

Because you don't know which two of the three items are used together, so you can't really use the parameters for this.


RE: Combining A Drill? - Amnesiaplayer - 09-24-2014

oowww i thought you said i had to delete that to... xD oopss


RE: Combining A Drill? - Amnesiaplayer - 09-25-2014

It doesn't work ?! i did it.. but if i add that line right under A and B
the drill will not combine together,,,


RE: Combining A Drill? - FlawlessHappiness - 09-25-2014

Post your script with the all the lines.