Frictional Games Forum (read-only)
Breaking down door with rock - 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: Breaking down door with rock (/thread-14349.html)



Breaking down door with rock - Damascus - 03-30-2012

I'm trying to find a way to break down a door by throwing a rock at it but can't seem to find a viable way to do it.

My first approach was to use a script area that activates when the rock enters it, with the only problem being that the script will also activate if you just touch the door with the rock.

My second approach was to reduce the health of the door very low, but even a Health of 1 doesn't affect anything. The door still remains sturdy when you slam it with a heavy rock.



RE: Breaking down door with rock - Your Computer - 03-30-2012

Doors can't be broken through force. You have to change its type to one that can.


RE: Breaking down door with rock - flamez3 - 03-30-2012

void OnStart()
{
AddEntityCollideCallback("rock, "door", "doorbrake", true, 1);
}

void doorbrake(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("door', 0.0f);
}

This only applies to a door that can break.


RE: Breaking down door with rock - Damascus - 03-30-2012

Like I said before, that script will also trigger if you just tap the door with the rock. I'll have to think of some other way to break down that door that doesn't involve crowbars.



RE: Breaking down door with rock - flamez3 - 03-30-2012

Hammer?


RE: Breaking down door with rock - DaAinGame - 03-30-2012

Isn't there some fancy script that also checks the speed of a prop being thrown? I remember reading somewhere that the player throws things at a speed of "2" and this can be used in an if statement. I'll dig around and see if I can't find that old thread.



RE: Breaking down door with rock - flamez3 - 03-30-2012

(03-30-2012, 03:34 AM)DaAinGame Wrote: Isn't there some fancy script that also checks the speed of a prop being thrown? I remember reading somewhere that the player throws things at a speed of "2" and this can be used in an if statement. I'll dig around and see if I can't find that old thread.
That's to check the Players speed.


RE: Breaking down door with rock - Damascus - 03-30-2012

It's a little out of the way, but I added a large script area around the door that turns off the callback if the player enters it. It also switches the rock impact to show a message on screen instead of breaking down the door. "I should back away..." Then when the player backs away, the callback turns back on and they can throw the rock to break down the door.

Kind of a roundabout way of doing it, but I think it's better than nothing.



RE: Breaking down door with rock - Xanthos - 03-30-2012

I don't know if this will work and I'm a bit too lazy to all of the scripting and stuff but when you throw an object at another object it pushes it back.
If it's a locked door it will be pushed back a little then return back.
Maybe if there's a script area behind the door just enough so you can't push the door into it.

Then do the script.
AddEntityCollideCallback("", "mansion_1", "DoorSmash", true, 1);
}

void DoorSmash(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("mansion_1', 0);
GiveSanityBoostSmall();
}
FYI I just thought this up, I don't know if it will work.