Jump to content

Photo

I need some help


  • Please log in to reply
20 replies to this topic

#16 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 23 July 2008 - 11:47 AM

The shop script uses an FFC for each individual item- meaning you could put 32 items in a shop if you wanted to. And it would help BOTH of us A LOT if you gave us more details. The way you presented your needs just makes you sound helpless and stupid, which I'm sure you aren't.

The details I'm looking for are: WHICH shop script, (there are like 3 versions which are each set up differently) and WHICH ladder script? (sideview ladder, general climbing, etc..?) If you had given those details earlier, I would have had no need to be rude and would have been happy to help.

#17 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 24 July 2008 - 08:53 PM

QUOTE(Beefster @ Jul 23 2008, 11:47 AM) View Post

The shop script uses an FFC for each individual item- meaning you could put 32 items in a shop if you wanted to. And it would help BOTH of us A LOT if you gave us more details. The way you presented your needs just makes you sound helpless and stupid, which I'm sure you aren't.

The details I'm looking for are: WHICH shop script, (there are like 3 versions which are each set up differently) and WHICH ladder script? (sideview ladder, general climbing, etc..?) If you had given those details earlier, I would have had no need to be rude and would have been happy to help.

Looking back on my posts I was a little stupid. icon_razz.gif

The Climbing Script is for general climbing in overhead view.

Here it is: (Copied and pasted from Fort Knights...
CODE

ffc script climbing{
    void run(int speed, int combotype , int dummy){
        int framedelay;
        if(combotype == 0){combotype = 11;}
        if(speed == 0){speed = 1;}
        if(dummy == 0){dummy = 123;}
        while(true){
            if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+9)] == combotype && Link->Z == 0){
                if(!Link->Item[dummy]){ Link->Item[dummy] = true;}
                if(Link->InputLeft && Link->Dir == DIR_LEFT){
                    if(framedelay == speed){Link->X = Link->X+1; framedelay = 0;}
                    else{framedelay++;}
                }
                if(Link->InputRight && Link->Dir == DIR_RIGHT){
                if(framedelay == speed){Link->X = Link->X-1; framedelay = 0;}
                    else{framedelay++;}
                }
                if(Link->InputUp && Link->Dir == DIR_UP){
                    if(framedelay == speed){Link->Y = Link->Y+1; framedelay = 0;}
                    else{framedelay++;}
                }
                if(Link->InputDown && Link->Dir == DIR_DOWN){
                    if(framedelay == speed){Link->Y = Link->Y-1; framedelay = 0;}
                    else{framedelay++;}
                }
                Link->InputA = false;
                Link->InputB = false;
                Link->InputL = false;
            }else{if(Link->Item[dummy]){ Link->Item[dummy] = false;}
            }
        Waitframe();
        }
    }
}


The shop script is by Matthew.
CODE

