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
How combine two Items?
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#1
How combine two Items?

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

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


04-04-2012, 02:33 PM
Find
Xanthos Offline
Senior Member

Posts: 318
Threads: 9
Joined: Mar 2012
Reputation: 8
#2
RE: How combine two Items?

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

(This post was last modified: 04-04-2012, 03:02 PM by Xanthos.)
04-04-2012, 03:00 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#3
RE: How combine two Items?

There is tutorial in the wiki that i suggested.

04-04-2012, 03:06 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: How combine two Items?

I think you need a inventory script file. Smile

04-04-2012, 09:54 PM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#5
RE: How combine two Items?

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

}

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


04-06-2012, 10:37 AM
Find
zombiehacker595 Offline
Member

Posts: 141
Threads: 51
Joined: Mar 2012
Reputation: 3
#6
RE: How combine two Items?

(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


04-06-2012, 11:11 AM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#7
RE: How combine two Items?

Inventory hps file?
What's this?

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


04-06-2012, 11:17 AM
Find
zombiehacker595 Offline
Member

Posts: 141
Threads: 51
Joined: Mar 2012
Reputation: 3
#8
RE: How combine two Items?

(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
(This post was last modified: 04-06-2012, 11:24 AM by zombiehacker595.)
04-06-2012, 11:21 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#9
RE: How combine two Items?

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


Noob scripting tutorial: From Noob to Pro

04-06-2012, 11:26 AM
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#10
RE: How combine two Items?

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

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


04-06-2012, 11:39 AM
Find




Users browsing this thread: 1 Guest(s)