Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Wooden Board Block destroy script
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#1
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
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
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:

PHP Code: (Select All)
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: (Select All)
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.
(This post was last modified: 05-24-2014, 11:51 AM by DnALANGE.)
05-24-2014, 11:35 AM
Find
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#3
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
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
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 Smile

PHP Code: (Select All)
void OnStart() 

Discord: Romulator#0001
[Image: 3f6f01a904.png]
05-24-2014, 12:30 PM
Find
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#5
RE: Wooden Board Block destroy script

Thank you! I forgot about that.
05-24-2014, 12:33 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: Wooden Board Block destroy script

No problems! We're here to help Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
05-24-2014, 12:41 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#7
RE: Wooden Board Block destroy script

oh yeah..
the brackets Wink
I thought you had that up already Tongue
Did it work?
05-24-2014, 02:08 PM
Find




Users browsing this thread: 1 Guest(s)