//this script, by MatthewPZC, runs the shop in Eyrus Village
ffc script shop{
    void run(int item1, int item2, int item3, int price5, int price1, int price2, int price3, int price4){
        int nobuy = 0;
        int wait = 1;
        while(true){
            ffc buy1 = Screen->LoadFFC(31);
            ffc buy2 = Screen->LoadFFC(30);
            ffc buy3 = Screen->LoadFFC(29);
            ffc buy4 = Screen->LoadFFC(28);
            ffc buy5 = Screen->LoadFFC(32);
            while((Link->X > buy1->X-4 && Link->X < buy1->X+4) && Link->Y == buy1->Y){
                while(Link->InputL){
                    if(nobuy == 0 && Game->Counter[1] >= price1 && Link->Dir == 0){
                        nobuy = 1;
                        Screen->Message(28);
                        Link->Item[item1] = true;
                        Game->PlaySound(25);
                        Waitframe();
                        Screen->Message(51);
                        int drainwait = price1;
                        while(drainwait > 0){
                            Game->PlaySound(18);
                            Game->Counter[1] -= 1;
                            drainwait -= 1;
                            Waitframe();
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price1 && Link->Dir == 0){
                        Screen->Message(nerm);
                        nobuy = 1;
                    }
                    Waitframe();
                }
                if(!Link->InputL){
                    nobuy = 0;
                }
                Waitframe();
            }
            while((Link->X > buy2->X-4 && Link->X < buy2->X+4) && Link->Y == buy2->Y){
                while(Link->InputL){
                    if(nobuy == 0 && Game->Counter[1] >= price2 && Link->Dir == 0){
                        nobuy = 1;
                        Screen->Message(28);
                        Link->Item[item2] = true;
                        Waitframe();
                        Game->PlaySound(25);
                        Screen->Message(52);
                        int drainwait = price2;
                        while(drainwait > 0){
                            Game->PlaySound(18);
                            Game->Counter[1] -= 1;
                            drainwait -= 1;
                            Waitframe();
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price2 && Link->Dir == 0){
                        Screen->Message(nerm);
                        nobuy = 1;
                    }
                    Waitframe();
                }
                if(!Link->InputL){
                    nobuy = 0;
                }
                Waitframe();
            }
            while((Link->X > buy3->X-4 && Link->X < buy3->X+4) && Link->Y == buy3->Y){
                while(Link->InputL){
                    if(nobuy == 0 && Game->Counter[1] >= price3 && Link->Dir == 0){
                        nobuy = 1;
                        Screen->Message(28);
                        if(Game->Counter[2] >= 2){Game->Counter[2] = 10;}
                        if(Game->Counter[2] == 1){Game->Counter[2] = 9;}
                        if(Game->Counter[2] == 0){Game->Counter[2] = 8;}
                        Game->PlaySound(25);
                        Waitframe();    
                        Screen->Message(54);
                        int drainwait = price3;
                        while(drainwait > 0){
                            Game->PlaySound(18);
                            Game->Counter[1] -= 1;
                            drainwait -= 1;
                            Waitframe();
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price3 && Link->Dir == 0){
                        Screen->Message(nerm);
                        nobuy = 1;
                    }
                    Waitframe();
                }
                if(!Link->InputL){
                    nobuy = 0;
                }
                Waitframe();
            }
            while((Link->X > buy4->X-4 && Link->X < buy4->X+4) && Link->Y == buy4->Y){
                while(Link->InputL){
                    if(nobuy == 0 && Game->Counter[1] >= price4 && Link->Dir == 0){
                        nobuy = 1;
                        Screen->Message(28);
                        Game->Counter[3] = 30;
                        Game->PlaySound(25);
                        Waitframe();
                        Screen->Message(55);
                        int drainwait = price4;
                        while(drainwait > 0){
                            Game->PlaySound(18);
                            Game->Counter[1] -= 1;
                            drainwait -= 1;
                            Waitframe();
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price4 && Link->Dir == 0){
                        Screen->Message(nerm);
                        nobuy = 1;
                    }
                    Waitframe();
                }
                if(!Link->InputL){
                    nobuy = 0;
                }
                Waitframe();
            }
            while((Link->X > buy5->X-4 && Link->X < buy5->X+4) && Link->Y == buy5->Y){
                while(Link->InputL){
                    if(nobuy == 0 && Game->Counter[1] >= price5 && Link->Dir == 0){
                        nobuy = 1;
                        Screen->Message(28);
                        if(Link->HP >= Link->MaxHP-4 && Link->HP < Link->MaxHP){Link->HP +=4;}
                        if(Link->HP >= Link->MaxHP-8 && Link->HP < Link->MaxHP-4){Link->HP +=8;}
                        if(Link->HP >= Link->MaxHP-12 && Link->HP < Link->MaxHP-8){Link->HP +=12;}
                        if(Link->HP <= Link->MaxHP-16){Link->HP +=16;}
                        Game->PlaySound(25);
                        Waitframe();
                        Screen->Message(56);
                        int drainwait = price5;
                        while(drainwait > 0){
                            Game->PlaySound(18);
                            Game->Counter[1] -= 1;
                            drainwait -= 1;
                            Waitframe();
                        }
                    }
                    else if(nobuy == 0 && Game->Counter[1] < price5 && Link->Dir == 0){
                        Screen->Message(nerm);
                        nobuy = 1;
                    }
                    Waitframe();
                }
                if(!Link->InputL){
                    nobuy = 0;
                }
                
                Waitframe();
            }
            Waitframe();
        }
    }
}


And that's it. If there's a better version of any of these scripts please let me know. icon_wink.gif Thanks!

#18 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 24 July 2008 - 09:45 PM

Oh boy. I don't know how the second is set up, but it looks like the first is set up like this:
D0-combotype is what type of combo the climber responds to.
D1-speed is like ASpeed in the combo editor. It's the delay of frames waited before moving Link over one pixel.
D2-dummy is the LTM item given to Link to give him the look of climbing.

I'd actually recommend MY versions of these scripts. They have comments and are easier to use, at least IMO.

CODE
lock = false;

            if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == CT_WALKSLOW && Link->Action != LA_HOPPING) {
                LockDir = DIR_UP;
                lock = true;

                Link->Item[160] = true;

                Link->InputA = false;
                Link->InputB = false;
                Link->InputR = false;
                Link->InputL = false;
            }

            if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] != CT_WALKSLOW && Link->Item[160]) {
                Link->Item[160] = false;
                lock = false;
            }
Put that in the global script. It'll save you time. Also add an "int LockDir; bool lock = false;" with all the other global script declarations.

CODE
//Shop Item
//D0: Item ID
//D1: The price of the item
//D2: The starting tile for displaying the price. They should be ordered 0-9 in the tilespace.
//D3: The CSet for the price tiles
//D4: Whether or not the price tiles' transparent colors are respected.
//D5: Whether to sell the item more than once. Set to:
//-2 or less: Sell the item an infinite number of times.
//-1: Only sell it if Link does not have the item.
//0 or more: Set it to the selling index reference, so Link only buys it once per game.
//D6: Only used when D5 is -1 or greater. The tile used for the sold out sign.
ffc script ShopItem{

    void run(int ID, int Price, int startPTiles, int PCSet, bool PTrans, int sellOnce, int soldOut) {

        //forget running the script if the item should not be sold
        if(sellOnce == -1 && Link->Item[ID]) {
            this->Data = soldOut;
            Quit();
        } else if(sellOnce >= 0) {
            if(sellIndex[sellOnce]) {
                this->Data = soldOut;
                Quit();
            }        
        }

        int numDigits;
        int digit[5];
        int digitX[5];
        int digitY = this->Y + 18;
        int offset;
        int orig_data = this->Data;

        item ShopI;

        Price = Abs(Price);

        //Check the number of digits
        if(Price > 9999)
            numDigits = 5;
        else if(Price > 999)
            numDigits = 4;
        else if(Price > 99)
            numDigits = 3;
        else if(Price > 9)
            numDigits = 2;
        else
            numDigits = 1;

        //calculate the offset
        offset = numDigits * -4 + 8;

        //calculate the digits
        for(int i=0; i<numDigits; i++) {

            digit[i] = Floor(Price/Pow(10,i+1));
            digitX[i] = this->X + offset + 8*i;

        }

        //Place the item if Link has enough money.
        if(Game->Counter[CR_RUPEES] + Game->DCounter[CR_RUPEES] >= Price) {
            this->Data = 1;
            ShopI = Screen->CreateItem(ID);
            ShopI->X = this->X;
            ShopI->Y = this->Y;
        } else {
            while(true) {
                for(int i=0; i<numDigits; i++) {
                    Screen->DrawTile(2, digitX[i], digitY, startPTiles + digit[i], 1, 1, PCSet, 1, 0, 0, 0, 0, PTrans, 128);
                }
                Waitframe();
            }
        }

        while(true) {

            Waitframe();

            //Check if Link has enough money. If he doesn't, dispose of the item and just display the price.
            if(Game->Counter[CR_RUPEES] + Game->DCounter[CR_RUPEES] <= Price) {
                this->Data = orig_data;
                ShopI->Y = 360;
                run(ID, Price, startPTiles, PCSet, PTrans, sellOnce, soldOut);
            }

            //Display price
            for(int i=0; i<numDigits; i++) {
                Screen->DrawTile(2, digitX[i], digitY, startPTiles + digit[i], 1, 1, PCSet, 1, 0, 0, 0, 0, PTrans, 128);
            }

            if(!ShopI->isValid()) {
                Game->DCounter[CR_RUPEES] -= Price;
                if(sellOnce == -1 && Link->Item[ID]) {
                    this->Data = soldOut;
                    Quit();
                } else if(sellOnce >= 0) {
                    sellIndex[sellOnce] = true;
                    this->Data = soldOut;
                    Quit();            
                }
                for(int i=0; i<16; i++) {
                    Link->Y--;
                    Link->InputUp = false;
                    Link->InputDown = false;
                    Link->InputRight = false;
                    Link->InputLeft = false;
                    Link->InputR = false;
                    Link->InputL = false;
                    Link->InputA = false;
                    Link->InputB = false;
                    Waitframe();
                }
                run(ID, Price, startPTiles, PCSet, PTrans, sellOnce, soldOut);
            }
        }
    }
}
With this version, you can have 32 items per shop instead of 5... But it's styled after the original shop style, so if you want the press A to buy thing, you'll have to use Matthew's script.

#19 Joe123

Joe123

    Retired

  • Members

Posted 25 July 2008 - 07:37 AM

I have a much better version of the climbing script now that doesn't need that silly invisible LTM.
I'll sort it out later.

And you don't want to be using that version of the shop script, that was Matthew's shop script, but butchered up by me to work specifically to the one shop in The Fort Knights.
You wouldn't want to use it anywhere else, trust me.
I'm sure Beefster's is much better.

Edited by Joe123, 25 July 2008 - 07:37 AM.


#20 ZebraStallion

ZebraStallion

    Follower of Destiny

  • Members

Posted 25 July 2008 - 09:11 AM

QUOTE(Beefster @ Jul 24 2008, 09:45 PM) View Post

Oh boy. I don't know how the second is set up, but it looks like the first is set up like this:
D0-combotype is what type of combo the climber responds to.
D1-speed is like ASpeed in the combo editor. It's the delay of frames waited before moving Link over one pixel.
D2-dummy is the LTM item given to Link to give him the look of climbing.

I'd actually recommend MY versions of these scripts. They have comments and are easier to use, at least IMO.

CODE
lock = false;

            if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] == CT_WALKSLOW && Link->Action != LA_HOPPING) {
                LockDir = DIR_UP;
                lock = true;

                Link->Item[160] = true;

                Link->InputA = false;
                Link->InputB = false;
                Link->InputR = false;
                Link->InputL = false;
            }

            if(Screen->ComboT[ComboAt(Link->X+8, Link->Y+8)] != CT_WALKSLOW && Link->Item[160]) {
                Link->Item[160] = false;
                lock = false;
            }
