Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Use crowbar to open a door
Author Message
Cranky Old Man Offline
Posting Freak

Posts: 986
Joined: Apr 2012
Reputation: 38
Post: #21
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, "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);

Noob scripting tutorial: From Noob to Pro

05-15-2012 09:16 AM
Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 950
Joined: Jul 2011
Reputation: 43
Post: #22
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 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?)

05-15-2012 03:03 PM
Find all posts by this user Quote this message in a reply
VeNoMzTeamHysterical Offline
Member

Posts: 240
Joined: Dec 2012
Reputation: 3
Post: #23
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?

http://www.frictionalgames.com/forum/thread-21719.html
Evil Awaking Work In Progress!
Hours Spend 472.
12-15-2012 07:32 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rowzter Offline
Junior Member

Posts: 44
Joined: Oct 2012
Reputation: 3
Post: #24
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
Find all posts by this user Quote this message in a reply
Romulator Offline
G'day mate! :3

Posts: 3,458
Joined: Jan 2013
Reputation: 191
Post: #25
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:
PHP Code: (Select All)
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: (Select All)
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: (Select All)
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

Discord: Romulator#4942
05-23-2014 11:19 AM
Find all posts by this user Quote this message in a reply
Rowzter Offline
Junior Member

Posts: 44
Joined: Oct 2012
Reputation: 3
Post: #26
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:
PHP Code: (Select All)
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: (Select All)
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: (Select All)
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.
05-23-2014 04:48 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)