Unconnected's Recent Forum Activity

  • Thank you guys for helping.

  • Just a simple problem I can't figure an answer to. I have an object that creates groups. Each group is given a unique GroupID via Instance Variable, and can be erased/destroyed at any time.

    The GroupID gets re-used if a group is destroyed.

    If GroupID 8 gets destroyed a Group created can have GroupID 8.

    I can't use UID or IID because objects are not created in a specific order.

    Each group has a different amount of objects.

    I can't use 'Pick Highest' because GroupID 8 won't always be the highest.

    Group 7 can exist, Group 8 can be missing and Group 9 can be existing... etc.

    In Events how do I check to see if GroupID 7 exists? I don't have any collisions enabled and would like to not use them if possible, I am trying to limit collisions to only objects it is required to. I am sure this can be done with a variable anyway.

    I don't have much of a capx to give an example, because I am not 100% sure how to approach this.

    I am only wanting an example. I am just not sure of what Expression/Event to use, just a point to the right direction is usually enough. I didn't seem to find what I was looking for by searching.

  • I explained my issue in my capx and gave the needed info and asked for a function that worked only when a variable is equal to 1 or 2, and I didn't want the function to have to check every single instance when it ran. I gave the answer of groups in the original post. I was only trying to find a solution that didn't have to add a group leader and didn't run all the time. I ended up with a mixture of what I wanted and what I didn't. Every half second Construct 2 checks 12 objects instead of 624. I was wanting it as a trigger, but it is becoming to much trouble. This solution is simple and works.

    The point of the slowed loop was, I was going to put it in a trigger event.

    This prevents needless checks on ticks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can have wait in loops. I have seen a few examples and I even had a few example Capx that worked with wait in a loop. You just have to do is add:

    "wait '1*loopindex' seconds"

    Into the loop. It seems to work for every loop except for what I was trying to do. I can only assume I had something structured wrong.

    I have a lot of complicated groups in the capx to make things appear in certain ways and it is a project I have been working on for a long time. I don't want to just make my project Public Domain by adding it online. I have a ton of my own art and my own sounds etc in it. I can't just copy a few groups or events out into a new capx, because it is intertwined rather well. I suppose I could post a photo, but then I would have to explain every Variable. I will admit sometimes I will over complicate something, but I always come up with a more simple solution, or someone points it out. I may have an extra unneeded variable here and there that isn't needed, but all groups and functions are done rather simply and function very well.

    I found it would be better to ask for an example or a solution to a problem. I was having an 'expression' issue, mostly because I am still learning how Construct 2 handles things and sometimes forget how flexible Construct 2 is.

    I have never needed a loop that ran until a variable is not equal to X.

    I found out it can be done with 'Repeat'

    I have never needed a loop to have 'wait' in it before. It is possible because I've seen it done and know how to do it now. It wasn't working in my 'Repeat' loop, but it was working in other loops I tested out. My structure was wrong on that 'Repeat' loop probably, but I am not using it anymore.

  • I figured I was probably going in the wrong direction so I created a Group Leader and every group leader gets checked every few seconds. Every group is made using a number sequence. 8, 24, 48, 80, 120, 168, 224, etc... I am able to actively check 12 objects instead of 624. If the group leader has a variable change the whole group changes accordingly.

    I still find it hard to believe I was having trouble finding a 'While' or 'Repeat' loop example with an efficient 'Wait' built in. I finally found a solution on a forum and it wasn't working for me for some reason, it even looked exactly like what was posted.

    I would have rather had a Trigger Loop with a timer, but I couldn't figure it out. This will do for now.

    Starting to think of it, the problem in the loop was probably a variable type.

    I know when I make a 'Zoom' Variable it has to be global or it won't work... Maybe it is the same issue.

    Gearworkdragon

    Not fully but I did something similar and was posting about it when you typed your post. Thank you for your time.

  • I found out you can use Repeat (Variable <> 1)

    Right now I have:

    'Repeat' loop with a condition of 'less than 25'.

    The actions are 'wait X Seconds' and 'add to'

    See below:

    Event/Condition -------------------------------------------------------- Actions

    Repeat (Variable is not equal to 1) Times---------------------- Wait 0.5 * loopindex Seconds.

    'GroupFrame' is less than 25-----------------------------------------Add 1 to 'GroupFrame'

    0.5*loopindex is supposed to slow down the loop so it adds 1 to 'GroupFrame' every 0.5 seconds.

    What it is doing is ignoring the 'wait' function. When I run the function in debugger 'GroupFrame' jumps to 25 automatically.

    Can someone show me how to make the loop slow down?

    I am okay if you change the loop completely if it will be better. I am kind of just Frankenstein-ing it together right now anyway.

  • I asked how triggers work, if it checks every object while it is running, if it checks all objects only once, or if it knows which objects are needed by some kind of list or something.

    Can a 'Function' run more than once at the same time for different objects if it is called more than once within a few ticks apart?

    I asked for an example of a while loop, because it seems to be what I need. I can't find an example because nobody uses them anymore it seems.

    I need a loop that will run every 0.5 seconds while a variable is not equal to a specific number. I only know how to run a loop a specific amount of times, or once for every object. I can't seem to find a way around this.

  • Sorry I didn't realize how poorly I explained what I was needing, so I will try again.

    I meant every tick the trigger is running. So does Construction 2 group objects by what a variable equals? Or does a trigger still check every object as long as it's running, or just when it starts? I'm not sure how it would know which objects to trigger and how many times if it didn't check all objects at least once to get info. I try to only use triggers, just not 100% sure how they work yet.

    Can a 'Function' run multiple times at the same time? If Group 6 and Group 5 both call it a few ticks apart?

    If so then can someone show me how to have a loop in a function that loops as long as an objects animation frame is between 0 and the highest frame available (25). A loop based off of animation frame was my main issue, should I have created a 'CurrentFrame' Instance Variable? I currently have a 'SetFrame' Instance Variable that can be -1, or 1 so frame can be changed accordingly based of of 'Status' Variable.

    I know how to make a loop repeat a specific amount of times, just not sure how to make a trigger loop that runs until a variable is equal to a specific value.

    I have thought about on created/destroyed, that is basically what the Capx was (On click play animation "create" on click play animation "destroy").. The Capx was very similar to what I needed. I need more control of the objects frame in case it gets destroyed during creation animation.

    I am aware of Setting 'AnimationSpeed' but once the object reached it's max frame it seemed to ignore any commands.

  • I have a lot of objects that have an Instance Variable called 'Status' .

    The objects will change their behavior based off of 'Status'.

    0 = Idle - Does nothing.

    1 = Creation - Animate when being created.

    2 = Destroy - Animate when being destroyed.

    The objects don't move and don't have health, they are created and destroyed by variable changes.

    The player Creates or Destroys using an in-game Item.

    Each object is created into a group and each group is given a 'GroupID' Via Instance Variable.

    If group 6 is destroyed every object with 'GroupID' 6 will be destroyed at the same time.

    If group 5 is destroyed the next group created will be given 'GroupID' 5.

    Only the highest 'GroupID' can only be destroyed at any given tick, but so can the next 'GroupID'.

    Most of the time 'Status' will be 0. There is a chance a player can Create or Destroy quickly.

    Is there a way to only enable a 'Function' if a 1 or 2 in the variable 'Status' is present in the layout?

    I don't want it checking 800+ objects every single tick, but if they are destroyed or created they need to react instantly.

    The only thing I could think of was creating a 'leader' in each group and then checking the variables needed on the 'leader' object. If the leader objects has the required variable then apply create/destroy to all of the same objects with the same 'GroupID'. Is that a proper solution or is there one better? I assume the 'leader' objects would have to be a 2nd object to prevent the the extra variable checks.

    I only came up with it because of groups, is it possible to do it without groups?

  • I found out it isn't only Construct 2, but Avast blocks similar file types from similar programs. When any executable is being created it isn't always secure, when any executable is set out world wide it becomes less secure due to hack risks. This is why Avast blocks files like this.

    Solution: *do at your own risk*

    In order to open .Capx files when you have Avast installed and 'Hardened mode' enabled, you have to add Construct 2 to the 'Exclusions' list for 'File System Shield' in Avast settings.

    Open Avast and go to Settings.

    There are some tabs on the side, click 'Active Protection'

    Turn OFF 'File System Shield' and click 'Customize'

    There are some tabs on the side of the newly open window. Click 'Exclusions'

    You will see a list of locations, scroll down to the bottom of the list.

    You will see a blank text field that has two buttons to the right of it. Click the 'browse' button.

    Browse to the location you have Construct 2 installed.

    ----Don't open the construct 2 folder you want to select the whole folder, not the folders inside.---

    Click the box next to the Construct 2 folder.

    If done correctly you will see the selected path in the text field, selected 'OK'.

    The selected path you just entered will be highlighted in the list of Exclusions.

    Make sure you click 'Add' on the bottom of the window.

    Close the window with the 'X' or click 'OK'.

    It is important you turn 'File System Shield back on.

    Turn 'File System Shield' back ON.

    Now you should be able to open any .Capx file.

  • That is what I was asking. I couldn't figure out how to put loopindex into a sub-event, so I ended up making a local variable. I didn't think of adding loopindex into "Compare two values". When I think "Compare two values" I think of Instance, local and global variables. Still learning how flexible Construct 2 is. Thanks again. You're always helpful.

  • I was thinking it did that too, but wasn't to sure.

Unconnected's avatar

Unconnected

Member since 6 Apr, 2016

Twitter
Unconnected has 1 followers

Trophy Case

  • 8-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

12/44
How to earn trophies