Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inventory Script File (How to combine two items)
Author Message
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #1
Inventory Script File (How to combine two items)

I have tried to make two items to combine and found a thread where Jens told someone to put the script to inventory file. Well I made such file and tried to make items to combine, and I got the combine part working; it does not complain that "this combination does not work". However the function does not happen, so they combine(I think) but nothing happens.

Here is inventory file:
Spoiler below!

void OnGameStart()
{
AddCombineCallback("", "glass_container_blood_1", "wooden_bucket_filled_1", "MakeExplosion", false);
}
void MakeExplosion(string& asName, string& asItemA, string& asItemB, string& asFunction, bool abAutoDestroy)
{
   GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone", 1.0f);
   RemoveItem(asItemA); RemoveItem(asItemB);
}


But do I need to add something to level script file also... Or what is wrong with that code?

EDIT: And should I place the "inventory.hps" to some specific folder?

EDIT2:I had forgotten "()" behind "OnGameStart", added them and tested; no effect...

[Image: 2qnr5av.png]
10-20-2010 07:08 PM
Find all posts by this user Quote this message in a reply
house Offline
Member

Posts: 195
Joined: Oct 2010
Reputation: 1
Post: #2
RE: Inventory Script File

void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.
10-20-2010 08:08 PM
Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #3
RE: Inventory Script File

(10-20-2010 08:08 PM)house Wrote:  void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.

Yeah but it is in "inventory.hps" file that is used for every map, and in original games inventory file there was void OnGameStart() Big Grin

EDIT: Anyway tried that also; didn't work...

[Image: 2qnr5av.png]
10-20-2010 08:21 PM
Find all posts by this user Quote this message in a reply
Pandemoneus Offline
Senior Member

Posts: 328
Joined: Sep 2010
Reputation: 0
Post: #4
RE: Inventory Script File

Try
void MakeExplosion(string& asName, string& asItemA, string& asItemB)

instead of what you got there.

10-20-2010 08:46 PM
Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #5
RE: Inventory Script File

Nope still not working.
Here is an example of original game "inventory.hps" file:
void CombineHammer(string &in asItemA, string &in asItemB)
{
    PlayGuiSound("15_make_hammer", 1.0f);
    
    AddPlayerSanity(10);
    
    RemoveItem(asItemA); RemoveItem(asItemB);
    
    GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);    
}

void OnGameStart()
{
AddCombineCallback("stonechipperhammer", "stone_chipper_1", "stone_hammer_1", "CombineHammer", false);
}

Also tried; "void MakeExplosion(string &in asItemA, string &in asItemB)" and it did not work either.

[Image: 2qnr5av.png]
10-21-2010 08:27 AM
Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #6
RE: Inventory Script File (How to combine two items)

I would be grateful if someone on Frictional Games could explain this.

[Image: 2qnr5av.png]
10-22-2010 10:58 AM
Find all posts by this user Quote this message in a reply
house Offline
Member

Posts: 195
Joined: Oct 2010
Reputation: 1
Post: #7
RE: Inventory Script File

(10-20-2010 08:21 PM)anzki Wrote:  
(10-20-2010 08:08 PM)house Wrote:  void OnGameStart()? It isn't like that. Its supposed to be: void OnStart()
This may be your problem.

Yeah but it is in "inventory.hps" file that is used for every map, and in original games inventory file there was void OnGameStart() Big Grin

EDIT: Anyway tried that also; didn't work...

Oh, I just found out about Inventory.hps. Sorry! Blush

Anyways, Maybe this will help. I see that you made this ya in the inventory.hps?
GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone", 1.0f);

I think glass_container_mix_notdone needs a .tga at the end of it like:
GiveItem("Explosion1", "Explosion", "", "glass_container_mix_notdone.tga", 1.0f);

This may not work. But aleast we can give it a try.
10-23-2010 07:06 AM
Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #8
RE: Inventory Script File (How to combine two items)

Above didn't work... Also the .tga is optional; got another function working without it. (UseItemCallback, where player is given item.)

[Image: 2qnr5av.png]
10-23-2010 10:52 AM
Find all posts by this user Quote this message in a reply
anzki Offline
Member

Posts: 88
Joined: Apr 2010
Reputation: 1
Post: #9
RE: Inventory Script File (How to combine two items)

Gawd... No one knows this??!

[Image: 2qnr5av.png]
10-27-2010 02:37 PM
Find all posts by this user Quote this message in a reply
Arvaga Offline
Junior Member

Posts: 8
Joined: Oct 2010
Reputation: 1
Post: #10
RE: Inventory Script File (How to combine two items)

I made it work but only using the main's folder inventory file (you know, the one with all the game's combinations).
I tried it with a script in a map but it would do what you described (no complaints about combination not working, but the function wouldn't execute).
And I tried to make an inventory.hps in my custom story's folder (along with custom_story_settings.cfg) but it wouldn't work that way =/ (usual combination not working message would show).

Does your inventory.hps file works? (and with "works" I mean does your custom story runs it?)

Visit the scripts recollection thread to find scripts for your custom stories.
10-27-2010 09:35 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)