Discover + Unlock NEW Items?

  • Thanks for playing with the example fileplinkie , I just had a look.

    First of all maybe you didn't read the all post where I put the example file because I did mention to ignore my Array stuff, I have no actual idea what I did there I just tried to place them as a start after reading the documents and got even more confused... so it's not the reason I'm confused, the reason I'm confused about Arrays is how I "work" with them on the event sheets, I don't understand it.

    Again, I do understand the principle of 2D array that are Height and Width so I can visual something like shelves with items (X, Y). but that's not the issue as I mentioned above.

    BTW - I DO SEE how powerful ARRAYS now, especially as they deleted on the Debug mode (not that I need this feature but yeah it's wonderful). :)

    I don't understand why you made the player always get stuck with one item only once you pick up the other items, Yes I read what you said which is exactly that but maybe I didn't explain well what I'm trying to do:

    1 - All Items that are "marked" with "Item_Found" = Truth (Boolean I put on my example file SHOULD be able to pickup at any time.

    2 - Once you Trigger (kill a boss, or any other trigger on the game) it will add NEW unlocked items to the RANDOM RANGE (List of all items) by simply CHANGE Items from "Item_Found" = False to Truth.

    So the Items are already exist in the code but cannot be found until they found.

    I'm still not sure if I can explain it better but I tried, this is why my original example is very much close to what I'm looking for, but the UNLOCK part is what I'm trying to add (without Arrays, which are a total unorganized mess in the code for me in person).

    After looking at your version:

    To be honest, I don't understand anything from the re-code it looks like gibberish to me, that is why I suppose I shouldn't use Arrays, I'm scratching my head now trying to understand what's goin on and it looks so messy to me compare to how I did it before (ignoring the Arrays I put there for fun of course hehe).

    Sorry if it sounds like I'm complaining, Actually it's the opposite I'm very thankful that you took the time to re-do this on a file I made from scratch so basically it should be easier for me to understand but unfortunately, my brain cannot understand Arrays no matter what I do I'm blocked (or should I say just stupid) when it comes to such complicated mess of a code (I'm talking about the way Arrays design in Construct is hard for me to follow, edit, tweak, and most of all.. understand and create my own Arrays) so I should probably just give up on the all unlock idea and make my game much more simple... just random items.

    The truth is that I did HOPE that someone will find a way based on my "None-Array" code to solve my issue since Construct can do the same thing in so many ways but I understand that I'm the problem, since Arrays are the only answer and it's unfortunate for me.

    So I'll ask again because I'm really about to give up this wonderful feature I really wanted in my game:

    After anyone can have a look on my EXAMPLE FILE (please ignore any ARRAYS I put there, can delete it. it does nothing)

    My Question is:

    Can you SOLVE the issue I described here and originally on the first post WITHOUT using ARRAYS?

    Is there a super magical secret way to do it?

    If so PLEASE download the example file and show me, I'm extremely curious about it!

    Thanks ahead!

    EDIT:

    Since I didn't gave up on Arrays yet since I'm a very curious person, I will try to make a more simple visual example file, upload to share here and SOLVE the issue thanks to the community help. :)

  • OK, as promised... I actually made this visual demonstration in construct (not sure why) it is nothing but text and animated arrows. thanks to my stuuupid visual brain!

    As you can see: I would say that I understand 2D Arrays, it is not the part where I'm lost in again and again but inside Construct's code which is not visual (yes, I did try the Array Editor, no.. it's very confusing to setup so I'm not using it).

    It's probably funny to any of you who thinks: "It's right in front of you visually, translate this to code!" yeah... tried that but again, me and Arrays in Construct 3 I'm not there yet.

    If you'll look at the EXAMPLE FILE I originally attached above this post (please ignore any ARRAYS I put there, can delete it. it does nothing), you can see the "normal" random pickup works very nice (just like in my game) but the part with the FOUND = False / Truth that's where I'm stuck... not sure how to make it work.

    So my question is:

    Is there a way to do this without arrays?

    Any of you for the challenge to help me out? Ashley dop2000 plinkie

    I tried few things but I failed again and again, still I'm very curious what are the alternatives solutions without using Arrays.

    Thanks ahead for any suggestions, ideas, or even trying to accomplish this task on my example file and post it will be interesting to see how you solved this issue.

  • It's interesting that you created a visual representation that looks like an array. Anyway, now that you've broken down the logic I've noticed it doesn't make too much sense or there is a step missing somewhere. You say that items 1-3 are picked from because they are default/found. Items 4-5 are skipped. Items 4-5 should only appear in future runs if they are found, so how are they found?

  • Hehe thanks to you plinkie I still didn't give up on Arrays (yet) ;)

    To your question:

    Since the visual demonstration above won't show all the "rules" of the game, let me try to explain:

    The game will start with 5 items in total.

    As you can see 4 + 5 marked from the beginning of the game as FALSE, means: they won't be found

    The other 1,2,3 marked as TRUE, means: they can be found as soon as you play.

    Once the player collect and item the RANDOM should ONLY look for those that are found = TRUE.

    Now, imagine the Player end a RUN or find a "SUPER SPECIAL MAGICAL BOX" this will trigger one of the FALSE (not found yet) items, and will SET it to TRUE for the rest of the game (saving data) not just for the specific run.

    So you will get a message: "NEW ITEM HAS FOUND!" you just discovered a new one. it should be added to the items the RANDOM can pick now (which I have no idea how to do it of course).

    This is how it should work in theory, but in code? I have no idea.

    Any thoughts? None-Array solution? Array solution that I can... maybe follow? ;)

  • Ok I've cut down my original file a bit. You don't have any logic to grant a new item and i'm assuming F5 is to mimic a new run? So if you load my file and press 1, you will mimic an unlock of purple helmet and itll be available for future run. 2 is gold helmet etc. Essentially all you do is when you unlock an item, you push it to the array. The array is a list of all found items.

    dropbox.com/s/z52yhok12qd4b3c/arraytest.c3p

  • YES!!! This is the direction plinkie

    Since I don't just want to copy past this to my actual game, I would love to try understand how it works.

    But the problem is that... it's not visual at all, so maybe you can try to explain or draw it roughly?

    You can use arrows on my demonstration or something it will sure help me SEE it:

    In your version, I don't see which item is found and which isn't I'm guessing that you only set the 3 first items on the start layout while the others, are triggered using the '1' and '2' keys but I can trigger them in any way that I like of course.

    1 - The Purple and Golden Helmets which are "Not Found" by default, are not exist on the Array at all, right? or I missed that part. if so... where did you set them before you pushed them back? (confusion mode)

    2 - So if I will make 100 Items now, will I populate ONLY the "found" items and will PUSH BACK those who are not discovered yet? I wonder if that's the principle of what you did in the code.

    3 - I don't understand how the PUSH works exactly (documents are too general and not visual for my stupid brain) Can you explain? are they PUSHING "Purple_Helmet" from specific X,Y ? if so... from what place to what place.

    All I can guess is that pushing back should move -1 on the X, and if I'm correct... where is the "Purple_Helmet" on the first place? maybe I missed it in the code.

    Thanks ahead for your MIGHTY patience with me, I admire you and very thankful!

  • I think what you might be missing here is you can see the array in debug mode, so you can view the list of items and when you press 1 see it added to the list of items.

    It's all in the manual about push but basically the array in your game is a list of found items at co-ordinates 1,0 2,0 3,0 4,0 etc. When you push something at the 'back' you are adding to the list, so when you push it becomes 5,0. Run your game in debug layout, you can see the array there as a list. When you press 1 it is pushed to the array, added to the list. There is not much to it, just think of it is a list and you are adding this item to the bottom.

    When you find an item it is pushed to the array/list. This means it is available to pick from with the picking code, as the picking floor(random(1, array.width)) picks an item from the list. Instead of setting it to a certain value as you did with the default items, push just adds it to the back of the queue.

    1. When you start the game, only the ones set exist, the ones you put in your on start of layout set the default items.

    2.You set the default items. Anything you find/unlock later is pushed to the back

    3. Explained above

  • Thanks for the detailed explanation plinkie I think this file is helping me to get the basics of how to work with the Array, I just added the actual "Helmet_Gold" added the animation, the item followed what you did there with it's name on "equippeditem" variable, etc..

    Great advice, I just used the Debug to see how it adds (push) to the end of the list no matter if it was Purple or Gold Helmet the first added.

    I just realize it will be impossible to check my arrays once I'll have many items which is my original plan for the actual game.

    The problem I ran into was, even when I added a sub-event with "Trigger Once" I can keep adding more and more Helmets to the list, and I know in my actual game I will use some creative triggers so I better know how to make it add only once.

    Any idea why "Trigger Once" not affecting this?

  • Key presses are triggers that trigger once without the need for adding a trigger once. The key press I added is in place of what would be your logic for unlocking the item.

  • Key presses are triggers that trigger once without the need for adding a trigger once. The key press I added is in place of what would be your logic for unlocking the item.

    So if in my game it will be triggered by collision, overlapping or anything else (I don't know yet) so it won't add more than once by accident? I must be careful since I will add many items to found.

    What is the the best way (I know there are few) to SAVE and LOAD my game so it won't save the player's position or let him start with the last item.

    I may do only 1 slot or more for saving and RESET the game (all found items will be gone)

    All I want to save is the FOUND items, or should I say the most updated Array list?

    Can you please give me some advice on this subject?

  • This tutorial should be enough for saving your game construct.net/tutorials/how-to-make-savegames-11

  • Thanks plinkie I will read it.

    I've noticed an issue with the latest example, and I don't know how to fix it because... Arrays are still new to me.

    When you start a new RUN (F5 should simulate the same idea) after you already picked an item with SPEED or HIGHER JUMP the latest states will stay even if you restart the game with no item.

    What is the solution to reset it to actual no item (default settings) like I put on one of the groups called: "NO ITEMS - DEFAULT"

    I've tried:

    System > On start of layout > System | Set euippeditem to 0

    it didn't solve the problem, no change at all.

    1. Should I put it on the Array as one of the options?

    2. or there is a different Array action I can add within start of layout?

    3. Will this get RID of all the new items added to the array? (not supposed to if I will SAVE)

  • Ah okay, because it's a text variable it needs to be if equippedItem = ""

    On event sheet for stage 1 you set it to "" so that needs to be the check, or you can change it to NO_ITEM, doesn't really matter.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah okay, because it's a text variable it needs to be if equippedItem = ""

    On event sheet for stage 1 you set it to "" so that needs to be the check, or you can change it to NO_ITEM, doesn't really matter.

    Your original code was: equippedItem = "" and it didn't work.

    I tried to change it: equippedItem = "NO_ITEM" (I double checked so it's like the Array with caps)

    None of them are solving the issue, when I restart (F5) the player still have the latest states.

    EDIT:

    I Managed to fix it, I had another equippedItem = 0 (which doesn't make sense since it's string) so it was ignored.

    I'm keeping on practicing and playing around with this most basic Array, thanks to you plinkie I appreciate your help and great explanations.

  • I had to try implement this Array to my actual game and do some tests, so far everything works great!

    But now I have this issue, plinkie maybe it's simple to solve using some Array action?

    I created a simple sprite so I can test NEW sprite added to the list.

    Once the Player is colliding with this sprite it's adding a NEW Item. (push to the array list)

    I used the CHOOSE and put 2 items like this:

    Debug: EVERYTHING Works great, as soon as the player collide with that sprite it's destroyed and one of the two NEW Items will added to the Array "Arr_Items" list.

    But The problem is... next time when I want to add different ITEMS, it may still choose one of the ITEMS that already added.

    So is there a way to make sure, once an Item added to the list it won't be added again?

    so I won't get huge list with the same Items.

    Have a look:

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)