Jump to content

Photo

Master Sword Pedestal Sign


  • Please log in to reply
6 replies to this topic

#1 lucas92

lucas92

    Defender

  • Members

Posted 19 October 2008 - 05:49 PM

Anyway, here it is:

CODE

const int ClimbingFlag = 99;
const int Gift1Data = 53040;
const int Gift2Data = 53041;
const int Gift3Data = 53042;
const int Gift1Cset = 7;
const int Gift2Cset = 8;
const int Gift3Cset = 9;
const int booktile = 705;
const int LinkStandingOneHand = 33;
const int LinkStandingTwoHands = 32;
const int BookSecretSound = 60;
const int BookItemId=123;

ffc script masterswordsign
{
    void run(int m, int m2)
    {
        while(true)
        {
            while(Link->X < this->X - 8 || Link->X > this->X + 24 || Link->Y < this->Y || Link->Y > this->Y + 24 || Link->Dir != DIR_UP || !Link->InputA)
            {
                Waitframe();
            }
            Link->InputA = false;
            Screen->Message(m);
            Waitframe();
            if (Link->Item[32]==true)
            {
                float x; float y;
                Link->Action=3;
                Link->X=x; Link->Y=y;
                Link->X=240;Link->Y=0; //Link disappears. :)
                Screen->DrawTile(3, x, y, LinkStandingTwoHands, 1, 1, 6,0,0,0,0,0, false, 128); //The tile where Link hold up two hands doesn't appear...doesn't appear... :(
                Screen->DrawTile(3, x, y+16, booktile, 1, 1,6, 0, 0, 0, 0,0, false, 128);//the tile of the book doesn't appear... :(
                Waitframes(180);
                Screen->Message(m2);//the message shows up :)
                Waitframes(180);
                Game->PlaySound(BookSecretSound);//we can hear the sound :)
                Screen->DrawTile(3,x-16,y+16, Gift1Data, 1,1, Gift1Cset,0,0,0,0,0,false,128); //Three stones are supposed to be above Link head but unfortunately they don't appear... :(
                Screen->DrawTile(3,x,y+16, Gift2Data, 1,1, Gift2Cset,0,0,0,0,0,false,128);
                Screen->DrawTile(3,x+16,y+16, Gift3Data, 1,1, Gift3Cset,0,0,0,0,0,false,128);
                Screen->Rectangle(5, 0, 0, 300, 200, 0, 0, 0, 0, 0, true, 128);
                for (int radius=200;radius==64;radius--) //I wanted to black out the screen and make a transparent circle that is diminished in size so we can see Link just like in LTTP (when he enters a house for example), but that part is ignored completely... :(
                {
                    Screen->Circle(5, x, y, radius, 0, 0, 0, 0, 0, true,64);
                }
                    ffc mastersword=Screen->LoadFFC(2); //I wanted that the master sword appear in the air, then moves down and stops at Link->Y-16 but that part is also ignored completely... :(
                    while(Screen->NumItems()==0)
                    {
                        int yM;
                        for(yM=mastersword->Y;yM==Link->Y-16;mastersword->Vy=1){}
                        Screen->CreateItem(6); //that would make appear the master sword just under Link but didn't worked...
                        Link->X=x;Link->Y=y;
                        Quit();
                    }
            }
            else
                {
                    while(Link->X >= this->X - 8 && Link->X <= this->X + 24 && Link->Y >= this->Y && Link->Y <= this->Y + 24 && Link->Dir == DIR_UP)
                    {
                        Waitframe();
                    }
                    Screen->Message(0);
                }
        }
    }
}


It is like the sign script, but when you've got a specific object, an another message appear. Just like when in LTTP when you read a sign with the book. And just like in ocarina of time, if you have the three stones, they show up above Link's head and then it gives you the master sword... but didn't work... but it isn't buggy so I'm sure it can be fixed easily...

#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 20 October 2008 - 11:49 AM

QUOTE
CODE
                Link->X=x; Link->Y=y;
You've got your assigments backwards. That's probably the cause of most of the problems.

QUOTE
CODE
                        Screen->CreateItem(6); //that would make appear the master sword just under Link but didn't worked...

The item is created at (0,0). Try this:
CODE
item sword=Screen->CreateItem(6);
sword->X=Link->X;
sword->Y=Link->Y;



See how it goes with those fixed.

#3 lucas92

lucas92

    Defender

  • Members

Posted 20 October 2008 - 02:40 PM

So it would be x=Link->X;y=Link->Y? Ok. thanks. icon_smile.gif

Nah it's still not working... icon_frown.gif

