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
Breaking a wall
Freeoath Offline
Junior Member

Posts: 22
Threads: 4
Joined: Aug 2011
Reputation: 0
#1
Breaking a wall

Hello People!

I want the effect of a wall breaking when you use force on it (Like in Charpter 3 "The Cell" in the Original game)

I've looked at the script for it and to be honest I am not super good at scripting and francly I've done a few triest and I've never gotten it to work. I would like to have some help here. I have the script from the original game here. Is there any way to shorten it to make it less. All I want is the:

Wall breaking.
The hammer and a Nail to break it with.
The Breaking Effect.
The swap from the normal wall to the broken wall (AKA cell_breakable_wall_1 -> cell_breakable_wall_broken_1)


If anyone feels like helping me it would be the best. I know it's abit of work, but I really need it Smile


The original script is:

Spoiler below!


void InteractPrisonDoor(string &in asEntity)
{
SetMessage("Ch03Level25", "InteractLockedCellDoor", -1);

AddQuest("25LockedCellDoor", "25LockedCellDoor");
}

void UseKeyOnCellDoor(string &in asItem, string &in asEntity)
{
SetMessage("Ch03Level25", "UseKeyOnCellDoor", -1);
}

void CollideWriggleBarBreak(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("wriggle_bar_break", 1);
if(GetLocalVarInt("wriggle_bar_broken") == 1 ){
SetMessage("BasicPhrases", "UseItemOrCombineItem03", 0);
for(int i=1;i<=4;++i)
RemoveEntityCollideCallback("wriggle_prison_bar_1", "AreaWriggleBarBreak_" + i);
return;
}

if(GetLocalVarInt("wriggle_bar_break")==6)
{
AddLocalVarInt("wriggle_bar_broken", 1);

CreateParticleSystemAtEntity("sparks", "ps_hit_metal.ps", "wriggle_prison_bar_1", false);

PlaySoundAtEntity("breakb", "17_break_wheel.snt", asChild, 0.2f, false);
PlaySoundAtEntity("breakb2", "25_bar_drop.snt", asChild, 0.2f, false);

SetEntityActive("wriggle_prison_bar_1", false);
SetEntityActive("wriggle_prison_bar_item_1", true);

for(int i=1;i<=4;++i)
RemoveEntityCollideCallback("wriggle_prison_bar_1", "AreaWriggleBarBreak_" + i);
}
}

void CollideWriggleBarBreak2(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("wriggle_bar_break2", 1);
if(GetLocalVarInt("wriggle_bar_broken") == 1 ){
SetMessage("BasicPhrases", "UseItemOrCombineItem03", 0);
for(int i=5;i<=8;++i)
RemoveEntityCollideCallback("wriggle_prison_bar_2", "AreaWriggleBarBreak_" + i);
return;
}

if(GetLocalVarInt("wriggle_bar_break2")==6)
{
AddLocalVarInt("wriggle_bar_broken", 1);

CreateParticleSystemAtEntity("sparks", "ps_hit_metal.ps", "wriggle_prison_bar_2", false);

PlaySoundAtEntity("breakb", "17_break_wheel.snt", asChild, 0.2f, false);
PlaySoundAtEntity("breakb2", "25_bar_drop.snt", asChild, 0.2f, false);

SetEntityActive("wriggle_prison_bar_2", false);
SetEntityActive("wriggle_prison_bar_item_2", true);

for(int i=5;i<=8;++i)
RemoveEntityCollideCallback("wriggle_prison_bar_2", "AreaWriggleBarBreak_" + i);
}
}


void InteractLooseBricks(string &in asEntity)
{
SetMessage("Ch03Level25", "InteractLooseBricks", -1);

PlayGuiSound("18_touch_rock.snt", 0.8f);

AddTimer(asEntity, 1.0f, "TimerLooseBricks");
}

void TimerLooseBricks(string &in asTimer)
{
SetEntityPlayerInteractCallback(asTimer, "InteractLooseBricks", true);
}


void UseBarOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("wriggle_prison_bar_bend_stone_1", true);

FadeLightTo("PointLight_21", 0.9, 0.8, 0.3, 0.8, -1, 1);

CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);

SetLocalVarInt("BarInPlace", 1);

PlaySoundAtEntity("attachb", "25_attach_bar.snt", asEntity, 0.0f, false);

RemoveItem(asItem);
SetEntityActive(asEntity, false);
}

void UseHCOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("stone_chipper_move_x_1",true);
SetEntityActive("stone_hammer_move_1",true);

PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);

SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);

AddTimer("1", 0.2f, "TimerHammer");
AddTimer("2", 0.6f, "TimerHammer");
AddTimer("3", 0.8f, "TimerHammer");
AddTimer("4", 1.2f, "TimerHammer");
AddTimer("5", 1.4f, "TimerHammer");

SetEntityActive(asEntity, false);

if(HasItem("poison_gland")) RemoveItem(asItem);
}

