How do I change the way item combination is triggered?

0 favourites
  • 9 posts
From the Asset Store
Cartoon Funny Item Interface Sound Pack comes with 426 high-quality sound effects
  • Hi,

    I've recently got back into a project after a long break and am trying to work out which events/actions I need to change so that items only combine after they've been placed over the 'combiner' sprite and the purple button is pressed.

    The current version combines items automatically once certain items are dragged/dropped onto one another.

    drive.google.com/file/d/16WBH9ngfYwAAs5VGHQsuEnRL558ZDDKl/view

  • To answer the question in the title, probably scrap most of this and make it a lot simpler :D what are you trying to do here, I can't work it out or get the arrays to match.

  • The idea was that items could be combined to create new items by dragging and dropping them into the combiner sprite and checking for a matching combination in the JSON file.

    I appreciate the project's messy and difficult to understand. That's why I was asking for help, but just telling me to scrap it make it simpler is both unhelpful and a little insensitive. Combining items has been a very tricky subject for me to understand, even with the help of tutorials.

  • That is still my answer I think scrap that file and start again, keep it simple. Also the design has not really been explained, what is 'combining items'? Do you mean a crafting system using two items to make one item? If you mean this, I use a simple array, you can look for the name of the first item in the array and check the name of the second item against the second column to craft what is in the third column.

  • Yes, by combining I meant a crafting system but one where you can potentially combine more than two items, and I can't work out how to do this using arrays. So far I haven't been able to find any examples for this either.

  • I remember working on this with you, and I'm reminded I had meant to do a clean version with just arrays but I forgot! Sorry about that. It did get a little complicated, I think you had a JSON structure in place that I had been modifying and working around.

    Anyways for your specific question, trigger the function by On Touched Button in event 3, then pick items overlapping combiner in event 4 (as the first condition, you have it as the second - order matters in this case).

    dropbox.com/scl/fi/07suxzt788i2at8ntquu2/breadbird.c3p

    It does get more complicated when you want to use more than two ingredients. Did you have an idea how many different ingredients a recipe might have up to? Or how to handle conflicts if a+b=1 and a+b+c=2? You can prioritize the most ingredients, simplest ingredients, or simply design your recipes not to have conflicts. Do you allow a+b+c+d to result in a "2", with the d just ignored? Or would that be invalid? Having the details ready helps when putting together a system like this.

  • Hi oosyrag,

    Many thanks for this, I can't tell you how helpful this is.

    I was hoping to be able to use up to six ingredients for some recipes, but perhaps this would make things too complicated. The biggest issue I currently have is with conflicts like a+b=1 and a+b+c=2 as you mentioned, and with conflicts like a+b=1 and a+a+b=2.

    I've tried to make it so that most recipes don't cause these conflicts but some recipes are quite similar to one another. I'd prefer to prioritise a+b+c+d over a+b+c, so recipes with the most ingredients would have priority. With the current setup, combining conflicting recipes spawns a+b+c and a+b+c+d results at the same time if I attempt an a+b+c+d recipe.

  • I'd recommend sticking with JSON for flexible amounts of data - arrays are (generally) better for fixed sets, without getting into strings and tokens which could potentially make things even messier (but it is an option).

    If you want to add me on Discord (Risuga) I don't mind working on this directly through DM, since there will probably be a lot of little things that need addressing or changing for these kinds of systems. (Love your art style BTW!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks! :) I've just added you on Discord (hopefully - I haven't used Discord in ages and am still trying to remember how to do stuff).

    I'm fine with sticking with JSON as it sounds like it will make things easier in the long run. For now I just want to be able to combine items without running into the conflicts mentioned in the previous post.

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