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
Combining A Drill?
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#1
Combining A Drill?

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 )
09-23-2014, 10:06 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#2
RE: Combining A Drill?

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.

Derp.
09-24-2014, 07:40 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Combining A Drill?

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: (Select All)
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: (Select All)
else SetMessage("Message""NotAllItems"0); 
The category here is Message and the entry is NotAllItems. Rename them if you wish.

(This post was last modified: 09-24-2014, 08:04 AM by Mudbill.)
09-24-2014, 08:02 AM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#4
RE: Combining A Drill?

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

PHP Code: (Select All)
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
(This post was last modified: 09-24-2014, 12:57 PM by Amnesiaplayer.)
09-24-2014, 12:56 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Combining A Drill?

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: (Select All)
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.

(This post was last modified: 09-24-2014, 01:53 PM by Mudbill.)
09-24-2014, 01:51 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#6
RE: Combining A Drill?

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: (Select All)
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
09-24-2014, 04:23 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#7
RE: Combining A Drill?

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

PHP Code: (Select All)
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.

09-24-2014, 05:29 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#8
RE: Combining A Drill?

oowww i thought you said i had to delete that to... xD oopss
09-24-2014, 11:11 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#9
RE: Combining A Drill?

It doesn't work ?! i did it.. but if i add that line right under A and B
the drill will not combine together,,,
09-25-2014, 04:12 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Combining A Drill?

Post your script with the all the lines.

Trying is the first step to success.
09-25-2014, 04:38 PM
Find




Users browsing this thread: 1 Guest(s)