Jump to content

Photo

SWORD SFX


  • Please log in to reply
43 replies to this topic

#1 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 04 November 2008 - 10:51 PM

ok now I've seen this script in certain demos I've played like dawnlights shadow s of dawn and joe's ATTH. but I havnt been able to look for it.tried AGN but its not there.

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 Dawnlight

Dawnlight

    My name is NOT Jason!

  • Members
  • Real Name:Justin
  • Location:Chicago, IL

Posted 04 November 2008 - 10:59 PM

CODE
import "std.zh"
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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 04 November 2008 - 11:16 PM

awesome trimaster icon_biggrin.gif

ok so im guessing ill attach it to the sword in the actions box right?



#4 Joe123

Joe123

    Retired

  • Members

Posted 05 November 2008 - 03:21 AM

Yes.

CODE
item script SFX{
    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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 November 2008 - 04:00 AM

Thanks alot joe =] now i need that title screen script where when "start" is pressed it will play an sfx. Sorry to ask too much i just dont want to post two topics for 2 simple scripts icon_shrug.gif am i asking to much? icon_confused2.gif

#6 Dawnlight

Dawnlight

    My name is NOT Jason!

  • Members
  • Real Name:Justin
  • Location:Chicago, IL

Posted 05 November 2008 - 07:23 AM

Personally, if you're using it or your GB Quest, I highly recommend not to use this script.

#7 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 November 2008 - 07:41 AM

Im not actually using the link screaming everytime he slashes. Im using the diffrent slash sounds that the gameboy game uses.

#8 Joe123

Joe123

    Retired

  • Members

Posted 05 November 2008 - 11:39 AM

CODE
const int SFX_PRESSSTART    = 0; //SFX to play when the 'Press Start' text appears
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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 November 2008 - 02:42 PM

Thanks joe =) you really are a great scripter. Now i got a couple questions regarding the "constant int" do i put that up in the place where i have other constants? Or do i just copy paste the c code below import std.zh?

#10 Joe123

Joe123

    Retired

  • Members

Posted 05 November 2008 - 02:50 PM

Doesn't really matter where you put them, so long as they're in there somewhere.
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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 November 2008 - 03:20 PM

Well as long as youre organized its better than to accidentaly delete an important code. But this is awesome =) i commend your scripts lol once im almost done with the first demo ill release ill pm you for that other script i need *cough*fairy*cough* =]

#12 Joe123

Joe123

    Retired

  • Members

Posted 05 November 2008 - 04:43 PM

Oh yeah.
CODE
const int CMB_FAIRY            = 0;    // Set here the first of the 4 Fairy combos, in the order Up, Down, Left, Right
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 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 05 November 2008 - 08:53 PM

You sir are great. And oh, i just don't think that it's that important to use capilization and spelling. I mean this isn't language arts icon_razz.gif can you explain this script? I already have a headache just by looking at it. I just really suck at global scripts.

#14 Joe123

Joe123

    Retired

  • Members

Posted 06 November 2008 - 04:29 AM

Well I do.
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 Joe123

Joe123

    Retired

  • Members

Posted 06 November 2008 - 04:30 AM

Oops, must've pressed the button twice.
Sorry about that.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users