How would I make this work? Selling random items.

Get help using Construct 2

Post » Sun Apr 01, 2012 10:37 pm

Im making a small rpg game, mostly text based, where you buy stuff and then sell it. I have made the buy screen, and the inventory, but I am struggling on making the actual selling part. I think im going to make it automatically sell when you press "start selling". (if you have a better idea on how I can do the selling part of the game, let me know). So I have global variables for each different product you can buy, how would I make it so a set number of customers come in to buy stuff, and when they do buy stuff they buy a random number of one or more different products? Thanks in advance!
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Mon Apr 02, 2012 4:51 am

No suggestions?
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Mon Apr 02, 2012 6:50 am

There are so many ways to do this, it would really help to see your .capx (or preferably a simplified version of it.) To give you specific help I need to know, for example, how you are storing inventories. Are you using arrays? (I would.)

As far as managing the purchase you might try something roughly along the lines of:

system-> repeat NumberofCustomers times
    system-> pick each product
           QuantityPurchased = int(random(0,QuantitySellerHasOnHand))

Then you'd deduct the quantitypurchased from the seller's inventory and add it to the buyer's inventory, and increase the seller's cash and decrease the buyers cash, etc.

Hope that helps at least a little!kittiewan2012-04-02 06:52:33
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Mon Apr 02, 2012 7:03 am

Ok well this is what I have so far. The selling part is in the "Game Events". Each "RandomBuy" is going to be representing a different customer (5 customers a night without the upgrade, which will then take it to 10). There needs to be a chance that the customers rob you of product, which needs to be one of the random numbers. Let me know what I can do here!

http://dl.dropbox.com/u/68458825/Game.capx
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Mon Apr 02, 2012 7:05 am

Oh and it also needs to be able to upgrade the amount of profit if you have the upgrade... looks like this is going to take veryyyy long if I continue with how im doing it right now...
B
7
S
1
Posts: 97
Reputation: 1,167

Post » Mon Apr 02, 2012 10:06 pm

To me the approach you are taking seems very difficult to understand and manage. Maybe someone else will have better luck understanding what you are trying to do and what your next step would be.

If you are willing to do some rework of your project, here is a link to a project that does some of what you want. The store starts out in a closed state and after a certain number of ticks, goes to an open state. When open it is possible to make sales of a random quantity of random products to up to a maximum number of customers by clicking a button.

store.capx

To upgrade the number of customers you would just change MaxCustomers.

Do you mean increase the profit or increase the revenue? If you mean revenue (which is price * qty) then just multiply by another upgrade factor and make it price*qty*factor. For example, 3*10=30 vs 3*10*1.5=45.

If you have questions about the capx I linked to, let me know.kittiewan2012-04-02 22:07:19
B
29
S
11
G
12
Posts: 281
Reputation: 11,878


Return to How do I....?

Who is online

Users browsing this forum: Calfuso, ETgirl79, totoe, Yahoo [Bot] and 23 guests