• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Limited items in Pokemart

18
Posts
7
Years
  • Hello, this is more of a general coding question in Ruby, but at this point I'm stuck and need some help.

    So what I'm currently trying to do is to make it so that a pokemart will only have a limited amount of an item on sale before a timer countsdown and the vendor restocks. So what I thought I would do would be to call a function when a global switch is on and have it countdown from there. The amount being sold would be stored in an array that coincides with the item's index. The problem is that the first time I talk to the cashier, it works pretty good, but when I talk to it the second time, without calling the function, the array would be stored as nil, and in ruby, we can't dup a nil. Can someone just push me in the right path?

    Also, I've been trying to show the amount of items in the mart that they would have for sale, but the drawItem function in the Window_PokemonMart class doesn't have an index number I can use or a any returns I can call to use my array.

    Here's the code I altered in PScreen_Mart.

    Spoiler:

    Here's what I did to fix that issue.

    Spoiler:

    I'm still having problems drawing the text though.

    Thanks for checking out my problem.
     
    Last edited:
    Back
    Top