playMaker

Author Topic: Arrays of Objects  (Read 826 times)

myyokeisheavvy

  • Playmaker Newbie
  • *
  • Posts: 5
Arrays of Objects
« on: April 24, 2020, 05:05:05 PM »
Hi everybody, I've set up a dialogue manager that handles different dialogue and buttons that pop up to activate them. Basically I have different dialogue options mapped to different buttons that are set active in the UI on entering a trigger. It displays a walkie talkie on entering and then you speak to the person on the other end on click. This is fine for single items, but I have several of the same items that the player needs to find within a small area and the dialogue is activated as each of those items is found. As it is right now the player enters the trigger and gets a "you found it, there's three more" type of text after clicking. My problem is that I need the player to be able to find these items in any order, as the area is pretty small and i can't control the order they're collected in. So for now on every trigger you're only getting the initial "hey you found it, there's more around" type of dialogue, when what i need is a check of how many have been found, then if say 2 have been found you get the "two more" dialogue button and when finding the last one get the "that's everything" button.

I'm not sure how to go about solving this. I've set up an array manager, but what array action do I use and how do I populate it, and how do I ensure that the player will go through a list of options?

Sorry for the novel long explanation, I hope it wasn't too confusing.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Arrays of Objects
« Reply #1 on: April 25, 2020, 11:38:19 AM »
Hi.
There are several ways you can do this depending on your set up.
for example you can have a int variable where you can add 1 each time you pick something up

for the items you can give them a 'ID' which you can get on pick up, then you can use that on an array or hash table.

For hashtables you can use array maker (Ecosystem)
They are very useful as you can set different kind of variables in a hash table. (int for amount picked up/ bool for has picked up etc)

But you need to populate them @ runtime to set multiple variable types.

if you need only 2 or 3 types maybe an array would be easier.
Use index as ID and make a bool array for has picked up and a int array for picked up count for example.