I've set up that item count goes up and down when you're buying/selling (i still need to set the limit so that you can't sell items that you don't have-could use some help on that too
If you store the amount of items the player is carrying in your player object as variables. (Item_1, Item_2, Item_3...etc) you can check against these to see whether the player have enough of them to sell. Simply but doing a Item_1 > 0.
And you can do the same for the shop.
The thing is, i can't for the life of me set things up so that when you buy/sell stuff, the final money value is added / substracted from your inventory. Finding out how to limit the trade so that you can't buy things you can't afford would be great too!
This can be done the same way as above. In this case you just make a variable called "Player_money" and you add/subtract from this and again you can use this value to test vs the price of the item the player want to buy.
Player_money >= Item_1_cost
Also, i have some questions about randomizing prices, so help with that would be great!
You can create random numbers using the following code:
- Code: Select all
Random(10) <- Will give you a random number between 0 and 10, including decimal numbers.
Int(Random(10)) <- Will give you a random integer between 0 and 10.
Int(Random(Number) + 1)
Int(Random(10) + 1) <- Will give you a random integer between 1 and 10.
So you can create random prices for your items like so:
Item_1_cost = int(random(100) + 1)
Will set the price to a random number between 1 and 100.
But I might have misunderstood how your inventory works and that this is not what you meant.