Frictional Games Forum (read-only)

Full Version: How combine two Items?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi I want tp know how to combine two items? What I've to script to do it or is a Checkbox for this in the level
Editor? Huh
AddCombineCallback("FuncInternalName", "ITEMA", "ITEMB", "Combine", false);
}


void Combine(string &in asItemA, string &in asItemB)
{
GiveSanityBoost();
RemoveItem(asItemA);
RemoveItem(asItemB);
GiveItem(internal name, item to give , itemname for .lang file, PICTURE.tga, 1);
}
There is tutorial in the wiki that i suggested.
I think you need a inventory script file. Smile
It doesn't work
It doesn't says that you can't combine the items but nothing happens Huh

What I've done wrong there?

////////////////////////////
// Run first time starting map
void OnStart()
{
SetLightVisible("PointLight_8", false);
SetEntityPlayerInteractCallback("Expoxy", "Interact", true);
AddUseItemCallback("", "Spreng", "compound_1", "Bunsenbrenner", true);
AddCombineCallback("", "Flasche", "Chemie", "Sprenger", false);
AddUseItemCallback("", "chemical_container_expoxy_1", "cave_in_1", "Sprengsatz", true);
AddEntityCollideCallback("Player", "ScriptArea_22", "Damage", true, 1);
}
void Sprenger(string &in asItemA, string &in asItemB)
{
RemoveItem("Chemie");
RemoveItem("Flasche");
GiveItem("Spreng", "chemical_container_half.ent", "", "chemical_container_half.tga", 1);
}
void Bunsenbrenner(string &in asItem, string &in asEntity)
{
FadeInSound("Bun", 0.5f, true);
SetEntityActive("Bunsa", true);
PlaySoundAtEntity("Bun", "puzzle_gas.snt", "Bunsa", 0, false);
AddTimer("", 1.6, "Finished");
}
void Finished(string &in asTimer)
{
RemoveItem("Spreng");
GiveItem("", "chemical_container_expoxy_1", "", "chemical_container_epoxy.tga", 1);
SetEntityActive("Bunsa", false);
StopSound("Bun", 2.0f);
}
void Sprengsatz(string &in asItem, string &in asEntity)
{
SetEntityActive("Expoxy", true);
PlaySoundAtEntity("", "step_run_dirt.snt", "ScriptArea_20", 0, false);
StartPlayerLookAt("ScriptArea_20", 2, 4, "StopPlayerLookAt");
}
void Interact(string &in asEntity)
{
AddTimer("", 3, "Explosion");
PlaySoundAtEntity("", "12_epoxy_blow.snt", "ScriptArea_20", 0, false);
}
void Explosion(string &in asTimer)
{
SetEntityActive("ScriptArea_22", true);
SetEntityActive("web_1", false);
SetEntityActive("Destroyer", true);
SetEntityActive("cave_in_1", false);
CreateParticleSystemAtEntity("", "Explosion.ps", "ScriptArea_21", false);
CreateParticleSystemAtEntity("", "ps_dust_elevator_crash.ps", "ScriptArea_21", false);
SetEntityActive("Box", false);
PlaySoundAtEntity("", "explosion_rock_large.snt", "ScriptArea_20", 0, false);
SetLightVisible("PointLight_8", true);
AddTimer("", 1, "LightOut");
}
void LightOut(string &in asTimer)
{
SetEntityActive("ScriptArea_22", false);
SetLightVisible("PointLight_8", false);
}
void Damage(string &in asItem, string &in asEntity)
{
GivePlayerDamage(120.9f, "damage_bloodsplat0.tga", true, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
(04-06-2012, 10:37 AM)Shives Wrote: [ -> ]It doesn't work
It doesn't says that you can't combine the items but nothing happens Huh

What I've done wrong there?

////////////////////////////
// Run first time starting map
void OnStart()
{
SetLightVisible("PointLight_8", false);
SetEntityPlayerInteractCallback("Expoxy", "Interact", true);
AddUseItemCallback("", "Spreng", "compound_1", "Bunsenbrenner", true);
AddCombineCallback("", "Flasche", "Chemie", "Sprenger", false);
AddUseItemCallback("", "chemical_container_expoxy_1", "cave_in_1", "Sprengsatz", true);
AddEntityCollideCallback("Player", "ScriptArea_22", "Damage", true, 1);
}
void Sprenger(string &in asItemA, string &in asItemB)
{
RemoveItem("Chemie");
RemoveItem("Flasche");
GiveItem("Spreng", "chemical_container_half.ent", "", "chemical_container_half.tga", 1);
}
void Bunsenbrenner(string &in asItem, string &in asEntity)
{
FadeInSound("Bun", 0.5f, true);
SetEntityActive("Bunsa", true);
PlaySoundAtEntity("Bun", "puzzle_gas.snt", "Bunsa", 0, false);
AddTimer("", 1.6, "Finished");
}
void Finished(string &in asTimer)
{
RemoveItem("Spreng");
GiveItem("", "chemical_container_expoxy_1", "", "chemical_container_epoxy.tga", 1);
SetEntityActive("Bunsa", false);
StopSound("Bun", 2.0f);
}
void Sprengsatz(string &in asItem, string &in asEntity)
{
SetEntityActive("Expoxy", true);
PlaySoundAtEntity("", "step_run_dirt.snt", "ScriptArea_20", 0, false);
StartPlayerLookAt("ScriptArea_20", 2, 4, "StopPlayerLookAt");
}
void Interact(string &in asEntity)
{
AddTimer("", 3, "Explosion");
PlaySoundAtEntity("", "12_epoxy_blow.snt", "ScriptArea_20", 0, false);
}
void Explosion(string &in asTimer)
{
SetEntityActive("ScriptArea_22", true);
SetEntityActive("web_1", false);
SetEntityActive("Destroyer", true);
SetEntityActive("cave_in_1", false);
CreateParticleSystemAtEntity("", "Explosion.ps", "ScriptArea_21", false);
CreateParticleSystemAtEntity("", "ps_dust_elevator_crash.ps", "ScriptArea_21", false);
SetEntityActive("Box", false);
PlaySoundAtEntity("", "explosion_rock_large.snt", "ScriptArea_20", 0, false);
SetLightVisible("PointLight_8", true);
AddTimer("", 1, "LightOut");
}
void LightOut(string &in asTimer)
{
SetEntityActive("ScriptArea_22", false);
SetLightVisible("PointLight_8", false);
}
void Damage(string &in asItem, string &in asEntity)
{
GivePlayerDamage(120.9f, "damage_bloodsplat0.tga", true, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


if you want to combine two items create an inventory.hps file in your maps folder and use this

void hammer_chipper(string &in asItemA, string &in asItemB)
{
PlayGuiSound("15_make_hammer", 1.0f);
RemoveItem(asItemA); RemoveItem(asItemB);
GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);
}

void OnGameStart()
{

AddCombineCallback("hammer_chipper", "hammer_1", "chipper_1", "hammer_chipper", false);

}

and where it says hammer, chipper just change it to what you want to combine


Inventory hps file?
What's this?
(04-06-2012, 11:17 AM)Shives Wrote: [ -> ]Inventory hps file?
What's this?


you know how you have map.hps, well you create a new .hps file in your maps folder and call it Inventory.hps and then you bassically add what i added above but change it to your items name and that is a much easier way of combining items from all over different maps
(04-06-2012, 11:17 AM)Shives Wrote: [ -> ]Inventory hps file?
What's this?
I quote MrBigzy:
"You make your own inventory.hps and put it into you main directory for
your custom story. The name of the script is read by the engine and is
used specifically for inventory stuff."

I guess you'll need a separate "inventory" script file because you'll want to be able to combine these items within *any* level of the game.

Now i created an Inventory.hps file and I deleted this line from the map.hps
Now if I try to combine it it says that it can't be combined Undecided
Pages: 1 2