Frictional Games Forum (read-only)
[SCRIPT] Wooden Board Block destroy script - 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: [SCRIPT] Wooden Board Block destroy script (/thread-25354.html)



Wooden Board Block destroy script - MaksoPL - 05-24-2014

Hi, I need to make a script so that I can hammer to destroy the boards on the transition to my custom story.


RE: Wooden Board Block destroy script - DnALANGE - 05-24-2014

That is not so easy to explane but here we go.
You need to have a couple of things here :
1: Open the level editor and add the "wooden_boards_block"
2: Open the level editor and add the "wooden_boards_block_broke" (at the same spot offcourse) <-- Make this UNACTIVE in the level editor
3:Add a hammer in your lvl editor and name it Hammer_1 ( i assume the hammer is an item )
4:Here is the script you should put on OnStart:

PHP Code:
AddUseItemCallback("""Hammer_1""wooden_boards_block""ActivateBrokenBoards"false); 

5:Here is the script you can use. ( you can change or add stuff at your own will )
PHP Code:
void ActivateBrokenBoards(string &in asItemstring &in asEntity)
{
SetEntityActive("wooden_boards_block"false);
SetEntityActive("wooden_boards_block_broke"true);
RemoveItem("Hammer_1");
GiveSanityBoostSmall();
CreateParticleSystemAtEntity("""ps_cog_stone.ps""BoardParticles"false);
CreateParticleSystemAtEntity("""ps_break_mansionbase_wall.ps""BoardParticles"false);
PlaySoundAtEntity("""player_crouch""Player"0.0ffalse);    
PlaySoundAtEntity("""break_wood.snt""Player"0.0ftrue);


If you want, you can add some particles to it.
Then simply add 1 ScriptArea called : BoardParticles in the middle of the wooden boards.
I have added the particle effect in your script already.
---
IF you want to make it like, you want to see a hammer moving...
Then it is a little\lot more complicated.
Let us know if you want it like this or with a moving visable hammer.


RE: Wooden Board Block destroy script - MaksoPL - 05-24-2014

My script to that:
void OnStart
{
AddUseItemCallback("","ham1","board1","ActivateBrokenBoards",false);
}
void ActivateBrokenBoards(string &in asItem, string &in asEntity)
{
SetEntityActive("board1",false);
SetEntityActive("boardb1",true);
RemoveItem("Ham1");
GiveSanityBoostSmall();
CreateParticleSystemAtEntity("","ps_cog_stone.ps","BoardParticles", false);
CreateParticleSystemAtEntity("","ps_break_mansionbase_wall.ps","BoardParticles",false);
PlaySoundAtEntity("","player_crouch","Player",0.0f,false);
PlaySoundAtEntity("","break_wood.snt","Player",0.0f,true);
}

And i testing map: main (2,1) : Err :Expected "(".


RE: Wooden Board Block destroy script - Romulator - 05-24-2014

(05-24-2014, 12:20 PM)MaksoPL Wrote: My script to that:
void OnStart
{
AddUseItemCallback("","ham1","board1","ActivateBrokenBoards",false);
}
void ActivateBrokenBoards(string &in asItem, string &in asEntity)
{
SetEntityActive("board1",false);
SetEntityActive("boardb1",true);
RemoveItem("Ham1");
GiveSanityBoostSmall();
CreateParticleSystemAtEntity("","ps_cog_stone.ps","BoardParticles", false);
CreateParticleSystemAtEntity("","ps_break_mansionbase_wall.ps","BoardParticles",false);
PlaySoundAtEntity("","player_crouch","Player",0.0f,false);
PlaySoundAtEntity("","break_wood.snt","Player",0.0f,true);
}

And i testing map: main (2,1) : Err :Expected "(".

OnStart needs brackets Smile

PHP Code:
void OnStart() 



RE: Wooden Board Block destroy script - MaksoPL - 05-24-2014

Thank you! I forgot about that.


RE: Wooden Board Block destroy script - Romulator - 05-24-2014

No problems! We're here to help Smile


RE: Wooden Board Block destroy script - DnALANGE - 05-24-2014

oh yeah..
the brackets Wink
I thought you had that up already Tongue
Did it work?