SWORD SFX
#1
Posted 04 November 2008 - 10:51 PM
can sumone submit that script in this thread? I really need it for my remake of ocarina of time. and that title screen script that plays an sfx when you press start would really be awesome. can anyone help or submit it? ill be appreciated much guys.
#2
Posted 04 November 2008 - 10:59 PM
item script SFX{
void run(){
int x = Rand(3);
if(x == 2 ){Game->PlaySound(70);}
if(x == 1 ){Game->PlaySound(71);}
if(x == 0 ){Game->PlaySound(72);}
}
}
Here.
#3
Posted 04 November 2008 - 11:16 PM
ok so im guessing ill attach it to the sword in the actions box right?
#4
Posted 05 November 2008 - 03:21 AM
void run(int a, int b, int c){
int x = Rand(3);
if(x == 2) Game->PlaySound(a);
if(x == 1) Game->PlaySound(b);
if(x == 0) Game->PlaySound(c);
}
}
That one'll use D0, D1 and D2 of the item to tell you which SFX it'll play.
#5
Posted 05 November 2008 - 04:00 AM
#6
Posted 05 November 2008 - 07:23 AM
#7
Posted 05 November 2008 - 07:41 AM
#8
Posted 05 November 2008 - 11:39 AM
const int SFX_SELECT = 0; //SFX to play when 'Start' is pressed
const int T_PRESSSTART = 0; //'Press Start' tiles to draw on screen
const int startwidth = 0; //Tilewidth of press start tiles
const int startheight = 0; //Tileheight of press start tiles
const int startcset = 0; //CSet of press start tiles
const int CMB_AUTOWARP = 0; //Combo ID of an autowarp-type combo
ffc script TitleScreen{
void run(int dly){
Waitframes(dly);
Game->PlaySound(SFX_PRESSSTART);
while(!Link->InputStart){
Screen->DrawTile(5,this->X,this->Y,T_PRESSSTART,startwidth,startheight,startcset,1,0,0,0,0,true,128);
Waitframe();
}
Game->PlaySound(SFX_SELECT);
for(int i=0;i<40;i++){
if(i%8 < 4) Screen->DrawTile(5,this->X,this->Y,T_PRESSSTART,startwidth,startheight,startcset,1,0,0,0,0,true,128);
Waitframe();
}
this->Data = CMB_AUTOWARP;
}
}
//D0 is the number of frames to wait before the 'press start' text appears.
//Place the ffc where you want the text to be
//Set up the screen's sidewarp to take you to where you want Link to go after the title screen
#9
Posted 05 November 2008 - 02:42 PM
#10
Posted 05 November 2008 - 02:50 PM
For the sake of ease of reading, I personally find it better to keep all of my globally declared variables (so anything in the file that's not a script) at the top, but that's just me.
#11
Posted 05 November 2008 - 03:20 PM
#12
Posted 05 November 2008 - 04:43 PM
bool HasFairy = true;
bool FairyInit = true;
int FairyMovementCounter;
global script Slot_2{
void run(){
int ScreenNumber;
while(true){
//Call the Fairy functions
if(HasFairy) Fairy(ScreenNumber);
//Put any other global functions here...
ScreenNumber = Game->GetCurScreen();
Waitframe();
}
}
//Fairy functions
void Fairy(int ScreenNumber){
ffc Fairy = Screen->LoadFFC(32);
bool ChangeDir;
if(FairyInit){
Fairy->Flags[0] = true;
Fairy->Flags[3] = true;
Fairy->Data = CMB_FAIRY+1;
FairyInit = false;
Fairy->X = Rand(28) + Link->X-16;
Fairy->Y = Rand(28) + Link->Y-16;
}
if(ScreenNumber != Game->GetCurScreen()){
Fairy->X = Rand(28) + Link->X-16;
Fairy->Y = Rand(28) + Link->Y-16;
}
if(FairyMovementCounter == FairyMovementMax){
Fairy->Vx = (Rand(5)/10+0.4)*(Rand(2)*2-1);
Fairy->Vy = (Rand(5)/10+0.4)*(Rand(2)*2-1);
ChangeDir = true;
FairyMovementCounter = 0;
}
if(Distance(Fairy->X,Fairy->Y,Link->X,Link->Y) > 32){
if(Fairy->X < Link->X) Fairy->Vx = (Rand(5)/10+1);
else Fairy->Vx = -(Rand(5)/10+1);
if(Fairy->Y < Link->Y) Fairy->Vy = (Rand(5)/10+1);
else Fairy->Vy = -(Rand(5)/10+1);
ChangeDir = true;
}
if(ChangeDir){
if(Fairy->Vy < 0 && (Abs(Fairy->Vx) < 0.6)) Fairy->Data = CMB_FAIRY;
else if(Fairy->Vy > 0 && (Abs(Fairy->Vx) < 0.6)) Fairy->Data = CMB_FAIRY+1;
else if(Fairy->Vx < 0) Fairy->Data = CMB_FAIRY+2;
else if(Fairy->Vx > 0) Fairy->Data = CMB_FAIRY+3;
ChangeDir = false;
}
FairyMovementCounter++;
}
}
global script Slot_3{
void run(){
if(HasFairy) FairyInit = true;
}
}
ffc script RemoveFairy{
void run(){
HasFairy = false;
ffc Fairy = Screen->LoadFFC(30);
Fairy->Data = 0;
}
}
ffc script ReturnFairy{
void run(){
HasFairy = true;
FairyInit = true;
}
}
Have a go with that one.
Oh, and dyu'think you could try to use a little more punctuation and capitalisation?
It'd make your posts that much easier to read.
#13
Posted 05 November 2008 - 08:53 PM
#14
Posted 06 November 2008 - 04:29 AM
It's quite useful to be able to read what you're saying.
Set up the integers at the start, and then stick the script called 'slot_2' onto global script slot 2, and the other one onto 'slot_3'.
If you want to get rid of the fairy for a few screens, put the 'Remove Fairy' script on that screen.
If you want to bring it back, put the 'Return Fairy' script. That's pretty much it.
#15
Posted 06 November 2008 - 04:30 AM
Sorry about that.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users