Jump to content

Photo

SWORD SFX


  • Please log in to reply
43 replies to this topic

#31 Joe123

Joe123

    Retired

  • Members

Posted 08 November 2008 - 05:24 AM

Well I just tested it and it compiled fine, so you're doing something wrong.

You haven't copied in the bool at the top called 'ComboFI' into your file, and the 'StringOnce' declaration is a different script entirely.
That's from the message string script.

#32 Christian

Christian

    Summoner

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

Posted 08 November 2008 - 06:23 AM

Hmmm... It wouldnt compile. I added bool stringonce[20]; that was fine. But then screennumber was undeclared and added bool screennumber=true; and bool fairyinit=true; and then compiled. I dont have the fairy now!

#33 Joe123

Joe123

    Retired

  • Members

Posted 08 November 2008 - 06:24 AM

ScreenNumber is an integer, not a bool.

#34 Christian

Christian

    Summoner

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

Posted 08 November 2008 - 07:17 AM

Wait i found the problem everything works fine now =] thanks alot joe for your time and help. I think i learned a tiny bit of global scripts in this thread by you. You really are an amazing scripter =p

#35 Christian

Christian

    Summoner

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

Posted 08 November 2008 - 07:18 AM

Wait i found the problem everything works fine now =] thanks alot joe for your time and help. I think i learned a tiny bit of global scripts in this thread by you. You really are an amazing scripter =p

#36 Joe123

Joe123

    Retired

  • Members

Posted 08 November 2008 - 07:33 AM

No problem.
Glad it works.

Also, try not to press the 'Add Reply' button twice if it's not working ;-)
Patience is a virtue.

#37 sigtau

sigtau

    *sip*

  • Members
  • Real Name:Will
  • Location:Spending too much time on this damn thing

Posted 08 November 2008 - 11:24 PM

QUOTE(Joe123 @ Nov 7 2008, 10:34 AM) View Post

How much do you already know?


I still have trouble compiling scripts these days, even in the latest betas... I don't want anything special, just a fairy behind Link.

#38 Christian

Christian

    Summoner

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

Posted 09 November 2008 - 04:38 AM

Joe, would
CODE
const int FairyCset=0; //put here the cset you want the fairy to be
change the color of the fairy to the cset you want it to be? I dont know was just a suggestion.icon_shrug.gif

#39 Joe123

Joe123

    Retired

  • Members

Posted 09 November 2008 - 04:43 AM

Right then.
So what you need to do is...

Copy this script into a notepad document with the first line saying
CODE
import "std.zh"


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;
int FairyMovementMax = 30;

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;
    }
}


Save it as a.z filetype.
If you have any other scripts apart from these, be sure to keep them all in the same file.

Then, go to the top of the script, and you'll see a number with a note about what it does.
Go to your combopage, and set up your fairy tiles adjacent in this order:
Up, Down, Left, Right.
Set the noted number at the top of the script to be the Combo ID Number of the Up facing fairy combo.

Then save the file, and go to ZQuest.
Quest->Scripts->Compile ZScript.
Click on 'Import' and find your file, and then press 'OK', and 'Compile'.
That'll take you to the assign compiled script dialogue.
Assign the ffc scripts to a slot each, and then click the 'global' tab.
Assign the script called 'Slot_2' to the second slot, and 'Slot_3' to the third slot.
Then press ok, and that's pretty much all there is to it.

The only other thing is those ffc scripts.
They're pretty self-explanitory.
If you want to get rid of the fairy for a few screens (say, for a cutscene or summat), put the 'RemoveFairy' script on the screen. When you want to bring it back, put the 'ReturnFairy' script.

#40 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 10 November 2008 - 10:38 PM

I have a question: Do you start the game with the fairy? Or do you just put the remove fairy script on the first screen?

#41 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 10 November 2008 - 11:24 PM

As it is now, you start with the fairy. If you don't want this to occur, just change the line "bool HasFairy=true;" at the top of the script to "bool HasFairy=false;". Then just use the ReturnFairy script to give Link the fairy for the first time, and everything else will be the same.

#42 Christian

Christian

    Summoner

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

Posted 11 November 2008 - 10:06 PM

correct. but there's no point of doing that though. just put the remove fairy ffc script to the screens where you don't want the fairy to be.. I find it easier and less confusing to people who don't have enough knowledge about zscript.

#43 Joe123

Joe123

    Retired

  • Members

Posted 12 November 2008 - 04:22 AM

That's great for removing the fairy on certain screens, but if you want the player not to start off with it you'll have to do it Elmensajero's way.

#44 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 12 November 2008 - 04:03 PM

QUOTE(Elmensajero @ Nov 10 2008, 10:24 PM) View Post

As it is now, you start with the fairy. If you don't want this to occur, just change the line "bool HasFairy=true;" at the top of the script to "bool HasFairy=false;". Then just use the ReturnFairy script to give Link the fairy for the first time, and everything else will be the same.

Sounds simple enough. Thanks! icon_biggrin.gif


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users