CJD's Forum Posts

  • Documentation states it only works in a loop, I accidentally posted a picture which was before I figured that out.

    Here is it working now, I have the correct *count* of instances being created, now that I can read it,

    Currently I have it set to " CurY " which is obviously gonna give me the current value being read, being 0-based, it is only reading the first value of the Y axis.

    how do I specify which index on the Y axis to read? ( In an expression, to make sure everyone is looking in the right spot, look where I'm spawning the armor piece, this is where I set my filler "CurY" values, which I wish to change to a proper index search )

  • Shrug, I have no clue and I'm not gonna pretend I do.

    How do you illiterate and do an action for each instance on the X axis?

    This was my attempt, to be crystal clear, this is a downscaled loader, I hooked it up to clicking for testing purposes, I have the save file for simplicity.

    Now that its loaded onto my paste-bin array, how do I read it?

    I tried looping and comparing it with " Compare Current Value " on the X axis,

    but uh, its doing ??? idk nothing I guess.

    Doesn't seem to do anything anyway,

    Its description explicitly states it compares a value with a value through a for each loop.

    Doesn't seem to do that at all in practice, perhaps it doesn't know where to look?

    Edit: I got it working lol

  • Awesome.

    Yeah, it works perfectly.

    I went ahead and made a paste-bin style loader, using the Ajax method.

    There are two arrays, one which stores data and can be cleared for new save data, lets call it " ShipArray ", this is the ship's current layout, technically.

    The next is called " ShipPaste ", this is the paste bin which I'm reading from.

    I got this working here, now, how would I read the data on this sheet for each entry on it and create objects?

    ( Im not sure if this gif is gonna work, I hope it does )

    Edit: It did not, hold on let me just send the link by itself

    i.gyazo.com/38ca21f14db7d602bce5879a93aee365.gif

  • Not scalable, I had a feeling this would be mentioned but learning to save stuff by array gives me more avenues.

    Also, it consumes alot of memory from my tests, I had to run javascript code to clear memory for my game's save file system which is incredibly dangerous.

    So technically I already use this but not for this purpose.

    I'm doing a precision save on a group of objects which allows me to do a whole slew of things,

    like making a ship purchase system where instead of buying parts separately, buy a whole ship.

    I could use arrays to save enemy ship designs, making encounters possible.

    I could even repurpose it to make planetary generation with presets, or maybe use it for character customization, hotbars for items or even inventories.

    Anyway, before this comes to a close, ( assuming I don't find any issues ) here is my save system partially set up in action:

    Thank you both of you for your help, I learned abit today.

  • Lmk if this looks right, it looks right to me and it seems to be adding a new entry, so now If I wanted to add the instance name ( which in this case since C2 doesn't have instance naming ) Ill just make a variable which does that for me.

    so itll be, X, Y, ZIndex, InstanceName(A Variable containing the instance's name, because construct runs on reference, if I define what that instance is in the loop, I can set the value to the variable stored in the instance.)

    When I start loading, I check the array, I look across its indexes for the name through a comparison, if object = object then spawn object, then I set the position of object with its other info.

  • Wait never mind I think I got it to work, I had to tinker around with it but it seems you set its size to zero,

    but pushing back on the X axis with Armor.X adds a new entry, in my opinion is super weird.

    Yeah it works and I sort of understand whats going on but it isn't very intuitive.

  • Array set at ( XY )? I don't know which type of setting your using.

    the next part containing the width, not sure what this is for? Is this to get the next column down? If so, what's the point of having a push back at the start?

    both the X and Y data of the object must be stored on the Y axis, which we seem to be on the same page on, but I don't quite understand the steps shown in your example.

    So I'm pushing back everything on the X column ( I assume that's what this means ), so that I can add a new entry, then I'm setting on a new entry my X, Y and ZIndex information on the Y axis?

    Perhaps some more clarification is best.

    Edit: I just realized this isn't going to work anyway, your suggesting I keep the size set outside of the loop, but when I do this in practice, it never adds a new column since I'm using the size set to ADD a new entry.

    I assume somewhere in this there is a different way of doing it?

    To be clear, I can't set the exact size of my array, this is a ship customization system where a player can always add more parts to a ship, so I won't know how many parts are going to be listed unless I add onto the size each time they create a new part.

  • okay, so,

    This is technically a C2 question, but the response time for C2 is incredibly slow.

    And no, I'm not updating to C3 and this question is still valid in C3,

    With that out of the way,

    I have an array, this array will be used to store positional data ( X, Y, Zindex ) and the instance type as a string.

    I haven't gotten to the string part, as it's a last step.

    The point of the array is to save this data to a Json file, which I would then use; how is irrelevant.

    I'm using this for a ship construction system where parts of a ship can be moved around and built, so obviously it would be nice to have a way to save your ship.

    I picked this method as I can expand its functionality to whatever I want, character customization, ship customization, planets, whatever.

    My issue:

    I'm trying to save multiple object's positions to an array, unfortunately, every time I do, it saves it to only one row on the X axis, each row is supposed to be its own instance, the rest of its information is on the Y axis.

    Heres the script:

    Heres the result:

    Heres how it should look like:

    The last image ( how it should look like ), obviously has made up numbers, but it shows how I want it to look, By the way, I only roughly understand how to use arrays, I've been using tutorials, documentation,

    and this is as far as I got; which is pretty far because it almost works.

    So, how would I add information for each new entry?

    I've tried " For each Element " couldn't get it to work as intended but thats likely because I misunderstood how its used.

    To make this clear, I just want to know how to fix this issue, so try to stay on subject, I am well aware there are multiple methods to do this, and that there are also multiple ways I can carry this out from here, but to make sure your point is understood some help on this would be appriciated.

    If you have to correct my use case, thats fine too; the goal is to learn.

  • ok so:

    " window.indexedDB.deleteDatabase('_C2SaveStates'); "

    Worked flawlessly, I couldn't find any issues with it other than it doesn't discriminate when it comes to which save its deleting,

    so I can't really have multiple saves and the ability to manually delete each.

    I thought perhaps I could delete files with NW.js since it has file manipulation, but uh, I can't find the file path for these so I can't really delete them with this method.

    Any suggestions on how I can find these files? They're saved as .jsons since thats what I set them to, I really wanna use this method because it allows me to make folders and organize my game in a way that looks professional,

    I can even hide my files in their x64 Program folder and work on a launcher for my game.

  • Apparently, using localstorage is a way to get around this,

    Based on what a couple forums have stated:

    " You can use LocalStorage to track which saves are in use, where you can iterate and delete keys. "

    My problem is, Im saving keys for each save slot, checking them, and deleting them, I am NOT clearing memory up on my system by this method, am I?

    In theory all that would be happening is I cleared a key, now that save cannot be used, so in other words,

    That save permanently uses memory unless I found it manually and deleted it.

    The best I could possibly do to make sure a player isn't gradually using more and more memory is by overwriting an existing save state with this method slapped ontop of it.

    It feels like an oversight, the only "risk" I've seen with giving people the ability to delete save states is the idea that you can delete system components with it.

    But this is an ENGINE, and I am a developer of a game utilizing it.

    It would be my job to make sure thats not possible, limiting file input types is already a thing in C2 and C3, furthermore, I can add name comparisons on savestates as a second security measure.

    I saw suggestions of running Javascript instead and people stated it was a " Hacky " method, I don't think so.

    Your using the engine to pass code, hacky would be like changing the engine itself.

    So, I was wondering, how does this whole

    " window.indexedDB.deleteDatabase('_C2SaveStates'); " Thing work anyway?

    Where do I input the specific json and how do I manipulate this line of code to include the target file?

  • I must be some kind of challenged, but finding the make new forum page button on this website is confusing,

    It literally took me a week to find it this time around.

    Its just not intuitive at all and I think part of that is to blame on repurposed servers from old C2 posts in favor of C3.

    I feel like it *should* be on the "Forum Home" page, with a separate link on the "search" page to give people the option to just, make a new post if they can't find what they're looking for.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Shame this went inactive after 21, now 22 posts.

    Looks like I'll have to start another sometime soon.

  • Getting a new issue that might stump me for awhile, picked count will pick the correct number of instances colliding with AIGroup,

    But occasionally it'll add 1 extra to that count, this is a tad annoying.

    Instances dont overlap it again, it just adds one to the final count.

    The event is triggered once for all overlapping instances,

    Oh it also SPAWNS IN with a count of 1, despite not overlapping any AI yet.

    My temporary fix is to just -1 from the final count and double check that its for each group rather than all of them, I feel like this is running from the issue and not actually fixing it,

    Any ideas?

  • Small issue, why does pickedcount only return one?

    So I changed the method of counting collided instances of my sprite "AIGroup"

    In my head, Pick by AI Overlapping my AIGroup Sprite, Set the value of counted AI to Picked Count.

    This only returns 1 for whatever reason, is picked count some kind of Boolean Expression where 0 is it picked nothing and 1 is something?

    Im kinda disappointed if so.

    I need picked count to return the number of picked instances, which it doesn't seem to do.

    Edit: I changed out my pick method to pick by comparison and it worked, I'm good now lol.

  • Definitely a welcome surprise to get resources for this,

    I guess this problem has become so much of a mess that the only thing everyone can do is throw calculators at it.

    Shame I'm taking acouple lenses off my scope, but I may come back in the future because for reasons I explained above,

    both of my solutions kinda suck in their own ways! So although they'd work fine I may need to swap them out for a formula generated by these calculators.

    I might know trigonometry, but I definitely don't feel like using that knowledge for anything more than operating a calculator lol.

    That plus I'm sure it'll work, that golden 1 line of code, 1 expression quota is too attractive for me to give it up.