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
#21
RE: [SCRIPT] Breakable Door

(03-24-2013, 02:14 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:27 PM)Erik The Born Wrote:
(03-24-2013, 12:19 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:05 PM)Erik The Born Wrote:
(03-24-2013, 09:14 AM)Knusper. Wrote: You need to have new names for the variables.
like: AddLocalVarInt("BreakDoorInt2", 1);
Thats why you seem to have to hit it infinity times.
I dont see more mistakes...

edit:

if(GetLocalVarInt("BreakDoorInt") == 2)
{
PlaySoundAtEntity("", "break_wood_metal.snt", "Pieces_3", 0, false);
SetPropHealth("BreakableDoor_2", -1);
AddPropImpulse("BreakableDoor_2", 0, 0, -0.5, "world");
}
PlaySoundAtEntity("", "break_wood.snt", "BreakableDoor_2", 0, false);
AddLocalVarInt("BreakDoorInt", 1);
CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect_1", false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "BreakEffect2", false);

}

Why do you have both effects here?
You made that three times in your script.
I think its wrong, you just need the effect on the door where you hit Tongue

Ok I seem to be able to hit all the doors but... When I hit one of the doors I see particle effects and all that but when it breaks the door isnt broken! Instead Another door is broken. If I try to break that door it will do the same but it wont break any door at all. Whats wrong?

(03-24-2013, 11:55 AM)The chaser Wrote: *ehem*

Guys, you are complicating yourself. It's not hard to make a breakable door. With the sledge:

Make a area which fits the door, called, for example: AreaThatIsInTheDoor

void OnStart()
{
AddEntityCollideCallback("Sledge", "AreaThatIsInTheDoor", "Break_dammit", true, 1);
}

void Break_dammit (string &in asParent, string &in asChild, int alState)
{
SetPropHealth("DoorToBreak", 0); ///This will destroy it
SetPropHealth("DoorToBreak", 10); ///This will make it very destroyed but still in it's place
SetPropHealth("DoorToBreak", 40); ///This will crack it

CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaThatIsInTheDoor", false);

////Choose between these to have your breakable door
}

I choose between the Health values? Why dont you make it so first hit it has 40. Second 10, and finally 0?

If it hit first with the damage of 40, it will fall off.

What? Can you explain how to make it have 40 Health first hit. 10 after second hit. and at 3rd hit break? PS: This guys script didnt wokr at all. All I see is some very small particle effect no sound and most importantly it doesnt break. My apploligizes, I were stupid enough not to name the door to DoorToBreak lol. But I still need a way to make it so that you can hit 3 times and first tme 40 then 10 and last 0 so the door breaks. How does this work?

Hitting 40 first creates a big gap in the door. Using 10 makes a much smaller gap.

I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
03-24-2013, 02:26 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#22
RE: [SCRIPT] Breakable Door

(03-24-2013, 02:26 PM)Erik The Born Wrote:
(03-24-2013, 02:14 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:27 PM)Erik The Born Wrote:
(03-24-2013, 12:19 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:05 PM)Erik The Born Wrote: Ok I seem to be able to hit all the doors but... When I hit one of the doors I see particle effects and all that but when it breaks the door isnt broken! Instead Another door is broken. If I try to break that door it will do the same but it wont break any door at all. Whats wrong?


I choose between the Health values? Why dont you make it so first hit it has 40. Second 10, and finally 0?

If it hit first with the damage of 40, it will fall off.

What? Can you explain how to make it have 40 Health first hit. 10 after second hit. and at 3rd hit break? PS: This guys script didnt wokr at all. All I see is some very small particle effect no sound and most importantly it doesnt break. My apploligizes, I were stupid enough not to name the door to DoorToBreak lol. But I still need a way to make it so that you can hit 3 times and first tme 40 then 10 and last 0 so the door breaks. How does this work?

Hitting 40 first creates a big gap in the door. Using 10 makes a much smaller gap.

I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
First, 10
Second, 40
Third, 10

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-24-2013, 02:27 PM
Find
Erik The Born Offline
Member

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

(03-24-2013, 02:27 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:26 PM)Erik The Born Wrote:
(03-24-2013, 02:14 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:27 PM)Erik The Born Wrote:
(03-24-2013, 12:19 PM)JustAnotherPlayer Wrote: If it hit first with the damage of 40, it will fall off.

What? Can you explain how to make it have 40 Health first hit. 10 after second hit. and at 3rd hit break? PS: This guys script didnt wokr at all. All I see is some very small particle effect no sound and most importantly it doesnt break. My apploligizes, I were stupid enough not to name the door to DoorToBreak lol. But I still need a way to make it so that you can hit 3 times and first tme 40 then 10 and last 0 so the door breaks. How does this work?

Hitting 40 first creates a big gap in the door. Using 10 makes a much smaller gap.

I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
First, 10
Second, 40
Third, 10

I did like this.

SetPropHealth("DoorToBreak_2", 10);
SetPropHealth("DoorToBreak_2", 40);
SetPropHealth("DoorToBreak_2", 10);

Now a big hole appears. But I cant completely destroy it.
03-24-2013, 02:58 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#24
RE: [SCRIPT] Breakable Door

