Playsound
Started by
Joe123
, Sep 23 2007 06:14 AM
9 replies to this topic
#1
Posted 23 September 2007 - 06:14 AM
How does the Playsound command work? I've been messing with it for a while, but I can't seem to get it to compile, my syntax is terrible.
I want a script that plays the secret sound effect when you trigger a perm. trigger. I'm quite confident I'd be able to do it (I think), but I just can't get the command to work.
I want a script that plays the secret sound effect when you trigger a perm. trigger. I'm quite confident I'd be able to do it (I think), but I just can't get the command to work.
#2
Posted 23 September 2007 - 07:50 AM
Use:
Game -> PlaySound(n);
where n is the reference to the sound you want to play.
Game -> PlaySound(n);
where n is the reference to the sound you want to play.
#3
Posted 23 September 2007 - 08:11 AM
Thankyou NoeL
And I wrote my first script
Rather basic but there we go
And I wrote my first script
CODE
ffc script sound_effect{
void run(int SFX){
Game -> PlaySound(SFX);
}
}
void run(int SFX){
Game -> PlaySound(SFX);
}
}
Rather basic but there we go
#4
Posted 23 September 2007 - 08:18 AM
... why did you make SFX a parameter though? As far as I'm aware no data is passed into the "run" function.
I would have used something like
I would have used something like
CODE
ffc script sound_effect
{
void run()
{
int SFX;
// some code here to set the appropriate sound
Game -> PlaySound(SFX);
}
}
{
void run()
{
int SFX;
// some code here to set the appropriate sound
Game -> PlaySound(SFX);
}
}
Edited by NoeL, 23 September 2007 - 08:20 AM.
#5
Posted 23 September 2007 - 08:23 AM
So that it's an argument in the FFC, so I don't have to rewrite the whole script if I want to use a different SFX. If you set integers in the void run command, they're variables that you define via the arguments in the FFC.
#6
Posted 23 September 2007 - 08:27 AM
Ah cool! Thanks, I was wondering how to access those arguments I feel silly now, I should have thought of that.
#7
Posted 23 September 2007 - 09:22 AM
Good job joe! It's not so bad, right!?
Here's one thing you should know. That ffc will run once and then stop.
This one will keep playing the sound whenever conditions are met. Although you're going to have to change it a bit.
And post some script stuff at AGN, the scripting forum needs some livening up!
Here's one thing you should know. That ffc will run once and then stop.
CODE
ffc script playsound{
void run(int sfx, int sfx2){
// here's one idea,
//in a boss battle play a sound if link gets hit or link hits the boss
int boss = LoadNPC(1);
int hurt = Link->HP;
while (true){
if( Link->HP<hurt){
Game->PlaySound(0);
hurt = Link->HP;
}
if(boss->HP<MaxHP){
Game->PlaySound(0);
boss->MaxHP = boss->HP;
}
Waitframe();
}
}
}
}
//Loads of other cool ways to change what sound plays too. What'd you have in mind?
void run(int sfx, int sfx2){
// here's one idea,
//in a boss battle play a sound if link gets hit or link hits the boss
int boss = LoadNPC(1);
int hurt = Link->HP;
while (true){
if( Link->HP<hurt){
Game->PlaySound(0);
hurt = Link->HP;
}
if(boss->HP<MaxHP){
Game->PlaySound(0);
boss->MaxHP = boss->HP;
}
Waitframe();
}
}
}
}
//Loads of other cool ways to change what sound plays too. What'd you have in mind?
This one will keep playing the sound whenever conditions are met. Although you're going to have to change it a bit.
And post some script stuff at AGN, the scripting forum needs some livening up!
#8
Posted 23 September 2007 - 01:07 PM
I have been! noone replies
And thanks for that, but I only needed a SFX to play when I entered the screen anyway. And you can change the noise that a boss makes when it gets hurt via the SFX editor nowadays without needing a script
And thanks for that, but I only needed a SFX to play when I entered the screen anyway. And you can change the noise that a boss makes when it gets hurt via the SFX editor nowadays without needing a script
#9
Posted 24 September 2007 - 01:07 AM
I have been! noone replies
And thanks for that, but I only needed a SFX to play when I entered the screen anyway. And you can change the noise that a boss makes when it gets hurt via the SFX editor nowadays without needing a script
Ah, but what about them ffc or custom bosses, plus I think a boss that says something everytime he hurts Link would be neat.
QUOTE
I have been! noone replies
Huh?! Maybe I missed it then...
#10
Posted 24 September 2007 - 10:46 AM
I'm the last person to post on two of the scripting forums over at AGN, and have been for 3 days on one of them and 4 on the other
Although I think scripting custom bosses is a little advanced for me...
Although I think scripting custom bosses is a little advanced for me...
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users