MaksoPL
Member
Posts: 51
Threads: 26
Joined: Mar 2014
Reputation:
0
|
Wooden Board Block destroy script
Hi, I need to make a script so that I can hammer to destroy the boards on the transition to my custom story.
|
|
05-24-2014, 11:20 AM |
|
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
|
RE: Wooden Board Block destroy script
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:
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 )
void ActivateBrokenBoards(string &in asItem, string &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.0f, false); PlaySoundAtEntity("", "break_wood.snt", "Player", 0.0f, true); }
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.
(This post was last modified: 05-24-2014, 11:51 AM by DnALANGE.)
|
|
05-24-2014, 11:35 AM |
|
MaksoPL
Member
Posts: 51
Threads: 26
Joined: Mar 2014
Reputation:
0
|
RE: Wooden Board Block destroy script
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 "(".
(This post was last modified: 05-24-2014, 12:25 PM by MaksoPL.)
|
|
05-24-2014, 12:20 PM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Wooden Board Block destroy script
(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
Discord: Romulator#0001
|
|
05-24-2014, 12:30 PM |
|
MaksoPL
Member
Posts: 51
Threads: 26
Joined: Mar 2014
Reputation:
0
|
RE: Wooden Board Block destroy script
Thank you! I forgot about that.
|
|
05-24-2014, 12:33 PM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Wooden Board Block destroy script
No problems! We're here to help
Discord: Romulator#0001
|
|
05-24-2014, 12:41 PM |
|
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
|
RE: Wooden Board Block destroy script
oh yeah..
the brackets
I thought you had that up already
Did it work?
|
|
05-24-2014, 02:08 PM |
|
|