How do I change a variable per copy?

2 favourites
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • My point is that you have to understand it yourself. The other guy already went deep into the functions with the long response but if you are a beginner then it's going to be hard to explain it to you. I would've started with my own simple dialogue system and go from there.

  • To get around that, I passed the UID of the picked instance in the call to NPCInteraction2 and inside of it I added an extra condition to Pick by comparison in addition to the NPCID condition. That way you can be sure that state is set in the correct instance.

    Is this what you mean by "passing" the UID?

  • I completely give up. I've looked at other forum posts with related problems, I've read the UID & IID manual pages, I've tried multiple things. I just can't seem to get it right. This has unfortunately just made me give up. I'll leave the project link here if anyone wants to try and help fix it, or make it work. Let me know. I'll probably come back to this issue and try to solve it in a few days.

    drive.google.com/file/d/1sFnX_8TLhh83X3lk6YsKr1AtnCgXnJCS/view

    I'll keep messing with it. I'll probably get it eventually

  • BTW! Here's the tutorial I copied from.

    construct.net/en/tutorials/branching-dialogue-using-json-2395

    I still can't seem to figure it out. I'd need Laura_D's help or Diegos

  • Here, I have this same issue with another value. Hopefully solving this issue with this value will help me solve the main issue.

    I want the text box to appear at the top of the screen when "topscreen" is enabled.

    drive.google.com/file/d/1pGnFYBjNc5RRgC9TRxRFD7DYqcyA58H2/view

    (Main Test Room 2)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm starting to genuinely give up. I can't seem to figure this out.

  • I tried following some of the problems you ran into, saw some issues the others pointed out too. A major problem with the requests you perform is the sheer size of the project. I opened it, and saw like 20 tabs open .... yikes.

    Suggestion: trimming down an example, to pin point out a problem, often helps a lot to understand whats going on yourself. And from those willing to help, you will get a lot more feedback if the request and information is manageable, in bite size chunks.

    There are some basic fundamental flaws in how you looks at some values and variables.

    For one, I noticed that you used a defined local variable in a function, in the condition, before any information is set to it. Like this a couple other small mistakes. Understanding what your doing in a large scale project will save you heaps and heaps of frustration.

    Taking on a big project is admirable, but is bound to fail if you do not understand the basics of the tools your working with.

  • I tried following some of the problems you ran into, saw some issues the others pointed out too. A major problem with the requests you perform is the sheer size of the project. I opened it, and saw like 20 tabs open .... yikes.

    Suggestion: trimming down an example, to pin point out a problem, often helps a lot to understand whats going on yourself. And from those willing to help, you will get a lot more feedback if the request and information is manageable, in bite size chunks.

    There are some basic fundamental flaws in how you looks at some values and variables.

    For one, I noticed that you used a defined local variable in a function, in the condition, before any information is set to it. Like this a couple other small mistakes. Understanding what your doing in a large scale project will save you heaps and heaps of frustration.

    Taking on a big project is admirable, but is bound to fail if you do not understand the basics of the tools your working with.

    Thank you for the response! I've been trying to understand the basics of construct, and I've read quite a bit of the manual, is there any tutorials or tips you have/recommend? I'm up for anything.

  • Thank you for the response! I've been trying to understand the basics of construct, and I've read quite a bit of the manual, is there any tutorials or tips you have/recommend? I'm up for anything.

    When I started out with construct, for most of the mechanics I fancied using, I made small projects to test and play with it, tweaked it and make it easily to port (copy) to another project. These files contain little examples I often reference for copying purposes, or to try new angles/approaches with a given mechanic, so it perhaps better suits my needs for another project.

    From what I gather from your project and questions is, you lack some insight to local variables, global variables, object variables. This combined for when its used and the data is available. I took a gander in the newer tutorials and found 1 that covers some of your issues.

    construct.net/en/tutorials/using-instance-variables-2326

    Its for dialogues, and it uses instance variables (variables on objects at runtime)

    Its not an all solution for your current issues, but it is some training that covers some grounds of your current problems.

    Good luck

  • In Construct, you need to understand the concept of "Picking".

    Picking is used to specify which instance of the object you want to apply your action to.

    If you apply your action without Picking an object first, the action will be applied to ALL instances of this object.

    For example, check this simple code:

    Here, we did not Pick any instances. So ALL the Sprite objects will have their Variable1 value set to 166556.

    But what if we want only ONE Sprite to have its value set to 166556, while the rest of the Sprite objects remain the same?

    Here we need to use a Picking condition; which will tell Construct which one of these Sprite objects we want to change.

    Notice we added a new condition that starts with "Pick". You can find these conditions under the System plugin, under a category named "Pick instances".

    There are different types of Picking, each one is useful in a specific situation. You can check the manual for detailed explanation. But in general, each one offers you a different way to specify objects.

    Additionally, some objects offer you additional ways to Pick instances:

    One important thing to keep in mind when Picking instances, is that once you pick something, all the sub-events, sub-actions, and sub-conditions will only focus on the picked instance.

    You can think of Picking as a "Filter". It filters instances of the object so you can only focus on a specific group of them.

    For example, if you have 100 Trash Cans, and you want to do something for the Cans in the lower left corner of the map. Then you can filter the instances (using Picking!) to only choose the ones with X and Y within the lower left corner area.

    Additionally, you can apply multiple filters. So you can Pick a group of objects, then add a sub-condition and add another filter. Now the first filter will be applied to ALL instances. Then the second filter will be applied to the RESULT of the first filter.

    So if you have 100 Trash Cans, and the first filter picked 10 out of them, then the second filter will choose from the 10, NOT the 100.

    So for your specific case, I understood from earlier replies that one part of your project is applying an action to ALL instances of the object. So, you can probably guess by now that you need to -somehow!- Pick the specific instance you need to change.

    In the end, Picking can be considered an advanced feature, and it really caused me confusion many times during my time with Construct! But once you experiment with it, you will find out that it gives you some quite powerful tools to control your game!

    Good Luck!

  • In Construct, you need to understand the concept of "Picking".

    Picking is used to specify which instance of the object you want to apply your action to.

    If you apply your action without Picking an object first, the action will be applied to ALL instances of this object.

    For example, check this simple code:

    Here, we did not Pick any instances. So ALL the Sprite objects will have their Variable1 value set to 166556.

    But what if we want only ONE Sprite to have its value set to 166556, while the rest of the Sprite objects remain the same?

    Here we need to use a Picking condition; which will tell Construct which one of these Sprite objects we want to change.

    Notice we added a new condition that starts with "Pick". You can find these conditions under the System plugin, under a category named "Pick instances".

    There are different types of Picking, each one is useful in a specific situation. You can check the manual for detailed explanation. But in general, each one offers you a different way to specify objects.

    Additionally, some objects offer you additional ways to Pick instances:

    One important thing to keep in mind when Picking instances, is that once you pick something, all the sub-events, sub-actions, and sub-conditions will only focus on the picked instance.

    You can think of Picking as a "Filter". It filters instances of the object so you can only focus on a specific group of them.

    For example, if you have 100 Trash Cans, and you want to do something for the Cans in the lower left corner of the map. Then you can filter the instances (using Picking!) to only choose the ones with X and Y within the lower left corner area.

    Additionally, you can apply multiple filters. So you can Pick a group of objects, then add a sub-condition and add another filter. Now the first filter will be applied to ALL instances. Then the second filter will be applied to the RESULT of the first filter.

    So if you have 100 Trash Cans, and the first filter picked 10 out of them, then the second filter will choose from the 10, NOT the 100.

    So for your specific case, I understood from earlier replies that one part of your project is applying an action to ALL instances of the object. So, you can probably guess by now that you need to -somehow!- Pick the specific instance you need to change.

    In the end, Picking can be considered an advanced feature, and it really caused me confusion many times during my time with Construct! But once you experiment with it, you will find out that it gives you some quite powerful tools to control your game!

    Good Luck!

    Is there a way to pick multiple of the same object, even if they have different UIDs but different variables? So I don't have to individually hardcode each one?

  • Use iteration loop ('for', 'for each', for each '(ordered)') to collectively picking instances or using 'pick by evaluate', 'pick by comparison' and other similar operation. Plenty of choice to automate the process even feeding the loop to use in action by utilizing expression.

    Here an example that picking instances based on position & set instance variable based on loop order:

  • Okay, I understand this perfectly, but I need a guide as to exactly where to put this loop on my project. **Also, could you explain it in a way that could relate specifically to picking/UIDs?**

  • You already have instance variable NPCID. One with value 1 and other with value 2. That would be enough to differentiate dialogues. Forget about 'loop' for now and let's talk about tokenat to retrieve strings. I'll make simple example first.

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