Greaver's Recent Forum Activity

  • Hey there! ^_^

    Basically i am currently designing an inventory system and i would like to ask - what is the best way to do it without causing lags? Ie not hiding it on an invisible layer or something, since having 100 items+, always invis on a laywer may cause delay.

    So what is the best way if not using a new layout for it?

    Any1 knows or got any examples?

  • Hello again Greaver, you're welcome.

    [quote:1oi9utfp]1. Browser thing, is this necessary for it to work? And what does it do? Cant figure it out.

    The Browser object can be very useful, in this case, to help debug your script with log messages. You can see this messages by displaying the console message of your browser (in my case I press CTRL+Shift+J on Chrome under Windows to show/hide the console). For more convenience you can also use a function to call this Browser object. I suggere for "cleanliness" and performances to disable this log messages when a project is in production.

    [quote:1oi9utfp]2. arr_inventory.At(Self.slotID) - sets the frame to ID to match the item picked up - however what code can we do to also set the animation? Not only frame but animation too?

    I don't have explore anymore your needs but I suppose, in the same way, something like "Set animation" of the Slot sprite to the animation value of the Item sprite ("YourSprite.AnimationName" expression) should do the trick.

    [quote:1oi9utfp]3. Can we store 10 different values? Or is there a limit? Hehe thanks in advance! ^_^

    I'm also currently working on an inventory system, fully stackable and dynamic, whith a hotbar for action shortcuts ("à la Diablo" or Minecraft in much simpler for the moment). I would say that you can store and do whatever you want, it depends on your approach and your vision, but in terms of methodology I think I will be gone on something more agile, but after all it's not essential and depends again on your needs.

    Sorry i dont understand ur animation explanation, anyone else knows how to do this??

  • Hi Greaver,

    In your logic and after the loop in your AddToInv function, just pick the right Slot and set variables with passed values in parameters. Have a look in the modified capx. https://dl.dropboxusercontent.com/u/507 ... ified.capx

    Good luck for the next steps! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Hehe hey, great! Thank you so much!! ^_^

    I have few questions though;

    1. Browser thing, is this necessary for it to work? And what does it do? Cant figure it out.

    2. arr_inventory.At(Self.slotID) - sets the frame to ID to match the item picked up - however what code can we do to also set the animation? Not only frame but animation too?

    3. Can we store 10 different values? Or is there a limit? Hehe thanks in advance! ^_^

  • Hello there! ^_^ (capx included below)

    So i have been studying and following this particular inventory system; https://www.scirra.com/tutorials/583/easy-inventory

    And i have adjusted it to what i need - however i have problem of copying the ID of the ground item (pick up)

    into the inventory (created item). The item that is on the ground will play a random number value of, lets say

    'StrID' and 'VitID'.

    Coptying the item frame from the ground to the inventory was easy and fine, but copying the ID value does not seem to work.

    Anyone knows how to do it, if possible?

    I uploaded a capx here;

    http://www.filedropper.com/testshow

  • Anyone else knows?

  • Please clarify what exactly you want to do. Do you want to copy 3 new items or add an item with 3 properties?

    * Item on ground has;

    HpID:175

    MpID:125

    VitalityID:100

    * - When the item goes from ground to inventory, we want the HP/MP/Vitality ID values to follow

  • Hi, I am doing an inventory system myself currently, displayed as a grid (it works so far) and also did some stuff related to it in the past.

    1) The example in the tutorial has a function for that "AddToInv". From what I understand you pass the ID of the item as parameter 0 when you call the function "AddToInv". Look into the capx of the tutorial for the function call action in event 6.

    2) If you are using the exact same functions as the tutorial you can't just change to the height to 6 to have a 6 by 6 grid as the example uses row 1 on the Y axis to store the number of items of a given ID.

    There are basically two approaches here, both are valid and possible to use, but I believe the first one is a lot easier to manage (and I used it myself):

    A) Always use the X axis to store items and the Y elements for each X axis element as the items properties. So have an array of 36 width with whatever height you need (I do not know what information besides item name you need to store in the array).

    Advantages:

    - very easy to add remove new items from the array, as you can just pop and push, and use "array.width-1" to retrieve the index of the last added (empty) x element, and don't need to do custom functions for it.

    - counting empty space or number of items is easy (equal to array.width).

    Disadvantage:

    - requires a bit of tinkering to have it display as an item grid. Basically you need to map a one dimensional X index to a row/column combination. Not hard, but it is some extra work. But not much as your inventory slots will need a row and column position anyway, regardless if you go with a 2D array or a 3D array.

    B) Do a 3 dimensional array, with x and y being grid position and z-axis elements being item data. IMO this is a lot better for maps or other grid-based structures where you need to check relative position, calculate distance, angle or do any kind of shapes. Personally I use a 3D array for a tilemap.

    Advantages:

    - easier to map to a grid

    Disadvantages:

    - counting empty slots or finding an empty slot is more difficult.

    - you can't just add a new item by pushing a new X level element easily. Well you can, but you are basically creating new slots at the same time. So to use the array effectively, you would need to have logic to find if you have empty slots, where there is an empty slot and if no empty slots are available to push a new array element.

    So how to copy a paremeter if it has more than 1 ID? i cant go X,X,X to copy 3 ID's to the new item

  • Hello there! ^_^

    So i have been learning and following this tutorial - https://www.scirra.com/tutorials/583/easy-inventory

    It is indeed amazing. Only thing i changed was to add number if existing item is in inventory, so if i pick up same item it will take a whole new space. So, i have 2 questions;

    1. I want the item i pick up to copy its ID such as strength/healing etc and add it to the array, how do i do that?

    In the tutorial above i cant find 'space' to copy the ID from the item picked up to the item created in inventory?

    2. I want a 36 slot inventory system, should i use 'Width' only and place them 6 and 6 underneath? Or is it better to use 'height' in some way to add the ones under? And how would that go?

    Thanks in advance ^_^

  • You can set items to global in the properties to have them keep their values when navigating between layouts. Is it a very basic inventory though because usually you would make one with an array and send the data to game rather than make one that is 100% graphics based. You are implying that you are going to start hiding inventory stuff that you're not using. With an array you can create slots and send the item data to game and display the graphics you want without the need to hide anything, although I don't know what your game is so this might not be relevant.

    RPG games - it does look like they use a different layer for a full screen inventory - but this resets monsters on other layouts.

    Maybe somehow with an array, but with many slots, this may become a bit hard haha xD

    • Can a zelda type inventory be array?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Greetings there! ^_^

    So to make an inventory, i figured a different Layout would fit better - but that resets the layout which u were on when u return back, position and enemies etc.

    So my question is, is the fix for the above hard? Or should one go with a Layer inventory type? Set layer visible/invisible?

    Though wont that lag or so if there are already 100+, objects on the former layers??

    Anyone? ^_^

  • Anyone?? ^_^

  • Hello people! ^_^

    Is there any way/effect in C2 where u can repeat a characters animation behind them in a slightly delayed position?

    Works kind of like Flash when he runs and it looks super fast?

    Or do i simply have to clone the character and just place them a bit further away/behind?

Greaver's avatar

Greaver

Member since 5 Apr, 2013

None one is following Greaver yet!

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Email Verified

Progress

13/44
How to earn trophies