Unconnected's Forum Posts

  • Thank you for the Drag and Drop, that is very helpful.

    I am not understanding your explanation of Constant and Static. When are they reset? When I use a Static I never notice it changing unless an event or action made it. I've never seen a Static change by itself unless it was told to change.

    What is the difference in using a Static and not changing it with Events or Actions VS using a Constant and not being able to changing it with Events or Actions? I mean if I don't need it to be changed why would I try to change it?

  • I was curious if it is possible to change a variable type without having to change every event associated with that variable.

    From Local to Global.

    From Global to Local.

    While we are on variables can someone tell me the difference in Static and Constant? I am aware that Constant stays the same and Static can be changed, but I am not understanding why there is a need for that. I have never used a Constant, I only use Static. If I don't make an action/event that changes a Static Variable than why would I need to make it Constant? To me it just seems like Constant and Static does the same thing.

    Also in a variable is 01 the same thing as 1? I assume it ignores any 0s before any real numbers.

  • Everything is working correctly now. If a group is already in existence, it won't create a new group on top of it.

  • Okay that was simple. It was what I was needing. Can't believe I wasted that much time trying to figure it out, and that search results didn't bring up "compare instance variable". I probably typed in the wrong keywords. I guess I didn't realize that, that action could be applied if the variable value was missing. Thanks again.

  • I am still needing to check if an object exists or not. I need to use use it's GroupID because it is already used in other events and it isn't equal to it's IID. IID starts at 0 and GroupID starts at 2 for offset reasons. It isn't always a guarantee the Groups will be created in order as well. If IIDs are in order from left to right as 1, 8, 3, 4, 5, 6, 7, 2, then things will start to get confusing. I suppose this would happen if group 8 and 2 get destroyed and group 8 is recreated first.

    I would rather have an extra variable that gives a needed value than to use IID and still have to make a variable for offset to figure the value, or have to complicate other events with offsets.

    I need to check if GroupID X exists or not. If it exists I have to change a variable to prevent a new group from being made on top of it.

    I know how to check an existing variable on an existing object, I just don't know how to check if an object exists. I would suppose I could try blindly sending a variable change. If the variable changes it exists, if it doesn't it won't change. Either way I will know what to trigger. I am not sure what would happen if you try to change something that doesn't exist though. Perhaps a way of just having it check each existing object type for a given variable's value.

  • I don't think I am trying to redo the IID. I assigned an object to each group so Construct 2 usually only has to check 12 objects every few seconds and not 500+.

    Each group has an ID assigned to it. If group 9 is created and then group 1 is destroyed then group 1 will have higher IIDs wouldn't it? If an IID is destroyed does it's IID get re-issued?

    I can use IID as you said. I would have to apply it to the groups leader and not the group itself. How do I check to see if an IID value exists then? I will admit it is my fault I left that part out, sorry.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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?