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
Script Help How to make sledgehammer break door?
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#1
How to make sledgehammer break door?

Ive seen it done in another CS so I know its possible, im just not sure how to do it. Basically as the title says I want to be able to throw the large sledgehammer at a door and for it to make the door break open. Any help achieving this would be really appreciated Smile

04-05-2013, 01:13 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: How to make sledgehammer break door?

Put a script area slightly in front of the door, and script it so that when the sledgehammer collides with that script area, the door will break (by setting its health to 0).

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("sledge_hammer_name""script_area_name""BreakDoor"true1);
}

void BreakDoor(string &in parentstring &in childint state)
{
    
SetPropHealth("door_name"0);


In Ruins [WIP]
04-05-2013, 01:25 AM
Find
serbusfish Offline
Member

Posts: 211
Threads: 75
Joined: Aug 2012
Reputation: 0
#3
RE: How to make sledgehammer break door?

(04-05-2013, 01:25 AM)NaxEla Wrote: Put a script area slightly in front of the door, and script it so that when the sledgehammer collides with that script area, the door will break (by setting its health to 0).

PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("sledge_hammer_name""script_area_name""BreakDoor"true1);
}

void BreakDoor(string &in parentstring &in childint state)
{
    
SetPropHealth("door_name"0);


That's awesome pal, thanks Smile

04-05-2013, 03:19 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#4
RE: How to make sledgehammer break door?

You could also break it with several bashes. Just add some particles, sounds, and change the prophealth to 0 at the last bash.
04-05-2013, 07:00 AM
Find
colin56 Offline
Junior Member

Posts: 3
Threads: 0
Joined: Apr 2013
Reputation: 0
#5
RE: How to make sledgehammer break door?

The only source of breaking the door in this application is use of sledgehammer. But its collide is big issue. there is need to set the health at 0 for this collide.




Shopfronts
(This post was last modified: 04-20-2013, 05:12 AM by colin56.)
04-17-2013, 08:41 AM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#6
RE: How to make sledgehammer break door?

Making a collidecallback would not be the best option in my opinion since the player can just hold the sledgehammer against the door and break it.

If you want to go a bit more advanced, you can make the sledgehammer into an item in the inventory, aswell as one with a joint. Use the joint one with the SetMoveObjectState script to make it look like the player is bashing the door when used on the door, and of course, add some sounds, particle systems and change the prop health gradually upon each swing.

Creator of The Dark Treasure.
04-17-2013, 09:26 AM
Website Find




Users browsing this thread: 1 Guest(s)