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
Exploading barrel
teddan50 Offline
Junior Member

Posts: 15
Threads: 2
Joined: Dec 2011
Reputation: 0
#1
Exploading barrel

Hello,

I am currently trying to make a script where a barrel suddenly will explode and turn into pieces.

This is my script:

void OnEnter()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Barrelscare", true, 1);
}
void Barrelscare(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_pieces_1" , true);
SetPropFade("barrel01_1", "", 0);
PlayGuiSound("break_wood_metal1", 1);


}



...and also, how do I set up messages on doors? I have managed to get a message on a locked leveldoor, but I want to show a different message when a key has been used. I also want to do the same with swingdoors.

Another problem I am also having is that I have created a "scare area" and it works fine, but when I go to a different map and go back again to the first map the "scare area" is still there. How do I make it disappear?

Hope that you guys know what to do!


(This post was last modified: 12-12-2011, 09:05 PM by teddan50.)
12-09-2011, 11:00 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Exploading barrel

(12-09-2011, 11:00 PM)teddan50 Wrote: void Barrelscare(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_pieces_1" , true);
SetPropFade("barrel01_1", "", 0);
PlayGuiSound("break_wood_metal1", 1);


}

Replace with:

PHP Code: (Select All)
void Barrelscare(string &in asParent string &in asChild int alState)
{
SetPropHealth("barrel01_1"0);


(12-09-2011, 11:00 PM)teddan50 Wrote: ...and also, how do I set up messages on doors? I have managed to get a message on a locked leveldoor, but I want to show a different message when a key has been used. I also want to do the same with swingdoors.

http://www.youtube.com/watch?v=2BNFw7PR6...8&index=11

For swing doors just put a Sign area in front of the door.

(12-09-2011, 11:00 PM)teddan50 Wrote: Another problem I am also having is that I have created a "scare area" and it works fine, but when I go to a different map and go back again to the first map the "scare area" is still there. How do I make it disappear?

Do you have it set so that the callback is to be removed upon being triggered?

Tutorials: From Noob to Pro
12-10-2011, 03:06 AM
Website Find
teddan50 Offline
Junior Member

Posts: 15
Threads: 2
Joined: Dec 2011
Reputation: 0
#3
RE: Exploading barrel

(12-10-2011, 03:06 AM)Your Computer Wrote:
(12-09-2011, 11:00 PM)teddan50 Wrote: void Barrelscare(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("barrel01_pieces_1" , true);
SetPropFade("barrel01_1", "", 0);
PlayGuiSound("break_wood_metal1", 1);


}


Replace with:

PHP Code: (Select All)
void Barrelscare(string &in asParent string &in asChild int alState

SetPropHealth("barrel01_1"0); 



(12-09-2011, 11:00 PM)teddan50 Wrote: ...and also, how do I set up messages on doors? I have managed to get a message on a locked leveldoor, but I want to show a different message when a key has been used. I also want to do the same with swingdoors.


http://www.youtube.com/watch?v=2BNFw7PR6...8&index=11

For swing doors just put a Sign area in front of the door.

(12-09-2011, 11:00 PM)teddan50 Wrote: Another problem I am also having is that I have created a "scare area" and it works fine, but when I go to a different map and go back again to the first map the "scare area" is still there. How do I make it disappear?


Do you have it set so that the callback is to be removed upon being triggered?




Thank you for your help!

I think that I have done so the callback is being removed, it works when I don't leave the map, but when I reenter the map it starts again.

AddEntityCollideCallback("Player", "ScriptArea_2", "CollideShock", true, 1);

Sure does "true" mean that the callback should be removed after being used once?
12-10-2011, 09:59 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Exploading barrel

(12-10-2011, 09:59 AM)teddan50 Wrote: I think that I have done so the callback is being removed, it works when I don't leave the map, but when I reenter the map it starts again.

AddEntityCollideCallback("Player", "ScriptArea_2", "CollideShock", true, 1);

Sure does "true" mean that the callback should be removed after being used once?

Where is that callback being set in, OnEnter or OnStart? You want it to be in OnStart. OnEnter gets called every time you enter the map. OnStart gets called when the map gets loaded within the session for the first time. You also want to think about any other callbacks you have set in OnEnter.

Tutorials: From Noob to Pro
12-10-2011, 11:09 AM
Website Find
ferryadams10 Offline
Senior Member

Posts: 288
Threads: 40
Joined: Apr 2011
Reputation: 19
#5
RE: Exploading barrel

Maybe you should add some impulse to it and make a small explosion particle system.

Got a nice sofa
Please come and have a seat for a while

12-10-2011, 11:12 AM
Find
teddan50 Offline
Junior Member

Posts: 15
Threads: 2
Joined: Dec 2011
Reputation: 0
#6
RE: Exploading barrel

(12-10-2011, 11:09 AM)Your Computer Wrote:
(12-10-2011, 09:59 AM)teddan50 Wrote: I think that I have done so the callback is being removed, it works when I don't leave the map, but when I reenter the map it starts again.

AddEntityCollideCallback("Player", "ScriptArea_2", "CollideShock", true, 1);

Sure does "true" mean that the callback should be removed after being used once?


Where is that callback being set in, OnEnter or OnStart? You want it to be in OnStart. OnEnter gets called every time you enter the map. OnStart gets called when the map gets loaded within the session for the first time. You also want to think about any other callbacks you have set in OnEnter.



I had it on OnEnter, but now when I have it on OnStart it works perfectly!

Thanks alot!


(12-10-2011, 11:12 AM)ferryadams10 Wrote: Maybe you should add some impulse to it and make a small explosion particle system.


What exactly do you mean? I am new to scripting, so please explain!

I have added sanitydamage if that's what you mean?
(This post was last modified: 12-10-2011, 05:17 PM by teddan50.)
12-10-2011, 05:15 PM
Find
ferryadams10 Offline
Senior Member

Posts: 288
Threads: 40
Joined: Apr 2011
Reputation: 19
#7
RE: Exploading barrel

(12-10-2011, 05:15 PM)teddan50 Wrote:
(12-10-2011, 11:09 AM)Your Computer Wrote:
(12-10-2011, 09:59 AM)teddan50 Wrote: I think that I have done so the callback is being removed, it works when I don't leave the map, but when I reenter the map it starts again.

AddEntityCollideCallback("Player", "ScriptArea_2", "CollideShock", true, 1);

Sure does "true" mean that the callback should be removed after being used once?


Where is that callback being set in, OnEnter or OnStart? You want it to be in OnStart. OnEnter gets called every time you enter the map. OnStart gets called when the map gets loaded within the session for the first time. You also want to think about any other callbacks you have set in OnEnter.



I had it on OnEnter, but now when I have it on OnStart it works perfectly!

Thanks alot!


(12-10-2011, 11:12 AM)ferryadams10 Wrote: Maybe you should add some impulse to it and make a small explosion particle system.


What exactly do you mean? I am new to scripting, so please explain!

I have added sanitydamage if that's what you mean?


I mean it just like I say. Script an impulse to it and ask some experienced person for making an small explosion particle.

Got a nice sofa
Please come and have a seat for a while

12-10-2011, 05:20 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Exploading barrel

Impulses are unnecessary when entities are broken through loss of health.

Tutorials: From Noob to Pro
12-11-2011, 05:53 AM
Website Find




Users browsing this thread: 2 Guest(s)