playMaker

Author Topic: Regarding shop / Inventory issue  (Read 950 times)

apageeltd

  • Playmaker Newbie
  • *
  • Posts: 38
Regarding shop / Inventory issue
« on: April 05, 2019, 09:29:06 AM »
I need some help regarding a project i am making . I will try to list out and explain the problem as to the best of my ability , as i am very new to Playmaker and unity.

I  am trying to create 2 shops.   one for buying items and one for selling items.

The way i created the shop is , When my player enters the Buy shop a Trigger occurs and a panel gets Activated  and inside panel shows the item to buy.

Example: (Buy oranges) :this is a Button .... (X1=$) text label ( $10) random price text.

So, when player clicks the Buy button , it buys the item and money deducts from the Bank.

But my problem is , on the Seller shop I want to sell the item

So i have gone to seller shop ,,,, trigger occurs ,,, and a Panel Show Up.
Panel is empty, and i want panel to show what item i have in my hand or inventory and generate a random price to sell it

I dont know how to represent the bought item (by text or visually) i have in my hand , to show up in the seller Panel.... same like i bought it with a button and price and tag....i dont know how to do it, could anyone please help me i this regard.

Please.
Any help would be very helpful
Thanks

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Regarding shop / Inventory issue
« Reply #1 on: April 05, 2019, 07:24:35 PM »
Hi.
I have replied on your mail, but i will place my answer here also :

How do you store the purchased items?
Are you using arrays?

if it are simple 'oranges' and 'apples' (for example)

you can use a single int array on the player and and use the index as id's of the objects.

so :
Element 0 would be oranges
Element 1 would be apples
Element 2 would be bananas
and so on (arrays start @0 )

the int value is the amount the player is holding of that item.

then on the shop's Trigger event , use the store collider to store the player object.
then use get fsm array, to get the data on the player.

Then you have to loop thru the array to check each element (Array Get Next) how many oranges/apples/bananas/etc there are.

if more then zero display the image and if more than 1 you can also set the amount.
then use a random int to get a random price. and display with Ui Text Set Text.

Here is a tutorial video about arrays :