Put that in the global script. It'll save you time. Also add an "int LockDir; bool lock = false;" with all the other global script declarations.

CODE
//Shop Item
//D0: Item ID
//D1: The price of the item
//D2: The starting tile for displaying the price. They should be ordered 0-9 in the tilespace.
//D3: The CSet for the price tiles
//D4: Whether or not the price tiles' transparent colors are respected.
//D5: Whether to sell the item more than once. Set to:
//-2 or less: Sell the item an infinite number of times.
//-1: Only sell it if Link does not have the item.
//0 or more: Set it to the selling index reference, so Link only buys it once per game.
//D6: Only used when D5 is -1 or greater. The tile used for the sold out sign.
ffc script ShopItem{

    void run(int ID, int Price, int startPTiles, int PCSet, bool PTrans, int sellOnce, int soldOut) {

        //forget running the script if the item should not be sold
        if(sellOnce == -1 && Link->Item[ID]) {
            this->Data = soldOut;
            Quit();
        } else if(sellOnce >= 0) {
            if(sellIndex[sellOnce]) {
                this->Data = soldOut;
                Quit();
            }        
        }

        int numDigits;
        int digit[5];
        int digitX[5];
        int digitY = this->Y + 18;
        int offset;
        int orig_data = this->Data;

        item ShopI;

        Price = Abs(Price);

        //Check the number of digits
        if(Price > 9999)
            numDigits = 5;
        else if(Price > 999)
            numDigits = 4;
        else if(Price > 99)
            numDigits = 3;
        else if(Price > 9)
            numDigits = 2;
        else
            numDigits = 1;

        //calculate the offset
        offset = numDigits * -4 + 8;

        //calculate the digits
        for(int i=0; i<numDigits; i++) {

            digit[i] = Floor(Price/Pow(10,i+1));
            digitX[i] = this->X + offset + 8*i;

        }

        //Place the item if Link has enough money.
        if(Game->Counter[CR_RUPEES] + Game->DCounter[CR_RUPEES] >= Price) {
            this->Data = 1;
            ShopI = Screen->CreateItem(ID);
            ShopI->X = this->X;
            ShopI->Y = this->Y;
        } else {
            while(true) {
                for(int i=0; i<numDigits; i++) {
                    Screen->DrawTile(2, digitX[i], digitY, startPTiles + digit[i], 1, 1, PCSet, 1, 0, 0, 0, 0, PTrans, 128);
                }
                Waitframe();
            }
        }

        while(true) {

            Waitframe();

            //Check if Link has enough money. If he doesn't, dispose of the item and just display the price.
            if(Game->Counter[CR_RUPEES] + Game->DCounter[CR_RUPEES] <= Price) {
                this->Data = orig_data;
                ShopI->Y = 360;
                run(ID, Price, startPTiles, PCSet, PTrans, sellOnce, soldOut);
            }

            //Display price
            for(int i=0; i<numDigits; i++) {
                Screen->DrawTile(2, digitX[i], digitY, startPTiles + digit[i], 1, 1, PCSet, 1, 0, 0, 0, 0, PTrans, 128);
            }

            if(!ShopI->isValid()) {
                Game->DCounter[CR_RUPEES] -= Price;
                if(sellOnce == -1 && Link->Item[ID]) {
                    this->Data = soldOut;
                    Quit();
                } else if(sellOnce >= 0) {
                    sellIndex[sellOnce] = true;
                    this->Data = soldOut;
                    Quit();            
                }
                for(int i=0; i<16; i++) {
                    Link->Y--;
                    Link->InputUp = false;
                    Link->InputDown = false;
                    Link->InputRight = false;
                    Link->InputLeft = false;
                    Link->InputR = false;
                    Link->InputL = false;
                    Link->InputA = false;
                    Link->InputB = false;
                    Waitframe();
                }
                run(ID, Price, startPTiles, PCSet, PTrans, sellOnce, soldOut);
            }
        }
    }
}
With this version, you can have 32 items per shop instead of 5... But it's styled after the original shop style, so if you want the press A to buy thing, you'll have to use Matthew's script.

Thanks, but I was kind of hoping for a press "A" shop script. And thanks for the explanation. icon_smile.gif
QUOTE
I have a much better version of the climbing script now that doesn't need that silly invisible LTM.
I'll sort it out later.

And you don't want to be using that version of the shop script, that was Matthew's shop script, but butchered up by me to work specifically to the one shop in The Fort Knights.
You wouldn't want to use it anywhere else, trust me.
I'm sure Beefster's is much better.


Could you post that climbing script? Thanks! icon_wink.gif

Edited by ZebraStallion, 25 July 2008 - 09:12 AM.


#21 Joe123

Joe123

    Retired

  • Members

Posted 26 July 2008 - 02:31 AM

No, because I'm going on holiday in a few minutes.

But someone else might be able to re-write it for you.

Basically, it had the same checks for the ladders as the previous script, but it used Waitdraw(); and then set Link's Dir to 0 afterwards.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users