ZachR's Recent Forum Activity

  • It's kinda odd, I'm looking and your code and it looks like it should work? Maybe... is "firstEmptySlot" a number variable? Maybe it's set to string and that messes it up?

    Either way, I've set it up slightly different (with a function, highly recommend) and tested it. This works 100%.

    This does work, thank you! Now all I need to do is make each item trigger map to its associated item instead of being random.

    I really wonder what the issue was with my last code. It had me stumped the entire day, because it really looks like there aren't any issues with it.

    EDIT: I changed the function choose to the trigger I'm using and its associated item and it works flawlessly. HUGE thank you for your help with this!

  • It's kinda odd, I'm looking and your code and it looks like it should work? Maybe... is "firstEmptySlot" a number variable? Maybe it's set to string and that messes it up?

    Either way, I've set it up slightly different (with a function, highly recommend) and tested it. This works 100%.

    Yeah it’s a number variable. Thank you I’ll try this!

  • I might be losing my mind here haha. I added some logs to track what was happening in the console, and it does show the item getting overwritten:

    FInding Slot: 0

    runtime.js:14 Inventory {"c2array":true,"size":[10,1,1],"data":[[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]]]}

    runtime.js:14 Inventory {"c2array":true,"size":[10,1,1],"data":[[["key"]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]]]}

    runtime.js:14 FInding Slot: 1

    runtime.js:14 Inventory {"c2array":true,"size":[10,1,1],"data":[[["key"]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]]]}

    runtime.js:14 Inventory {"c2array":true,"size":[10,1,1],"data":[[["ball"]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]],[[""]]]}

    But it also shows that it's working properly outside of that? It does everything right and then the second item overwrites the first every time. Here is updated code that I put in an isolated event sheet, testing on an isolated layout.

  • I initialized the array and put together this system for a simple inventory. When I pick up any item, everything works as intended. I can use the item, the sprite gets destroyed, etc.

    The issue appears when I pick up a second item, as it overwrites the first. Does anyone know what might be happening? Here are some screenshots.

    The checkSlot loop was meant to bypass indexOf to see if that was the issue, but nothing changed. Running this with or without indexOf vs running it without the loop doesn't change anything.

    firstEmptySlot is my global variable.

    In the debug example above, when hitting E on either of these items, it's added to the correct first spot in inventoryArray.

    tempWatchValue (watching inventoryArray.IndexOf("")), also changes to 1 as it should. Picking up the other item doesn't change it anymore though, and just replaces the first item. Thank you for any help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Got it! Just added the global variable system condition I made for preventing movement to this as well. Posting it here in case somebody comes searching. Thanks everyone!

  • Also, you're pressing space to both advance the dialogue AND to trigger the interaction, that's probably what's causing the loop.

    Wow yep, that's exactly what it was! Thank you! It works fine if I use two different buttons.

    But now I'm wondering how I can get around that, as I'd like a single interact button instead of needing to switch. To keep things intuitive. I'll figure out a little thing to keep E from being used as an interact button while in dialogue.

  • > This is backwards:

    >

    >

    >

    >

    >

    >

    > I followed the same tutorial and had the same problem. Those two events need to swap places.

    Hm I switched them and there's still the same issue. Everything works perfectly until the very last line of dialogue.

    Actually, after switching them it now loops back to the start of the first dialogue unless I wait for it to finish completely. After waiting for it to finish and then moving on, the second dialogue plays. If I don't wait for that to finish it loops back to dialogue one again.

    If I DO wait for dialogue two to finish as well, THEN try to exit, it loops through dialogue two and never goes back to one.

    PS ignore the difference in buttons with space and E, I just switched the buttons between screenshots.

    Here's what I'm working with for the dialogue:

  • This is backwards:

    I followed the same tutorial and had the same problem. Those two events need to swap places.

    Hm I switched them and there's still the same issue. Everything works perfectly until the very last line of dialogue.

  • You can attach a *.c3p with the problematic scene.

    I ended up switching the player movement to 8-direction, and it fixed the issue when I added your original fix to it like I did with tile. It works better for this anyway, but I'm not sure why the tile movement was so clunky in comparison.

  • You need to change the collision collision of the hero. Collision collision with furniture and map details should be equal to his shadow.

    Good point; that does make a lot more sense. But after changing this the issue still remains for all of the spots shown in the original images.

    I even went ahead and made the character not solid as well as no collisions enabled for them, just to see, and it didn't change anything. Now I'm even more confused haha

  • The collision polygons I have for these sprites seem way, way off from what they should be. No idea what's wrong here, but I've linked some examples below.

    The first three images show areas I can't enter due to solid collision. I'm holding the direction I'm facing in each of them. The last image shows the collision of all sprites. Collision for the beds is a box sprite the exact size of each of them.

  • After trying to find an answer for a while, I've come to the conclusion it's 100% the dialogueTrigger failing to work if more than one function is called above it. I'm still not sure why it's acting up like this, though.

ZachR's avatar

ZachR

Member since 1 Oct, 2023

None one is following ZachR yet!

Trophy Case

  • 1-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

4/44
How to earn trophies