LordKhaos's Recent Forum Activity

  • Instead of calling a function, you can create a trigger event on "Cell" - Created, that way you don't need to know the UUI, waits, etc. it will always trigger when you create a cell.

  • Thank you for all the replies/ideas guys - I'm experimenting at the moment to see what fits best for me.

  • Hello everyone,

    I'm doing some work on the dialogue and menu systems and would like to show some portraits.

    I have full body sprites for the heroes/npcs and would like to only show the top 50px of those sprites for dialogue and menus. Not sure if this is possible - even programatically?

    I know I can accomplish this by creating a separate animation but trying to avoid it at this point.

    Thank you

    Tagged:

  • when the "GridViewDataBind.OnRender" trigger of "choices_text" is called, the corresponding choices_item is not created yet that's why the selection returns nothing.

    Gotcha, I was expecting the parent to be created first.

    Its working with the trigger on the choices_item, thanks Aekiro!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    I'm not sure if I'm doing something wrong, seems there is something up with the "Compare Name" condition on "Game Object" on my test:

    I want to save some data to the parent object when its rendered.

    My setup is as follows:

    Gridviews.item_name is "choices_Item"

    "choices_Item" is the parent of "choices_text"

    The sub-event never fires, there is nothing on the console log.

    I've checked via the text append and choices_text.GameObject.parent returns the correct parent name.

    I can also set up a trigger on gridview render for "choices_Item" and that works, just wondering if I'm doing something wrong.

  • I want the event to run but I just want to evaluate some conditions mid-event and exit the event processing.

    Similar to most programming languages "return" statement.

    event() {
    
     if(x==0) return;
     if(y==y) return;
    
     doSomething();
    
    }
    

    Instead of doing

    event() {
    
     if(x==0 || y==y){
     
     doSomething();
    
     } 
    
    }
    

    I know ways I can get around it but for maintainability and readability just want to know if possible.

  • Hello,

    I've been searching for a while without luck.

    Is it possible to exit an event processing, similar to how we stop loops?

    Either via an action or script.

    I want something like:

    if x == 0 : exit processing

    if y == 0 : exit processing

    I know I can get around this with IFs and ELSEs and whatnot, just wanted to know if possible.

    Thank you

  • You do not have permission to view this post

  • Thanks Aekiro, that explains it.

    I thought if Parent Layer was not checked we could use multiple dialogs on the same layer.

  • Hello,

    I'm testing multiple dialogs on the same layout and I'm seing some wierd behaviours. Parent layer is unchecked and NO modal.

    Right now when I close a dialog (via event sheet or button) all dialogs on the layout get closed.

    Just wondering if this is a bug or the intended behaviour is for us to have a single dialog per layout.

  • Hey, I've had this problem before and I think it was something to do with picking the created object.

    From memory I think when you create an object, it will only be available for picking after the next "tick".

    Using "Pick last created" on a sub-event of the create event seems to work for me though.

  • Introduction

    Download it free: https://lusobytes.itch.io/simpleinventory

    Construct is very flexible but I found it tedious to create and dificult to maintain a working inventory using just dictionaries and arrays - so I created this plugin just for that.

    The plugin handles all inventory management, like sorting, item equipping, getting the sum of all DEF for a specific hero, etc.

    You just need to worry about the UI!

    See a working demo that you can download here: https://www.construct.net/en/free-online-games/lusobytes-simple-inventory-23282/play

    How it works

    Define your items in a JSON file. Then you initiate the plugin with said file.

    Add items via plugin call - use the id defined on the json file.

    Core concepts

    Stacked Inventory - Holds a quantity of a specific item defined on the json file. You can stack them.

    Global inventory - Holds unique items (equipments). They don't stack. Can have multiples and they can be equipped.

    Why a global and a stacked inventory? I wanted to add the possiblity of creating rarities or forging without defining all of it on the json - having an equip be a unique instance allows this separation (see games like NiNuKuni, knights of ages, etc.)

    I might support stacking equipments in the future if there is a demand.

    Main Actions

    AddItem(id) - id is defined on the json file. Adds a unique unique item with starting properties defined on the json.

    AddStackedItem(id, quantity) - Id is defined on json. Adds a specific quantity to the stacked inventory. You also decrease quantity with this method - use a negative quantity.

    How to list inventory and sort

    Load Global or Stacked inventories into a C3 array or a PRO UI list, via expressions.

    All Lists functions need to be wrapped by the conversion functions, either:

    ToC2jsonarray > converts the list into a C3 compatible JSON ( that grows on Y axis, so iterate XY)

    ToProUI > converts the list into a ProUI compatible JSON.

    SimpleInventory.ListStackedItems(category, orderproperty) - Gets the stacked inventory Id and quantities as a JSON.

    SimpleInventory.Listinventorybycategory(category, orderproperty) - Gets the global inventory IDs in a list.

    "category" only returns items of a given category. Leave empty to return all.

    "orderproperty" order the list by a specific item property (ex: "hp" or "price"). Empty defaults to "id" property.

    Display specific Item information

    The inventory lists return the item IDs, so when you are processing the array created by the lists, the value the item ID on the inventory - that you see on the debugger. With that ID, you can access the item properties via the expressions:

    getstackeditemproperty(stackedID,prop)

    getitemproperty(globalinventoryID,prop)

    Equipping Items

    *Documentation TODO - see demo for now*

    Modifying specific items

    You can change whatever unique item property you want via the action "setitemproperty(itemref, prop, value)".

    Breaking down the example above:

    Itemref - SimpleInventory.Getlastaddeditem ( returns the id of the last unique item added to the inventory)

    "prop" - atk the property to be changed

    value - int(SimpleInventory.Getitemproperty(SimpleInventory.Getlastaddeditem, "atk")) + 5

    SimpleInventory.Getitemproperty(id, prop) returns the item property, in this case atk.

    Then we add + 5 to that value.

    That way we increase the base item atk to + 5.

    JSON File

    The json file needs to have an array named "items" in the root. All items must be defined under it.

    All items defined need to have atleast these keys:

    "id", "name", "category", "equipped"

    "equipped" must be -1 or it wont work

    Ex:

    { "id": 101, "name":"Worn Buckler", "description": "Worn Buckler", "icon":6, "category": "shield", "equipped" : -1 }/ic] --

    Extra Credits

    - piranha305 for the amazing C3IDE.

    - Dop2000 for allowing me to use his scrolling list demo as a base for this plugin demo (https://www.construct.net/out?u=https%3a%2f%2fhowtoconstructdemos.com%2fscrolling-a-list-of-players-scores-images-etc-example-a-capx%2f )

    -----

    Hope this can be of use!

    Any bugs, doubts or sugestions let me know in the comments.

    Tagged:

LordKhaos's avatar

LordKhaos

Member since 2 May, 2020

None one is following LordKhaos yet!

Trophy Case

  • 4-Year Club
  • Email Verified

Progress

5/44
How to earn trophies