family item instance help

0 favourites
  • 8 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • trying to set up an inventory system , so that when my character gets a gear piece it will roll for the stats, but when i get another item from the family it re-rolls for all the items and i just want it workin on per each family item so like if i get 2 of the same helmets i dont want each of those helmets to have same stats unless magically it rolls the same stats but i want every gear to be unique with different stats

    my skype is gryz34 or Gusnation.

    twitch.tv/gusnation if you wanna catch me streaming and workin on my game

  • Hey Gussy,

    I don't have the plugins needed to open the project, so I'm not sure quite how things are set up, but I have some thoughts that might work.

    Boolean marker

    You might be able to store an extra Boolean for each object, that indicates if it has already been assigned stats.

    When you get a new item, you can then use the Boolean to exclude all items that already have stats from the randomization process.

    Pick by UID

    Another possibility is to store the UID (unique ID integer) of the object the player just acquired, and then in the event that does the randomizing, add the condition "Pick by unique ID" and use the UID you just stored.

    You can usually find "Pick by unique ID" condition in the "Misc" section of the object's conditions.

  • yes like i said i'm using spriter pro files so you need to install that plugin and to do that you need full version of construct

    so i have a family of items gears, monster drops, gold, ect. so when a gear goes into inventory i want it to roll stats so when i gain it

    so i try booleans

    [ITEMS(family)- ROLL STATS(boolean) true] - [STR round(random(0,50))]

    - [set ROLL STATS FALSE]

    but that turns all items family to false

    Picking by unique ID well all items in the family have the same ID so all my helmets have same ID

    that's why in an older post i was asking if there is a way to have containers for family items but i know I'm doing something totally wrong

  • booleans wont work cuz the item has 1 UID and Picking wont work cuz the item in the family has 1 UID so i cant simply switch a boolean off and on per item gained, Picking UID wont work cuz .... well ya 1 UID so i pick the item to roll stats and if i got 2 helmets well then all my helmets change to new number or they all share same rolld amount

  • I may be misunderstanding what you mean, but I believe all instances of objects in a layout have a unique integer ID assigned on creation by Construct. That automatically assigned integer ID is what I was referring to when I mentioned the "UID".

    The object type (e.g. "helmet") is different from the UID.

    Each helmet should have it's own totally unique ID number.

    UID explained in the manual: https://www.scirra.com/manual/130/common-features

    Example

    If you spawn three helmet objects in your game, their UIDs might be automatically assigned as 61, 62, and 63, respectively.

    If the player collides with one of the helmets, you can ask Construct which UID that specific helmet has.

    ...Event: Player collides with helmet. Action: set variable itemTouchedLast to helmet's UID.

    Let's assume the player touched the helmet with the UID of "62".

    You can now refer to that specific helmet in other events by using the UID to pick it.

    Suppose we want to place a selection box image on the last item the player touched.

    ...Event: Every Tick. Pick helmet by UID ( itemTouchedLast ). Action: Move selectionBoxSprite to position of helmet.

    This event will pick the helmet with the UID of "62", and it will then run the action only on helmet 62.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ya i try these things, and its not working, it just dawned on me that i'm using an inventory sprite , each frame is an item and linked with the icon_id of the sprite...... but that shouldn't be the issue cuz i tried switching and that isn't working either ... ughh ya i need some help add me on skype and walk me through if you can

  • ya something is definitely goofing up , even when i set a boolean it doesn't know if its on or off it cycles through 0,1 (off and on) so i think my item is forever being created which is why a random roll keeps cycling i think i have been doing it right but something else is happening

  • I still need help and why do i get error when i try to upload my capx file anyways here is a link to download the capx

    http://www.mediafire.com/download/tngv8 ... tory4.capx

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