Frictional Games Forum (read-only)

Full Version: How to make sledgehammer break door?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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:
void OnStart()
{
    
AddEntityCollideCallback("sledge_hammer_name""script_area_name""BreakDoor"true1);
}

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

(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:
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
You could also break it with several bashes. Just add some particles, sounds, and change the prophealth to 0 at the last bash.
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
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.