DecoySnake's Forum Posts

  • 13 posts
  • Thanks for your update. I agree I think the Z depth is just causing confusion for me. I will remove it and just use XY.

    The thing is My inventory is 36 slots. 9 wide 4 high. If a line gets full how do I make it check the next line for an empty slot? I thought I needed an additional loop for Height? When I did a test it did not automatically move to the next line.

    I can get it working right if I remove the height and just have a width but when that row is full (9 slots) it does not add to the next row. So I was trying to add a condition and a height check so I could change rows when item slots on the first row are full.

    But when I did that it just added items to every single empty spot in the first position of each row. So I think my logic was wrong.

    It's working now for the first row. Thanks for your help. I'm just now struggling to figure out how to move it to the next row when that one is full.

    I still have to set yp my Items menu looool. Really hoping I can copy and paste this set up and just rename things cause this has been so confusion for me. And everything was going so well until these menus!

  • This is working but for Width only...

  • OK...

    I managed to get it working with just a width set up. But everytime I try and add a height I get issues. Either it combines the entries or it overwrites the previous entry. I'm pretty sure it's either searching columns and rows at the same time and finding empty slots and placing it in all locations before it stops the loop. Or it's because my logic is wrong. But I followed a guide and it still didn't work.

    (Current set up with Width only.)

    And this is what I get when I set up Height.

    I don't get it lol....

  • When I set the actions I'm setting at x,y,z (cause I thought I needed an x position a y position for its location in the grid and the z for the information it stores) but I'm confused about what to put in the X value and the Y value. Because I think my understanding is wrong.

    In your demonstration I think you set at X and just said X Value LoopIndex and then set value at 0 etc for the z?

    But I thought I had to use xyz because I'm using height width and a z level.

    But again I think that's totally wrong and half my problem Is that.

    Am I supposed to just set at X and somehow put all the information into there?

    Thanks.

  • Hi. Thank you for your screenshot and response. I tried to follow your instructions but now I'm having two entire rows filled with 1 item. Also only 1 sprite on the top left position appearing.

    I think my understanding of the Array is wrong.

    How do I set width and height? If LoopIndex in your example just applies to width. How would you identify width from height?

    I thought setting LoopIndex("X") was saying on this X position. And LoopIndex ("Y") on this Y position if you find an empty spot create these entries at those coordinates. I thought this was the same as your example but having to define hight and width rather than just loopindex for width. But after your explanation it seems loopindex x refers to a loop name in particular and not a position or coordinate. I think my understanding is wrong.

    By setting actions,

    set at X,y,z on the array I thought I was saying (X being the X position again thinking this would be loopindexx because how do I know what empty slot it found??, i thought setting x to loopindex x meant the x coordinate it located) Y the same. (representing where it is located?) And Z = 0/1/2 fordisplaying the item name description and sprite.

    I think my understanding is wrong.

    I thought when setting x/y/z it was coordinates not loop names and I thought the z was what information it used from that location. But I don't think that's right or how it works.

    I tried looking up tutorials and guides but there isn't much out there that fits my set up and I cannot figure it out.

    I don't know if that makes sense lol. But I think the major problem is I don't understand what all the xyzs are referring to or what information it wants from me at thos moments. When I set x/y/z it says set the x position. I thought loopindex x represented that position.

  • What I need it to do is upon adding a new key item, 3 parameters ItemName ItemDesciptoon ItemSprite and then have the correct size inventoryarray and set it so it looks for an empty slot, saves the itemname item description and itemfram to the empty slot then it should recycle that same loop upon call key function each time a new key item is collected. Back to looking for an empty slot when it finds one save the name description and sprite and then set up the recycle.

    For all 3 name, description, sprite.

    It's probably really simple? And I've wasted 3 days lol.

  • Hi. Thanks again for taking an interest and offering advice.

    I tried to incorporate your suggestion into my set up (setting array.width) (I also set up height, but tried just width as well.) So I did not have to delete it all and syaty again.

    I've moved things around a bit here and there as well at suggestion. I don't know if my set up is just wrong, to confusing or interfering somewhere.

    At this point im thinking of reverting to an earlier point before I made so many changes and trying to incorporate your suggestion there. I believe I was still using for each inventoryarray at that point.

    My current set up still uses inventoryarray at call keyitemicon but I did change that to width/height but no change so I changed it back for now because i wasn't sure if that should be on that line or not.

    If that don't work I will just have to delete the 6 lines of code and start again from the on call function (where the item gets added) and try to structure it better from the start. Maybe following a tutorial or guide, But I'm not sure if I can incorporate my text descriptions and such updating each item as well in some of the simpler set ups they don't have text descriptions and such negating the need where as I need mine to update the text description item name and sprite image each time a new object is added and moved along to the next empty slot.

  • Tried that still the same thing. Think I'm just going to cancel the subscription and give up.

  • The reason I believe it could be something to do with line 34 where I search for an empty space is because items do display text and stack on top of eachother. So all the code for updating items and text seems to be working? Just not the cycling the next item to the next empty slot. Because I can see its not moving along.

    However I assume (not 100%) that if line 36 is constantly recreating icons in the same location or destroying the last one it could be recycling to that spot thinking its the next empty one because its being destroyed. Making it empty.

    Or I'm just overthrowing this at this point and should just delete the 6 lines of code and start over with a simply system or a suggested replacement??

    Basically my system is designed so I can call an imageicon that holds all my keyitem sprites. When I get round to working out where and placing a new key item in my game I call the function, fill in the info making sure the sprite number is the next in line, go to the sprite and change the corrosponding frame default to the new key item I just placed. This makes it so it automatically should update the image and text and push it along the grid. It does all that apart from finding the next empty space lol.

    I need it to be like this because I'm not 100% on where everything is going until I get furthur into development. I'm just setting up the menus and logic right now.

  • Here you can see my test key items are stacking on top of my keyitemicon sprite (which updates the image for the collected key item, which works because it has the 2 key item images on top of it, so it is updating the new image for the new collected item just not in the right place) it should be picking the next empty slot.

    If I do not collect any items it shows no sprite and no items. (Proving that its only when i collect items they are being updated and added into the slot)

    Everything to me seems like it should be working?? I just don't get it. I really don't want to start all over again because I built this to my needs. I just don't understand why it cannot find the next empty slot and place the image and text there.

    Everything seems to be working correctly apart from it going to the next empty slot. The image is updating the text is updating.

    The way I can see this is by removing the destroy action under line 36 of the create keyitemicon. By removing this I can see the items stacking. If I have it activated it only shows the latest item which again is right and what I want but because the items are stacking and not moving along its not working.

    Again I'm confused and unsure if there's an issue when adding the new item and it's not being recorded properly into a new empty slot (line34). Or if the issue is when I'm creating the keyitemicon for each new keyitem when collected and its somehow destroying or recreating the image in the same location preventing it going to the next empty slot. (Line36)

    It's probably something so simple but I've been tinkering for ages now and nothing lol. Also took advice from others (not from construct) and not sure what effect that has had. My code has slightly updated now but anytime any issues arrived i backtracked. I do have some updated code but it didn't seem to make a difference good or bad. Still have my back ups to revert back to if needed.

    Absolutely clueless. Lol.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your response. Thanks for your advice. Is that not what I am doing on line 34? (Not sure if you can see my screenshots) I thought line 34 was structured to loop through the inventory and find an empty slot. Again, I'm a bit clueless when it comes to construct.

  • Hi everyone, I am completely new to construct and I'm trying to create a main menu/key item system for my game. Its been working fine so far. I'm trying to make it so when a new key item is added it goes to the next avaliable empty slot. Originally I had lots of bugs like the text not displaying at the bottom instead showing 0 and the image being off centre and the image scrolling with the cursor. I managed to fix all these problems but I'm still left with the problem that items are stacking and not moving to the next empty slot.

    I'm pretty sure the issue is either with how the key items are added initiallyand being stacked or overwriten on the first slot or that the image being created/destroyed (so only one image exists per key item) is interfering and stopping other slots being filled or destroying the next image/item.

    At this point I'm starting to lose the plot and nothing makes sense anymore lol. I've spent hours upon hours on this and all the loopindex.at and numbers has completely confused me lol. I tried asking for help but no-one was sure and the suggestions they made may have made my code worse? Or interfere? I then asked chatgpt if it could spot the problem and it gave a few suggestions but again did not fix the problem and may have led to furthur conflicts??? And now I don't really know what to do.

    It's still 100% better than when the text wasn't displaying and all the other bugs but this one bug I cannot figure out.

    Also I just did my own thing and did not follow any guides or tutorials and have 0 knowledge and expertise lol. I'm pretty sure it can be fixed or reworked without having to start all over again.

    Can anyone tell me what's wrong and either give me some super simple steps or pointers to fix it or suggest another option?

    I've dedicated about 2 days of my spare time into this so far and managed to fix so many bugs and such I really don't want to have to give up or start again now. I have a few back ups I can revert to if needed. But ones before the text was fixed and one is after but with this same issue. But before adding the suggestions and chatgpt suggestions.

    Thanks.

  • 13 posts