Frictional Games Forum (read-only)

Full Version: Help with breakable wall!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wanted to make the player respawn in a cellar when he dies, and to get out he has to break the wall, just like in the main story.. But when I test the map the wall isn't breakable and the hand icon doesn't appear. Do you have any idea on what might be the problem? Thank you Big Grin
Does the player require a tool to break the wall? Do you have an area infront of the wall with ItemInteraction checked?
(04-13-2013, 05:33 PM)i3670 Wrote: [ -> ]Does the player require a tool to break the wall? Do you have an area infront of the wall with ItemInteraction checked?

No i wanted to make that the player has to hit the wall with something like a big throwable rock or a metal chair..
Script to break wall with hammer

Spoiler below!

{
AddUseItemCallback("", "stone_hammer_1", "cell_breakable_wall_1", "BreakWall", true);
}

void BreakWall(string &in asItem, string &in asEntity)
{
SetPropHealth("cell_breakable_wall_1", 0);
SetEntityActive("fragment1",true);
SetEntityActive("fragment2",true);
SetEntityActive("fragment3",true);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}


Make a script area called Impact on the wall so there is gonna be dust.
Also name brick pieces frament1/2/3 you can make more if you liked to.
(04-13-2013, 06:11 PM)VeNoMzTeamHysterical Wrote: [ -> ]Script to break wall with hammer

Spoiler below!

{
AddUseItemCallback("", "stone_hammer_1", "cell_breakable_wall_1", "BreakWall", true);
}

void BreakWall(string &in asItem, string &in asEntity)
{
SetPropHealth("cell_breakable_wall_1", 0);
SetEntityActive("fragment1",true);
SetEntityActive("fragment2",true);
SetEntityActive("fragment3",true);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}


Make a script area called Impact on the wall so there is gonna be dust.
Also name brick pieces frament1/2/3 you can make more if you liked to.
YOU. READ. IT. WRONG. He wants the wall to be crushed by ANYTHING.
Create an area at the part where it's supposed to appear.
And now, try this one out.
Spoiler below!

PHP Code:
void OnStart()
{
AddEntityCollideCallback("""AREANAME""WallCrush"true1); //Change AREANAME to your area's name at the part where you want it to be crushed.
}

void WallCrush(string &in asParentstring &in asChildint alState)
{
SetPropHealth("cell_breakable_wall_1"0); //Sets the wall to destruct
SetEntityActive("Fragment_1"true); //Fragment #1 that will appear
SetEntityActive("Fragment_2"true); //Fragment #2 that will appear
SetEntityActive("Fragment_3"true); //Fragment #3 that will appear
CreateParticleSystemAtEntity("""ps_dust_impact.ps""AREANAME2"false); //Creates a particle to add some dust particles
//And change AREANAME2 to whatever your area's name is. You can place it in front of the wall but it's better if it covered the entire hole.


I don't think this line will work:
AddEntityCollideCallback("", "AREANAME", "WallCrush", true, 1);

Since you have no asParent, there will be no collision, and therefore the callback will not call.
Instead, you can define all the objects you're gonna need.
Call all the objects: "BreakWall_1, BreakWall_2, BreakWall_3 etc.
After that, create a for-script, and make it work with the collide function, so you can write:
AddEntityCollideCallback("BreakWall_"+i, "AREANAME", "WallCrush", true, 1);