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] Breakable Door
Erik The Born Offline
Member

Posts: 59
Threads: 7
Joined: Mar 2013
Reputation: 0
#14
RE: [SCRIPT] Breakable Door

(03-24-2013, 08:04 AM)JustAnotherPlayer Wrote:
(03-23-2013, 06:09 PM)Knusper. Wrote: as i said:
You have to name all entities like they are named in the scripts
or name all entities in the scripts like you named them in the editor.

To have more doors:
I think just make everything as like the first door, and then just name all entities like:
breakdoor_2

so, maybe just for example add a 2 at the end.
And change the names in the script, witch you copy paste to have two.
Then you need to use new function names.
just with an other impactarea and so on.
I think that works, but i didnt test it.

I didn't direct it to you. I was directing it to Erik The Born. And actually you can make another one.

Yes this is what my custom story has in its HPS file. However for some reason when I try to break a door. I hear the door break. But instead of the actual door im banging on geting broken, another door is lol. And then when I try to smash the door you actually need to smash it takes like infinity hits it never breaks. It might be me fucking something up but how? I paste my HPS to see if you can see some wrong in it.

PHP Code: (Select All)
void OnStart()
 {
 
AddEntityCollideCallback("Sledgehammer""ImpactArea""ImpactScript"false1);
 
AddEntityCollideCallback("Sledgehammer""ImpactArea_1""ImpactScript_1"false1);
 
AddUseItemCallback("""rusty_key""celler""UsedKeyOnDoor"true);
 }

 
// BreakableDoor_1 == Mansion_1 door
 // Pieces_1/2 == custom Mansion_Broken made static and undying (-1 lifetime)
 // Pieces just behind the door, the ImpactArea veeery close to BreakableDoor_1.
 // Sledgehammer= Item used to destroy it.
 // BreakEffect areas are on BreakableDoor_1




 
void ImpactScript (string &in asParentstring &in asChildint alState)
 {
 if(
GetLocalVarInt("BreakDoorInt") == 3)
 {
 
SetEntityActive("ImpactArea"false);
 
SetPropStaticPhysics("Pieces_2"false);
 
SetPropStaticPhysics("Pieces_1"false);
 
AddPropImpulse("Pieces_1"0.513"world");
 
AddPropImpulse("Pieces_2"0.60.32.5"world");
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect"false);
 
PlayGuiSound("break_wood_metal.snt",2);
 } 

 if(
GetLocalVarInt("BreakDoorInt") == 2)
 {
 
PlaySoundAtEntity("""break_wood_metal.snt""Pieces_1"0false);
 
SetPropHealth("BreakableDoor_1", -1);
 
AddPropImpulse("BreakableDoor_1"00, -0.5"world");
 } 
 
PlaySoundAtEntity("""break_wood.snt""BreakableDoor_1"0false);
 
AddLocalVarInt("BreakDoorInt"1);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect"false);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect2"false);
 }
void ImpactScript_1 (string &in asParentstring &in asChildint alState)
 {
 if(
GetLocalVarInt("BreakDoorInt") == 3)
 {
 
SetEntityActive("ImpactArea_1"false);
 
SetPropStaticPhysics("Pieces_4"false);
 
SetPropStaticPhysics("Pieces_3"false);
 
AddPropImpulse("Pieces_3"0.513"world");
 
AddPropImpulse("Pieces_4"0.60.32.5"world");
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect_1"false);
 
PlayGuiSound("break_wood_metal.snt",2);
 } 

 if(
GetLocalVarInt("BreakDoorInt") == 2)
 {
 
PlaySoundAtEntity("""break_wood_metal.snt""Pieces_3"0false);
 
SetPropHealth("BreakableDoor_2", -1);
 
AddPropImpulse("BreakableDoor_2"00, -0.5"world");
 } 
 
PlaySoundAtEntity("""break_wood.snt""BreakableDoor_2"0false);
 
AddLocalVarInt("BreakDoorInt"1);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect_1"false);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect2"false);
 }
void ImpactScript_2 (string &in asParentstring &in asChildint alState)
 {
 if(
GetLocalVarInt("BreakDoorInt") == 3)
 {
 
SetEntityActive("ImpactArea_2"false);
 
SetPropStaticPhysics("Pieces_6"false);
 
SetPropStaticPhysics("Pieces_5"false);
 
AddPropImpulse("Pieces_5"0.513"world");
 
AddPropImpulse("Pieces_6"0.60.32.5"world");
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect_2"false);
 
PlayGuiSound("break_wood_metal.snt",2);
 } 

 if(
GetLocalVarInt("BreakDoorInt") == 2)
 {
 
PlaySoundAtEntity("""break_wood_metal.snt""Pieces_5"0false);
 
SetPropHealth("BreakableDoor_2", -1);
 
AddPropImpulse("BreakableDoor_2"00, -0.5"world");
 } 
 
PlaySoundAtEntity("""break_wood.snt""BreakableDoor_3"0false);
 
AddLocalVarInt("BreakDoorInt"1);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect_2"false);
 
CreateParticleSystemAtEntity("""ps_hit_wood""BreakEffect2"false);
}
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
SetSwingDoorLocked("celler"falsetrue);
PlaySoundAtEntity("""unlock_door""celler"0false);
RemoveItem("rusty_key");

(This post was last modified: 03-24-2013, 08:22 AM by Erik The Born.)
03-24-2013, 08:21 AM
Find


Messages In This Thread
[SCRIPT] Breakable Door - by Vic7im - 09-26-2012, 02:33 PM
RE: I'll just leave this here. - by Robby - 09-26-2012, 02:34 PM
RE: [SCRIPT] Breakable Door - by Fatalist - 12-22-2012, 08:59 AM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-21-2013, 06:21 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-22-2013, 03:13 AM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-23-2013, 09:01 AM
RE: [SCRIPT] Breakable Door - by Knusper. - 03-23-2013, 10:33 AM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-23-2013, 10:41 AM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-23-2013, 02:54 PM
RE: [SCRIPT] Breakable Door - by Knusper. - 03-23-2013, 12:01 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-23-2013, 01:48 PM
RE: [SCRIPT] Breakable Door - by Knusper. - 03-23-2013, 06:09 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 08:04 AM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 08:21 AM
RE: [SCRIPT] Breakable Door - by Knusper. - 03-24-2013, 09:14 AM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 12:05 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 12:19 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 12:27 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 02:14 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 02:26 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 02:27 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 02:58 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 02:59 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 03:18 PM
RE: [SCRIPT] Breakable Door - by PutraenusAlivius - 03-24-2013, 03:19 PM
RE: [SCRIPT] Breakable Door - by Erik The Born - 03-24-2013, 03:30 PM
RE: [SCRIPT] Breakable Door - by Adrianis - 03-24-2013, 10:21 PM
RE: [SCRIPT] Breakable Door - by The chaser - 03-24-2013, 11:55 AM
RE: [SCRIPT] Breakable Door - by The chaser - 03-24-2013, 03:09 PM



Users browsing this thread: 1 Guest(s)