Jump to content

Photo

Shop script, no rupees but somethin else


  • Please log in to reply
14 replies to this topic

#1 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 10:13 AM

I need a shop script where link can buy one item. It should work just like a normal shop (the item is in the center). Only difference: Link needs feathers, emblems, etc, not rupees (counter 7-12 not counter 1)! In my quests I need this script 6 times. In one shop link needs counter7-items in another shop he needs counter8-items in the third shop he needs counter9-items and so on.

Who would do this? Is this easy enough for someone to make?

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 10:55 AM

This should be very simple for just one currency. Just use the existing shop script (or its one-time variant) and change every instance of CR_RUPEES to CR_SCRIPT1 or similar. For a different currency per shop, you'd just need to add the counter number in an argument.

#3 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 11:38 AM

I want the counter number to be an argument, but I won't know how to do that?
Also, I don't know wich shop script I should use. I can't find one where you don't need to press a button to buy.

Edited by Avataro, 03 August 2011 - 11:38 AM.


#4 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 12:33 PM

If you don't want to press a button to buy then you might have some trouble. If you don't mind needing to press the button of your choice, then I can modify the shop I'm using for you. I planned to use it for a non-rupee currency so I'll do it eventually anyway.

#5 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 03 August 2011 - 12:39 PM

QUOTE(Avataro @ Aug 3 2011, 10:38 AM) View Post

I want the counter number to be an argument, but I won't know how to do that?
Also, I don't know wich shop script I should use. I can't find one where you don't need to press a button to buy.


It won't be possible with the built in shops, because they always use rupees as far as I know. But It would be possible to create a ffc script that does everything a shop would. I'll see if I can work one up.

#6 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 01:10 PM

Thank you guys. If this has to be a shop where you need a button to buy, then I want to make every normal shop work like that too. That means I can't use the shop script in the database, because that are single item shops only.

#7 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 01:11 PM

Joe123 already made am FFC/Global shop script (the one I'm using) that allows you to place an item anywhere. It would seem kinda redundant to make a new one from scratch.

Edit (didn't see Avataro's post): The shop script is used as an FFC, so you can put as many or few items in as you want. Also, it comes in infinite stock and single stock variants.

Edited by MoscowModder, 03 August 2011 - 01:12 PM.


#8 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 03 August 2011 - 01:15 PM

QUOTE(MoscowModder @ Aug 3 2011, 12:11 PM) View Post

Joe123 already made am FFC/Global shop script (the one I'm using) that allows you to place an item anywhere. It would seem kinda redundant to make a new one from scratch.


Where is this script, I can't find it in the database. Then again I only looked for like a minute if even. XD

#9 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 01:31 PM

Oh well I meant this script. It's no FFC/Global, just FFC. Where is the script you're using, Moscow? ;D

#10 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 02:00 PM

Oh, that's the one. I thought it was part global because of the extra functions but I guess those don't go in the global script. Anyways, it shouldn't be too hard to configure it for multiple currencies, right?

#11 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 02:32 PM

I just have to add something next to the "void run", for example "int currency" and then replacing "CR_rupees" with "currency", right?
Feels great to modify a script.

Thank you

#12 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 02:43 PM

No, put the currency variable in the list of FFC arguments.

#13 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 02:57 PM

where is this list?
I though the variables are next to the void run. Here is the shop part of my scriptfile.
CODE
//------------------Shop Script START------------------
ffc script Shop{
    void run(int itm, int price, int input, int currency){
        while(true){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[currency] >= price){
                    ShopItemThanks(itm);
                    DeductRupees(price);
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
    }
}
//------------------Shop Script END------------------

It doesn't compile though,

EDIT: oh! I didn't understand I had to use the third code too. Can someone finish this for me? The currency should be D3 in the ffc editor.

Edited by Avataro, 03 August 2011 - 03:07 PM.


#14 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 August 2011 - 05:03 PM

Sorry again, I was thinking of variables declared in the global script before while(true). The arguments are indeed the variables inside void run().

I think this is the only function needing change:
CODE
void DeductRupees(int amount, int currency){
    FreezeScreen();
    for(int i=0;i<amount;i++){
        Game->PlaySound(SFX_MSG);
        Game->Counter[currency]--;
    Waitframe();
    }
    UnFreeze();
}


You'll also need to change this:
CODE
//------------------Shop Script START------------------
ffc script Shop{
    void run(int itm, int price, int input, int currency){
        while(true){
            if(CanBuy(this,input)){
                SetInput(input,false);
                if(Game->Counter[currency] >= price){
                    ShopItemThanks(itm);
                    DeductRupees(price,currency);
                }else Screen->Message(S_NORUPEES);
            }
        Waitframe();
        }
    }
}
//------------------Shop Script END------------------


Haven't tested it, so tell me if it works!

Edited by MoscowModder, 03 August 2011 - 05:04 PM.


#15 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 03 August 2011 - 08:29 PM

Wow, thanks! It works, and it's great.
Tested out 3 different currencies. 1, 7 and 8.
icon_wink.gif


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users