CODE
ffc script masterswordsign
{
    void run(int m, int m2)
    {
        while(true)
        {
            while(Link->X < this->X - 8 || Link->X > this->X + 24 || Link->Y < this->Y || Link->Y > this->Y + 24 || Link->Dir != DIR_UP || !Link->InputA)
            {
                Waitframe();
            }
            Link->InputA = false;
            Screen->Message(m);
            Waitframe();
            if (Link->Item[32]==true)
            {
                float x; float y;
                Link->Action=3;
                Link->X=240;Link->Y=0;
                x=120;y=104;
                Waitframe();
                Screen->DrawTile(3, x, y, LinkStandingTwoHands, 1, 1, 6,1,0,0,0,0, true, 128);
                Screen->DrawTile(3, x, y+16, booktile, 1, 1,6, 1, 0, 0, 0,0, true, 128);
                Waitframes(180);
                Screen->Message(m2);
                Waitframes(180);
                Game->PlaySound(BookSecretSound);
                Screen->DrawTile(3,x-16,y+16, Gift1Data, 1,1, Gift1Cset,1,0,0,0,0,true,128);
                Screen->DrawTile(3,x,y+16, Gift2Data, 1,1, Gift2Cset,1,0,0,0,0,true,128);
                Screen->DrawTile(3,x+16,y+16, Gift3Data, 1,1, Gift3Cset,1,0,0,0,0,true,128);
                Screen->Rectangle(5, 0, 0, 300, 200, 0, 0, 0, 0, 0, true, 128);
                for (int radius=200;radius==64;radius--)
                {
                    Screen->Circle(5, x, y, radius, 0, 0, 0, 0, 0, true,64);
                }
                    ffc mastersword=Screen->LoadFFC(2);
                    while(Screen->NumItems()==0)
                    {
                        int yM;
                        for(yM=mastersword->Y;yM==Link->Y-16;mastersword->Vy=1){}
                        Link->X=x;Link->Y=y;
                        item sword=Screen->CreateItem(6);
                        sword->X=Link->X;
                        sword->Y=Link->Y;
                        Quit();
                    }
            }
            else
                {
                    while(Link->X >= this->X - 8 && Link->X <= this->X + 24 && Link->Y >= this->Y && Link->Y <= this->Y + 24 && Link->Dir == DIR_UP)
                    {
                        Waitframe();
                    }
                    Screen->Message(0);
                }
        }
    }
}


Updated code.The tiles don't even draw on the screen...We heard the sound and see the second message... And it returns back Link to its position after the script has finished working.... That's all it does for the moment... icon_frown.gif

Edited by lucas92, 20 October 2008 - 03:15 PM.


#4 Saffith

Saffith

    IPv7 user

  • Members

Posted 20 October 2008 - 05:25 PM

Ah, of course...
QUOTE
CODE
Screen->DrawTile(3, x, y, LinkStandingTwoHands, 1, 1, 6,1,0,0,0,0, true, 128);
Screen->DrawTile(3, x, y+16, booktile, 1, 1,6, 1, 0, 0, 0,0, true, 128);
Waitframes(180);

Most likely, it is actually drawing the tile, but it's gone so fast you don't notice. It only draws the tile for one frame, see. Try this instead:
CODE
for(int i=0; i<180; i++)
{
    Screen->DrawTile(3, x, y, LinkStandingTwoHands, 1, 1, 6,1,0,0,0,0, true, 128);
    Screen->DrawTile(3, x, y+16, booktile, 1, 1,6, 1, 0, 0, 0,0, true, 128);
    Waitframe();
}

Same thing for the next bunch and the Rectangle().


By the way, I didn't think this part through before:
CODE
item sword=Screen->CreateItem(6);
sword->X=Link->X;
sword->Y=Link->Y;

Are you just trying to give Link the sword? Because if that's the case, it'd be easier to use Link->Item[6]=true;

#5 lucas92

lucas92

    Defender

  • Members

Posted 20 October 2008 - 06:53 PM

Oh... That's the point I was missing... icon_razz.gif

I'll try it out. icon_smile.gif

#6 Christian

Christian

    Summoner

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

Posted 03 December 2008 - 05:12 AM

QUOTE(Saffith @ Oct 20 2008, 05:25 PM) View Post

Ah, of course...

Most likely, it is actually drawing the tile, but it's gone so fast you don't notice. It only draws the tile for one frame, see. Try this instead:
CODE
for(int i=0; i<180; i++)
{
    Screen->DrawTile(3, x, y, LinkStandingTwoHands, 1, 1, 6,1,0,0,0,0, true, 128);
    Screen->DrawTile(3, x, y+16, booktile, 1, 1,6, 1, 0, 0, 0,0, true, 128);
    Waitframe();
}

Same thing for the next bunch and the Rectangle().
By the way, I didn't think this part through before:
CODE
item sword=Screen->CreateItem(6);
sword->X=Link->X;
sword->Y=Link->Y;

Are you just trying to give Link the sword? Because if that's the case, it'd be easier to use Link->Item[6]=true;


Hmm..interesting.
Do we need to put the for check on top of the screen drawtile? What if we just make it wait on wait frames? Then the drawting tile on screen finishes icon_shrug.gif

Wait,nevermind...
Its another type of waitframe.
So we put in the for check to check the amount of time the screen draws the tile until "int I" hits 180.
It will be best if you set comments on each line of your script to explain what you are doing. That way people will understand zscript even more.
That's what I do.

#7 Joe123

Joe123

    Retired

  • Members

Posted 04 December 2008 - 01:48 PM

for isn't a check.

if is a 'check', and while is a 'check', but for does more than just check.

for is set up (generally) to loop a block of code a certain amount of times.
It's something that you always want to run a certain number of times. So it's not really a 'check', because you know how many times it's going to run that code. Obviously it does check something (in this case, it checks whether i is less than 180), but it's not really used because it can 'check', that's just a part of how it works.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users