Question on Arrays

0 favourites
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Almost perfect! I am trying to work on the rest of the functionality so that you three aren't doing all of my homework, the saver is done, and half of the loader is done,

    However I have run into an issue, It doesn't seem to be treating the armor pieces as separate instances, sending them to the same spot.

    Now its entirely likely that I accidentally put them that way in the save file, but I'm quite sure I didn't.

    Good news though, it read all of the data of the armor piece, spawned it and placed it in the correct location...

    But uh, that's the correct location for one of the multiples of the same instance.

    Perhaps I did something wrong?

    Heres the loader portion of script:

  • Where you have curY it should be curX for the row.

  • It worked, but I'm again confused, those values were stored on the Y axis, okay,

    I think I might know where my confusion is coming from,

    so, it looks like I'm asking for the X axis instance, but that's only to reference it.

    I'm not specifying where to look on the Y axis with CurX, I'm specifying the instance I'm looking into, then moving up the index, I get the X, Y, and Zindex of that instance.

    In my opinion this is so counter intuitive that even though from here on out I can absolutely apply it confidently,

    If I were to program an array function with search functionality for a game engine, Id have Cur# be a listing expression,

    so if I were to do the same thing I did above,

    Id go, Has Value = "armor" ( this is so that I've already specified which instance on the X axis I'm requesting, I shouldn't have to do it again??? This would do the same thing as CurX in this situation but I wouldn't have to type it out again ) Instance.At()

    And then inside the "()" I'd use CurY to look into the Y axis to retrieve my values.

    I know for a fact I'm not the only one who finds this confusing, I've seen programmers hop on here and say its convoluted, even if they eventually figure it out with the help of this community.

    Alright, I think I can continue from here and exit the prototyping stage, I'm sure some of you noticed the script was pretty small, that's only because it's in its own testing area for safe keeping.

    Time to scale it up and see if it truly works.

    I'll let everyone know if I have issues, but assuming things go smoothly, Ill post the entire save and loading system step by step so that anyone from C2 or C3 can replicate and modify.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Think of it like an excel spreadsheet, your items are stored as a list of rows with each column having the different stats per item. When you search for 'Armor' you are locating a cell that has 'Armor', once found you are at an x,y. To find the other stats for that item you use that row (current X) and adjust the current Y to go to each column across the row.

  • Thanks for the in-depth, all of you had been a massive help.

    I would send each of you a free copy of the final project but steam SDK for C2 is genuinely impossible to set up even with documentation and scouring the specific files needed with a time machine-website.

    Doing it any other way, like with a repository like github, wouldn't be super attractive to download from, that plus they have a file size limit.

    Anyway, back on the subject I have set up the entirety of spawning ships in since last night, ending it on part count logic, I quickly figured out you can get the size of the loaded file before spawning the ship from the paste-bin array,

    comparing its width (X) and checking to see if the file is too large to insert into the layout.

    Additionally, I have a part count limit which checks during a spawn attempt for redundancy.

    It is still alittle finicky, like the entirety of this game.

    Oh, and I was trying to figure out how to make sure you aren't spawning in parts you don't have/own, used my list which counts down each spawn, then checks if you still have any more of it, I first used this to spawn in parts one by one.

    Only difference is I'm using it in conjunction with my spawning system to spawn multiples, with the correct location and Z order.

    Here is the full script, anything hidden is just object listing, anyone copying this will have to include their own objects within those lists.

    Variables with the number "2" with them I.E "PartCount2" are duplicated variables from the main project file, these will be deleted and replaced with the originals.

    Hmm, what else, Trying to be thorough here, any suggestions?

  • Unfortunately, I'm not done yet with spawning,

    As with any game this complex, just adding a new complex feature without something breaking is always likely.

    My crew's movement system runs on a step-timer, so that they can snap position to each hull piece and not vacuum/void themselves by leaving the ship.

    Note: My ship doesn't have wall collisions, instead, I make the game check if something *can* leave. I do this with everything, including projectiles, they basically bounce off of nothing and stay within the ship's hull (with tolerance, its not perfect but it works).

    Now you might be wondering why this relates to ship loading, well, when I spawn my ship, they don't have anywhere to snap to,

    I know theres some kind of way to get around this, like temporarily deleting my crew ( saving them on a array ) and loading them back in within the hull.

    Currently I have them teleport to the cockpit which isn't super reliable, because you can remove the cockpit and move it around, I don't wanna remove any of these capabilities as it makes ship creation more versatile.

    I'll try to figure it out myself but Ill probably be back here asking for help on a solution to my loader to fix this.

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