Frictional Games Forum (read-only)
[Tutorial] Use crowbar to open a door - 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 Articles (https://www.frictionalgames.com/forum/forum-40.html)
+---- Thread: [Tutorial] Use crowbar to open a door (/thread-13018.html)

Pages: 1 2 3


RE: [Tutorial] Use crowbar to open a door - Cranky Old Man - 05-15-2012

(05-15-2012, 07:18 AM)SilentStriker Wrote: Either I'm just a bit slow today or I don't really understand what you meen (my nativ language is swedish)

I know what everything in the code does but I guess I'm not showing it properly?

Oh, I missed that you commented the code and removed the asTimer. Still, I've underlined some mysterious things for you:


//Makes it able for the Crowbar_joint to collide with the area in my case the area is named BreakDoor

//Calls a timer that places the crowbar in the door frame.
AddTimer(asEntity, 0.2, "TimerSwitchShovel");

//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("NAMEOFDOOR", "", true);
SetEntityPlayerInteractCallback("NAMEOFTHEAREA", "", true);


}

//The timer we called before
void TimerSwitchShovel(string &in asTimer)
{
//Plays the sound of the player putting the crowbar in the doorframe
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", "Player", 0, false);


//Sets your crowbar_dyn active
SetEntityActive("NAMEOFYOURCROWBAR_DYN", true);


RE: [Tutorial] Use crowbar to open a door - SilentStriker - 05-15-2012

(05-15-2012, 09:16 AM)Cranky Old Man Wrote:
(05-15-2012, 07:18 AM)SilentStriker Wrote: Either I'm just a bit slow today or I don't really understand what you meen (my nativ language is swedish)

I know what everything in the code does but I guess I'm not showing it properly?

Oh, I missed that you commented the code and removed the asTimer. Still, I've underlined some mysterious things for you:


//Makes it able for the Crowbar_joint to collide with the area in my case the area is named BreakDoor

//Calls a timer that places the crowbar in the door frame.
AddTimer(asEntity, 0.2, "TimerSwitchShovel");

//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("NAMEOFDOOR", "", true);
SetEntityPlayerInteractCallback("NAMEOFTHEAREA", "", true);


}

//The timer we called before
void TimerSwitchShovel(string &in asTimer)
{
//Plays the sound of the player putting the crowbar in the doorframe
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", "Player", 0, false);


//Sets your crowbar_dyn active
SetEntityActive("NAMEOFYOURCROWBAR_DYN", true);
//Makes it able for the Crowbar_joint to collide with the area in my case the area is named BreakDoor

BreakDoor is what I call the area the crowbar collides with that calls the function CollideAreaBreakDoor


//Calls a timer that places the crowbar in the door frame.
AddTimer(asEntity, 0.2, "TimerSwitchShovel");


hmm never thought about that, will be changed Smile


//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("NAMEOFDOOR", "", true);
SetEntityPlayerInteractCallback("NAMEOFTHEAREA", "", true);


Doesn't need to be there, changed now Smile

//The timer we called before
void TimerSwitchShovel(string &in asTimer)
{
//Plays the sound of the player putting the crowbar in the doorframe
PlaySoundAtEntity("attachshovel","puzzle_place_jar.snt", "Player", 0, false);


Changed


//Sets your crowbar_dyn active
SetEntityActive("NAMEOFYOURCROWBAR_DYN", true);


Changed with a better description (I think?)


RE: [Tutorial] Use crowbar to open a door - VeNoMzTeamHysterical - 12-15-2012

Can someone make a video tutorial of this?

would be really nice!

i still cant figher out what to do i unactivated the 2 crowbars but which one do you have to pickup then?


RE: [Tutorial] Use crowbar to open a door - Rowzter - 05-23-2014

Sorry for bumping this but when the door opens it glitches out from the door frame. is there a way to "slow the door down",


RE: [Tutorial] Use crowbar to open a door - Romulator - 05-23-2014

(05-23-2014, 10:34 AM)Rowzter Wrote: Sorry for bumping this but when the door opens it glitches out from the door frame. is there a way to "slow the door down",
Though the bump was unnecessary and a new thread would have been better option, unless your door is placed incorrectly, it should be okay.

Regardless, the impulse of the door may be your problem, either by direction or that your impulse is a little too much. Assuming your using the same code as the OP, take a look at this line:
PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"003"world"); 

That 3 is the Z Coordinate, meaning the door will fling in that direction. Try making that a negative. So that it becomes -3.
PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"00, -3"world"); 

If that doesn't work, try moving that 3 to the X coordinate. So it looks like this:

PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"300"world"); 

And of course, if that still doesn't work, try a negative three in the X. If it still glitches out, lower the three to a two. An impulse of three should work fine, but an impulse of 1 is not really noticeable. You shouldn't need to put it in the Y coordinate Smile


RE: [Tutorial] Use crowbar to open a door - Rowzter - 05-23-2014

(05-23-2014, 11:19 AM)Romulator Wrote:
(05-23-2014, 10:34 AM)Rowzter Wrote: Sorry for bumping this but when the door opens it glitches out from the door frame. is there a way to "slow the door down",
Though the bump was unnecessary and a new thread would have been better option, unless your door is placed incorrectly, it should be okay.

Regardless, the impulse of the door may be your problem, either by direction or that your impulse is a little too much. Assuming your using the same code as the OP, take a look at this line:
PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"003"world"); 

That 3 is the Z Coordinate, meaning the door will fling in that direction. Try making that a negative. So that it becomes -3.
PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"00, -3"world"); 

If that doesn't work, try moving that 3 to the X coordinate. So it looks like this:

PHP Code:
AddPropImpulse("NAMEOFYOURDOOR"300"world"); 

And of course, if that still doesn't work, try a negative three in the X. If it still glitches out, lower the three to a two. An impulse of three should work fine, but an impulse of 1 is not really noticeable. You shouldn't need to put it in the Y coordinate Smile

Mixed around with your tips and the door seems fixed now! Thanks =D!

Alraight, so instead of bumping an old thread i should create a completely new instead.