Frictional Games Forum (read-only)
Exploading barrel - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Exploading barrel (/thread-11770.html)



Exploading barrel - teddan50 - 12-09-2011

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!





RE: Exploading barrel - Your Computer - 12-10-2011

(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:
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=2BNFw7PR6d4&list=PLD326789BC99530C8&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?


RE: Exploading barrel - teddan50 - 12-10-2011

(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:
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=2BNFw7PR6d4&list=PLD326789BC99530C8&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?



RE: Exploading barrel - Your Computer - 12-10-2011

(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.


RE: Exploading barrel - ferryadams10 - 12-10-2011

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


RE: Exploading barrel - teddan50 - 12-10-2011

(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?



RE: Exploading barrel - ferryadams10 - 12-10-2011

(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.


RE: Exploading barrel - Your Computer - 12-11-2011

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