Frictional Games Forum (read-only)
How combine two Items? - Printable Version

+- Frictional Games Forum (read-only) (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: How combine two Items? (/thread-14484.html)

Pages: 1 2


How combine two Items? - Shives - 04-04-2012

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



RE: How combine two Items? - Xanthos - 04-04-2012

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);
}


RE: How combine two Items? - Datguy5 - 04-04-2012

There is tutorial in the wiki that i suggested.


RE: How combine two Items? - SilentStriker - 04-04-2012

I think you need a inventory script file. Smile



RE: How combine two Items? - Shives - 04-06-2012

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()
{

}



RE: How combine two Items? - zombiehacker595 - 04-06-2012

(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





RE: How combine two Items? - Shives - 04-06-2012

Inventory hps file?
What's this?



RE: How combine two Items? - zombiehacker595 - 04-06-2012

(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


RE: How combine two Items? - Cranky Old Man - 04-06-2012

(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.




RE: How combine two Items? - Shives - 04-06-2012

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