FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
[SOLVED] More than one combination problem
Yea so i started out having one combinations where i combined Hydrogen and Chlorine into an HCl. It works fine...
Then i wanted to make a new combination, where you first combines Oxygen and Sulfur into another SO4, and then combine SO4 with Hydrogen to get H2SO4. (I know this would not be so easy in real life)
But i can't make the new combination to work: Here is my inventory.hps:
Spoiler below!
////////////////////////////
// Run at the start of the game.
void OnGameStart()
{
AddCombineCallback("", "chemical_roed", "chemical_groen", "Acid_combine", false);
AddCombineCallback("", "chemical_svovl", "chemical_oxygen", "S_O_combine", false);
AddCombineCallback("", "SO4", "chemical_hydrogen", "H2SO4_combine", false);
AddCombineCallback("", "SO4", "chemical_hydrogen", "H2SO4_combine", false);
}
//COMBINE ACID//
////////////////////
void Acid_combine(string &in asItemA, string &in asItemB)
{
PlayGuiSound("puzzle_add_chemical", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("chemical_container_epoxy", "Puzzle", "chemical_container_epoxy", "chemical_container_epoxy.tga", 0);
GiveItem("chemical_2", "chemical_container", "chemical_2", "chemical_container.tga", 1);
}
//COMBINE S_O//
////////////////////
void S_O_combine(string &in asItemA, string &in asItemB)
{
PlayGuiSound("puzzle_add_chemical", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("chemical_container_epoxy", "Puzzle", "SO4", "chemical_container_epoxy.tga", 0);
GiveItem("chemical_2", "chemical_container", "chemical_2", "chemical_container.tga", 1);
}
//COMBINE H2SO4//
////////////////////
void H2SO4_combine(string &in asItemA, string &in asItemB)
{
PlayGuiSound("puzzle_add_chemical", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("glass_container", "Puzzle", "H2SO4", "glass_container_empty.tga", 0);
GiveItem("chemical_1", "chemical_container", "chemical_1", "chemical_container.tga", 1);
}
And here is how you get the other items:
Spoiler below!
void OnStart()
{
GiveItem("chemical_1", "chemical_container", "chemical_1", "chemical_container.tga", 1);
GiveItem("chemical_2", "chemical_container", "chemical_2", "chemical_container.tga", 1);
AddUseItemCallback("", "chemical_1", "Oxygen_bottle", "Chemical_1_bottle_oxygen", false);
AddUseItemCallback("", "chemical_1", "Svovl_bottle", "Chemical_1_bottle_svovl", false);
AddUseItemCallback("", "chemical_1", "Helium_bottle", "Chemical_1_bottle_helium", false);
AddUseItemCallback("", "chemical_1", "Vand_bottle", "Chemical_1_bottle_vand", false);
AddUseItemCallback("", "chemical_2", "Oxygen_bottle", "Chemical_2_bottle_oxygen", false);
AddUseItemCallback("", "chemical_2", "Svovl_bottle", "Chemical_2_bottle_svovl", false);
AddUseItemCallback("", "chemical_2", "Helium_bottle", "Chemical_2_bottle_helium", false);
AddUseItemCallback("", "chemical_2", "Vand_bottle", "Chemical_2_bottle_vand", false);
AddUseItemCallback("", "glass_jar", "Hydrogen_bottle", "Glass_bottle_hydrogen", false);
}
void Glass_bottle_hydrogen(string &in asItem, string &in asEntity)
{
GiveItem("chemical_hydrogen", "glass_container_mix_notdone", "chemical_hydrogen", "glass_container_mix_notdone.tga", 1);
RemoveItem("glass_jar");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_1_bottle_oxygen(string &in asItem, string &in asEntity)
{
GiveItem("chemical_oxygen", "chemical_container_half", "chemical_oxygen", "chemical_container_half.tga", 1);
RemoveItem("chemical_1");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_1_bottle_svovl(string &in asItem, string &in asEntity)
{
GiveItem("chemical_svovl", "chemical_container_full", "chemical_svovl", "chemical_container_full.tga", 1);
RemoveItem("chemical_1");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_1_bottle_helium(string &in asItem, string &in asEntity)
{
GiveItem("chemical_helium", "chemical_container_full", "chemical_helium", "chemical_container_full.tga", 1);
RemoveItem("chemical_1");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_1_bottle_vand(string &in asItem, string &in asEntity)
{
GiveItem("chemical_vand", "chemical_container_full", "chemical_vand", "chemical_container_full.tga", 1);
RemoveItem("chemical_1");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_2_bottle_oxygen(string &in asItem, string &in asEntity)
{
GiveItem("chemical_oxygen", "chemical_container_half", "chemical_oxygen", "chemical_container_half.tga", 1);
RemoveItem("chemical_2");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_2_bottle_svovl(string &in asItem, string &in asEntity)
{
GiveItem("chemical_svovl", "chemical_container_full", "chemical_svovl", "chemical_container_full.tga", 1);
RemoveItem("chemical_2");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_2_bottle_helium(string &in asItem, string &in asEntity)
{
GiveItem("chemical_helium", "chemical_container_full", "chemical_helium", "chemical_container_full.tga", 1);
RemoveItem("chemical_2");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
void Chemical_2_bottle_vand(string &in asItem, string &in asEntity)
{
GiveItem("chemical_vand", "chemical_container_full", "chemical_vand", "chemical_container_full.tga", 1);
RemoveItem("chemical_2");
PlaySoundAtEntity("", "puzzle_acid_fail", "Player", 0.5f, false);
}
In my HPL.log it says:
-------- Loading complete ---------
ERROR: Item type 'chemical_container' does not exist!
ERROR: Item type 'chemical_container' does not exist!
ERROR: Item type 'glass_container' does not exist!
I don't get this. It is correct that it doesn't exist in my map. You are obtaining it from a script.
EDIT: The first combination making SO4 suddenly works. but i still can't combine it with hydrogen
EDIT2: OKAY sorry for alerting...
I found out
What i did was renaming this:
GiveItem("
chemical_container_epoxy ", "Puzzle", "SO4", "chemical_container_epoxy.tga", 0);
to this:
GiveItem("
SO4 ", "Puzzle", "SO4", "chemical_container_epoxy.tga", 0);
Trying is the first step to success.