(03-24-2013, 02:58 PM)Erik The Born Wrote:
(03-24-2013, 02:27 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:26 PM)Erik The Born Wrote:
(03-24-2013, 02:14 PM)JustAnotherPlayer Wrote:
(03-24-2013, 12:27 PM)Erik The Born Wrote: What? Can you explain how to make it have 40 Health first hit. 10 after second hit. and at 3rd hit break? PS: This guys script didnt wokr at all. All I see is some very small particle effect no sound and most importantly it doesnt break. My apploligizes, I were stupid enough not to name the door to DoorToBreak lol. But I still need a way to make it so that you can hit 3 times and first tme 40 then 10 and last 0 so the door breaks. How does this work?

Hitting 40 first creates a big gap in the door. Using 10 makes a much smaller gap.

I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
First, 10
Second, 40
Third, 10

I did like this.

SetPropHealth("DoorToBreak_2", 10);
SetPropHealth("DoorToBreak_2", 40);
SetPropHealth("DoorToBreak_2", 10);

Now a big hole appears. But I cant completely destroy it.

Set it to 20, 40, 40.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-24-2013, 02:59 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#25
RE: [SCRIPT] Breakable Door

I think you misunderstood me:

Follow this in order to make it work. Read my commentaries.

http://wiki.frictionalgames.com/hpl2/tut...ipt/events

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
03-24-2013, 03:09 PM
Find
Erik The Born Offline
Member

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

(03-24-2013, 02:59 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:58 PM)Erik The Born Wrote:
(03-24-2013, 02:27 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:26 PM)Erik The Born Wrote:
(03-24-2013, 02:14 PM)JustAnotherPlayer Wrote: Hitting 40 first creates a big gap in the door. Using 10 makes a much smaller gap.

I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
First, 10
Second, 40
Third, 10

I did like this.

SetPropHealth("DoorToBreak_2", 10);
SetPropHealth("DoorToBreak_2", 40);
SetPropHealth("DoorToBreak_2", 10);

Now a big hole appears. But I cant completely destroy it.

Set it to 20, 40, 40.

Doesnt matter. Can still only hit it once.
03-24-2013, 03:18 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#27
RE: [SCRIPT] Breakable Door

(03-24-2013, 03:18 PM)Erik The Born Wrote:
(03-24-2013, 02:59 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:58 PM)Erik The Born Wrote:
(03-24-2013, 02:27 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:26 PM)Erik The Born Wrote: I dont get it. The door breaks after the first strike. I want it to break after 3 strikes. How do I do that?
First, 10
Second, 40
Third, 10

I did like this.

SetPropHealth("DoorToBreak_2", 10);
SetPropHealth("DoorToBreak_2", 40);
SetPropHealth("DoorToBreak_2", 10);

Now a big hole appears. But I cant completely destroy it.

Set it to 20, 40, 40.

Doesnt matter. Can still only hit it once.
wat do you mean?

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-24-2013, 03:19 PM
Find
Erik The Born Offline
Member

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

(03-24-2013, 03:19 PM)JustAnotherPlayer Wrote:
(03-24-2013, 03:18 PM)Erik The Born Wrote:
(03-24-2013, 02:59 PM)JustAnotherPlayer Wrote:
(03-24-2013, 02:58 PM)Erik The Born Wrote:
(03-24-2013, 02:27 PM)JustAnotherPlayer Wrote: First, 10
Second, 40
Third, 10

I did like this.

SetPropHealth("DoorToBreak_2", 10);
SetPropHealth("DoorToBreak_2", 40);
SetPropHealth("DoorToBreak_2", 10);

Now a big hole appears. But I cant completely destroy it.

Set it to 20, 40, 40.

Doesnt matter. Can still only hit it once.
wat do you mean?

I mean this script only allows you to hit the door once. If i try to hit the door more nothing will happen. Get it?
03-24-2013, 03:30 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#29
RE: [SCRIPT] Breakable Door

(03-24-2013, 03:30 PM)Erik The Born Wrote: I mean this script only allows you to hit the door once. If i try to hit the door more nothing will happen. Get it?

It'd be great if you guys could delete part or all of the text you are quoting. Otherwise you just get huuuge posts for 1 sentence.

This change should enable you to hit it 3 times before breaking it. However I warn you it is entirely untested.

void OnStart()
{
  AddEntityCollideCallback("Sledge", "AreaThatIsInTheDoor", "Break_dammit", false, 1);
  SetLocalVarInt("TimesDoorHit", 0); // represents the number of times the door has been hit
}

void Break_dammit (string &in asParent, string &in asChild, int alState)
{
  int inHit = GetLocalVarInt("TimesDoorHit"); // make the name shorter, easier to use in the if's
  // if's to check the number of times you've hit the door, first is 0
  if (inHit==0) {
     SetPropHealth("DoorToBreak", 40); ///This will crack it
  }
  else if (inHit==1) {
     SetPropHealth("DoorToBreak", 10); ///This will make it very destroyed but still in it's place
  }
  else if (inHit==2) {
     SetPropHealth("DoorToBreak", 0); ///This will destroy it
     RemoveEntityCollideCallback("Sledge", "AreaThatIsInTheDoor"); // remove the collide callback area
  }
    AddLocalVarInt("TimesDoorHit", 1); // each time the door is hit, 1 is added to hit value
    CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaThatIsInTheDoor", false); // create particle on each hit
}

Remember that SetPropHealth is not adding damage, it is literally setting the HP of the door to the number specified, so it will never be destroyed unless you set it to 0 at some point.

(This post was last modified: 03-24-2013, 10:34 PM by Adrianis.)
03-24-2013, 10:21 PM
Find




Users browsing this thread: 5 Guest(s)