Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 2 Votes - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Piano Scare script
Author Message
Bors Offline
Junior Member

Posts: 6
Joined: Feb 2012
Reputation: 0
Post: #1
Piano Scare script
So, i have a problem with a script. (im not getting errors). Dodgy

the script should do like this, the piano plays a song in a loop, but when you enter an a script area it will stop play and it will slam with dust comming.

The music loop works but not the slam and the dust particels. (sorry for bad english) Tongue

So here is the Script=

void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", 0, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "st_impact.ps", "impact", false);
}
(This post was last modified: 02-04-2012 05:41 PM by Bors.)
02-04-2012 05:29 PM
Find all posts by this user Quote this message in a reply
S4n1tyM0rs0 Offline
Junior Member

Posts: 14
Joined: Feb 2012
Reputation: 0
Post: #2
RE: Piano Scare script problem.
void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
02-04-2012 05:41 PM
Find all posts by this user Quote this message in a reply
Bors Offline
Junior Member

Posts: 6
Joined: Feb 2012
Reputation: 0
Post: #3
RE: Piano Scare script problem.
(02-04-2012 05:41 PM)S4n1tyM0rs0 Wrote:  void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
yes you have right i think, i did test but it still didnt work :/

thanks for the help tho.
02-04-2012 05:46 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #4
RE: Piano Scare script
player has to be with capital letter Player, I think Smile

The Interrogation
Chapter 1

My tutorials
02-04-2012 09:45 PM
Find all posts by this user Quote this message in a reply
Ninami Offline
Member

Posts: 59
Joined: Feb 2012
Reputation: 2
Post: #5
RE: Piano Scare script
PHP Code: (Select All)
void OnStart()
{
AddTimer("pianotimer"0"pianotimer");
AddEntityCollideCallback("player""pianostop""pianostop"true1);


is the name for the Area that stops the music "pianostop"?

If it is then you should try changing the name since you have 1 function and 1 area with the same name.
(This post was last modified: 02-04-2012 09:53 PM by Ninami.)
02-04-2012 09:52 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #6
RE: Piano Scare script
That cant be problem Smile. Function and area name can be same. I use that method a lot, since I am lazy to think new names Tongue.

The Interrogation
Chapter 1

My tutorials
02-04-2012 10:03 PM
Find all posts by this user Quote this message in a reply
Ninami Offline
Member

Posts: 59
Joined: Feb 2012
Reputation: 2
Post: #7
RE: Piano Scare script
Oh didn't know that Tongue Sorry for misleading hah
02-05-2012 01:20 PM
Find all posts by this user Quote this message in a reply
Elven Offline
Posting Freak

Posts: 868
Joined: Aug 2011
Reputation: 26
Post: #8
RE: Piano Scare script
NP, we all study one or two things Smile

The Interrogation
Chapter 1

My tutorials
02-05-2012 02:07 PM
Find all posts by this user Quote this message in a reply
Bors Offline
Junior Member

Posts: 6
Joined: Feb 2012
Reputation: 0
Post: #9
RE: Piano Scare script
Its now fixed! Big Grin thanks for everything tho Big Grin
02-05-2012 10:22 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)