void TimerHammer(string &in asTimer)
{
if(asTimer == "1"){
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "2"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "3"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
}
if(asTimer == "4"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "5"){
SetEntityActive("stone_chipper_move_x_1",false);
SetEntityActive("stone_hammer_move_1",false);
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);

FadeLightTo("PointLight_21", 0.9, 0.8, 0.3, 0.8, -1, 1);
CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);
SetLocalVarInt("UsedHC", 1);
CollideBarBendDone("", "", 1);
}
}

void UseBarOnWall(string &in asItem, string &in asEntity)
{
SetMessage("Ch03Level25", "UseBarOnWall", -1);
}

void InteractBendBar(string &in asEntity)
{
PlaySoundAtEntity("rockbars", "15_rock_break", asEntity, 0.5f, false);
}

void CollideBarBendDone(string &in asParent, string &in asChild, int alState)
{
FadeLightTo("PointLight_21", 0,0,0,0, -1, 1);

SetEntityActive("wriggle_prison_bar_bend_stone_1", false);

if(GetLocalVarInt("BarInPlace") == 1)
SetEntityActive("wriggle_prison_bar_obj_dyn_1", true);

for(int i=1; i<=3; ++i)
{
SetPropStaticPhysics("cell_breakable_wall_rock"+i, false);

if(GetLocalVarInt("UsedHC") == 1)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-1.5f, "World");
else
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,1.5f, "World");
}
AddTimer("ExtraBrickPush", 0.4, "TimerExtraBrickPush");

CreateParticleSystemAtEntity("dust", "ps_break_pottery.ps", "AreaLooseBricks", false);

PlayGuiSound("25_break_rock.snt",1.0f);

SetPropStaticPhysics("cell_breakable_wall_support_1", false);
}

void TimerExtraBrickPush(string &in asTimer)
{
if(GetLocalVarInt("UsedHC") == 1)
for(int i=1; i<=3; ++i)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-2, "World");
else
for(int i=1; i<=3; ++i)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,2, "World");
}

void InteractWoodPillar(string &in asEntity)
{
PlaySoundAtEntity("bendwood", "25_strain_wood", asEntity, 0.1f, false);
}


void CollideCollapseWall(string &in asParent, string &in asChild, int alState)
{

for(int i=1; i<=2; ++i)
SetEntityActive("AreaCollapseWall_"+i,false);

StopGuardianCountDown();

AddPlayerBodyForce(0,0,-5000, false);

FadeLightTo("PointLight_21", 0,0,0,0, -1, 1);

SetPropHealth("cell_breakable_wall_1", 0);
SetPropHealth("cell_breakable_wall_support_1", 0);

StartScreenShake(0.2, 0.3, 1, 1);

PlayMusic("25_puzzle_escape", false, 1.0f, 1.0f, 10, false);

CompleteQuest("25LockedCellDoor", "25LockedCellDoor");
SetEntityPlayerInteractCallback("prison_section_plain_1","", false);

AddTimer("DistantHowl", 8, "TimerDistantHowl");

SetEntityActive("AreaEscaped", false);
}


void TimerDistantHowl(string &in asTimer)
{
PlaySoundAtEntity("howl","25_guardian_distant1", "Player", 0, false);

AddTimer("StopRadialBlur", 4.5f, "TimerStopRadialBlur");
AddTimer("react_scare", 0.5f, "TimerScareReaction");
AddTimer("react_breath", 2.5f, "TimerScareReaction");

StartScreenShake(0.01f, 0.0f, 2.0f, 4.0f);

SetRadialBlurStartDist(0.2f);
FadeRadialBlurTo(0.09, 0.015f);
}

void TimerStopRadialBlur(string &in asTimer)
{
AddDebugMessage("Stopping howl blur.", false);
FadeRadialBlurTo(0, 0.02f);
}

void TimerScareReaction(string &in asTimer)
{
PlayGuiSound(asTimer, 0.7f);

if(asTimer == "react_scare")
GiveSanityDamage(15.0f, true);
}



(This post was last modified: 08-29-2011, 09:07 PM by Freeoath.)
08-29-2011, 09:06 PM
Find
Rapture Offline
Posting Freak

Posts: 1,078
Threads: 79
Joined: May 2011
Reputation: 30
#2
RE: Breaking a wall

Well I'll help you. But I want you to try it out for yourself. If you have done any scripting. Try doing this.

Get a item callback to be used on the wall.

Ex: A hammer and just the wall.

When its used, simply set the "cell_breakable_wall_1" to inactive and the broken one to active. Also put a particle effect when it breaks. If you can do that much, you can probally figure out the rest. Smile

But if you can't, tell us whats wrong. And please atleast attempt to script!
08-29-2011, 11:01 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#3
RE: Breaking a wall

Yeah, its all about adding some particals to make it look reasonable. but Rapture has the idea spot on.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-30-2011, 02:46 AM
Website Find
Freeoath Offline
Junior Member

Posts: 22
Threads: 4
Joined: Aug 2011
Reputation: 0
#4
RE: Breaking a wall

