Cranky Old Man
Posting Freak
Posts: 986
Threads: 20
Joined: Apr 2012
Reputation:
38
|
RE: [Tutorial] Use crowbar to open a door
(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, "TimerSwitch Shovel");
//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("NAMEOFDOOR", "", true);
SetEntityPlayerInteractCallback("NAMEOFTHEAREA", "", true);
}
//The timer we called before
void TimerSwitch Shovel(string &in asTimer)
{
//Plays the sound of the player putting the crowbar in the doorframe
PlaySoundAtEntity("attach shovel","puzzle_place_jar.snt", "Player", 0, false);
//Sets your crowbar_dyn active
SetEntityActive("NAMEOFYOURCROWBAR_ DYN", true);
|
|
05-15-2012, 09:16 AM |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: [Tutorial] Use crowbar to open a door
(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
//Remove callback incase player never touched door
SetEntityPlayerInteractCallback("NAMEOFDOOR", "", true);
SetEntityPlayerInteractCallback("NAMEOFTHEAREA", "", true);
Doesn't need to be there, changed now
//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?)
|
|
05-15-2012, 03:03 PM |
|
VeNoMzTeamHysterical
Member
Posts: 240
Threads: 36
Joined: Dec 2012
Reputation:
3
|
RE: [Tutorial] Use crowbar to open a door
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?
|
|
12-15-2012, 07:32 PM |
|
Rowzter
Junior Member
Posts: 44
Threads: 12
Joined: Oct 2012
Reputation:
3
|
RE: [Tutorial] Use crowbar to open a door
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",
|
|
05-23-2014, 10:34 AM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: [Tutorial] Use crowbar to open a door
(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:
AddPropImpulse("NAMEOFYOURDOOR", 0, 0, 3, "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.
AddPropImpulse("NAMEOFYOURDOOR", 0, 0, -3, "world");
If that doesn't work, try moving that 3 to the X coordinate. So it looks like this:
AddPropImpulse("NAMEOFYOURDOOR", 3, 0, 0, "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
Discord: Romulator#0001
|
|
05-23-2014, 11:19 AM |
|
Rowzter
Junior Member
Posts: 44
Threads: 12
Joined: Oct 2012
Reputation:
3
|
RE: [Tutorial] Use crowbar to open a door
(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:
AddPropImpulse("NAMEOFYOURDOOR", 0, 0, 3, "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.
AddPropImpulse("NAMEOFYOURDOOR", 0, 0, -3, "world");
If that doesn't work, try moving that 3 to the X coordinate. So it looks like this:
AddPropImpulse("NAMEOFYOURDOOR", 3, 0, 0, "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
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.
|
|
05-23-2014, 04:48 PM |
|
|