Yeah I have a script (Not on this comp) I will post it later Smile You oughta find something wrong in it ^^

08-30-2011, 08:25 PM
Find
Freeoath Offline
Junior Member

Posts: 22
Threads: 4
Joined: Aug 2011
Reputation: 0
#5
RE: Breaking a wall

I am on the right computer now. I'll send the Wall part only. See if you see any errors.

Spoiler below!


//// Breaking the Wall

void InteractLooseBricks(string &in asEntity)
{
PlayGuiSound("18_touch_rock.snt", 0.8f);
AddTimer(asEntity, 1.0f, "TimerLooseBricks");
}

void TimerLooseBricks(string &in asTimer)
{
SetEntityPlayerInteractCallback(asTimer, "InteractLooseBricks", true);
}


void UseBarOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("wriggle_prison_bar_bend_stone_1", true);
CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);
}

void UseHCOnBricks(string &in asItem, string &in asEntity)
{
SetEntityActive("stone_chipper_move_x_1",true);
SetEntityActive("stone_hammer_move_1",true);

PlaySoundAtEntity("cumble1", "15_rock_break", "AreaHammer", 0, false);

SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);

AddTimer("1", 0.2f, "TimerHammer");
AddTimer("2", 0.6f, "TimerHammer");
AddTimer("3", 0.8f, "TimerHammer");
AddTimer("4", 1.2f, "TimerHammer");
AddTimer("5", 1.4f, "TimerHammer");

SetEntityActive(asEntity, false);
}

void TimerHammer(string &in asTimer)
{
if(asTimer == "1"){
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
}
if(asTimer == "2"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "3"){
SetMoveObjectState("stone_hammer_move_1", 0.0f);
SetMoveObjectState("stone_chipper_move_x_1", 0.0f);
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);
}
if(asTimer == "4"){
SetMoveObjectState("stone_hammer_move_1", 0.25f);
SetMoveObjectState("stone_chipper_move_x_1", 1.0f);
}
if(asTimer == "5"){
SetEntityActive("stone_chipper_move_x_1",false);
SetEntityActive("stone_hammer_move_1",false);
PlaySoundAtEntity("bang", "impact_rock_high", "Player", 0, false);
PlaySoundAtEntity("hammer", "15_hammer", "Player", 0, false);

CreateParticleSystemAtEntity("dust", "ps_hit_rock.ps", "AreaLooseBricks", false);
SetLocalVarInt("UsedHC", 1);
CollideBarBendDone("", "", 1);
}
}

void UseBarOnWall(string &in asItem, string &in asEntity)
{
SetMessage("BrokenWall", "UseBarOnWall", -1);
}

void InteractBendBar(string &in asEntity)
{
PlaySoundAtEntity("rockbars", "15_rock_break", asEntity, 0.5f, false);
}

void CollideBarBendDone(string &in asParent, string &in asChild, int alState)
{
FadeLightTo("PointLight_21", 0,0,0,0, -1, 1);

SetEntityActive("wriggle_prison_bar_bend_stone_1", false);

if(GetLocalVarInt("BarInPlace") == 1)
SetEntityActive("wriggle_prison_bar_obj_dyn_1", true);

for(int i=1; i<=3; ++i)
{
SetPropStaticPhysics("cell_breakable_wall_rock"+i, false);

if(GetLocalVarInt("UsedHC") == 1)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-1.5f, "World");
else
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,1.5f, "World");
}
AddTimer("ExtraBrickPush", 0.4, "TimerExtraBrickPush");

CreateParticleSystemAtEntity("dust", "ps_break_pottery.ps", "AreaLooseBricks", false);

PlayGuiSound("25_break_rock.snt",1.0f);

SetPropStaticPhysics("cell_breakable_wall_support_1", false);
}

void TimerExtraBrickPush(string &in asTimer)
{
if(GetLocalVarInt("UsedHC") == 1)
for(int i=1; i<=3; ++i)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,-2, "World");
else
for(int i=1; i<=3; ++i)
AddPropImpulse("cell_breakable_wall_rock"+i, 0,0,2, "World");
}

void InteractWoodPillar(string &in asEntity)
{
PlaySoundAtEntity("bendwood", "25_strain_wood", asEntity, 0.1f, false);
}

void CollideCollapseWall(string &in asParent, string &in asChild, int alState)
{

for(int i=1; i<=2; ++i)
SetEntityActive("AreaCollapseWall_"+i,false);

AddPlayerBodyForce(0,0,-5000, false);

SetPropHealth("cell_breakable_wall_1", 0);
SetPropHealth("cell_breakable_wall_support_1", 0);

StartScreenShake(0.2, 0.3, 1, 1);

PlayMusic("dan_grunt.ogg", false, 1.0f, 1.0f, 10, false);

SetEntityActive("AreaEscaped", false);
}



(This post was last modified: 08-31-2011, 12:57 AM by Freeoath.)
08-31-2011, 12:56 AM
Find




Users browsing this thread: 2 Guest(s)