Effeciently Preset Array

Get help using Construct 2

Post » Thu Jan 10, 2013 5:42 pm

So far I've mostly been happy with my purchase of a C2 license, and have created a few different simple games to get a feel for the workflow and tools available.However, I've been having a serious issue lately with arrays.

I'm about to enter the last semester of my BS in CS, so it's fair to say I already know more than I ever cared to about arrays and how to use them. My problem is that there seems to be a distinct lack of a simple way to set the contents of an Array before the game starts.

Here's what I mean:

For the sake of argument and simplicity, suppose I have designed the name, stats, price, rarity, etc. for a list of 20 or so weapons in an RPG example. I don't need to change this data at runtime, I just need an efficient way to load this content into an array while still being able to modify it later for balance reasons and of course I need to be able to access that data at runtime for shops and combat and such.

My problem is that unlike for all other objects or variables, there doesn't seem to be a convenient field anywhere where I can enter the data in.

Maybe I'm missing something, surely there must be a simple solution to what must be a common problem. I'd really appreciate it if someone could point me towards the 'standard' way to initialize an array in this way in C2.   
B
3
Posts: 8
Reputation: 618

Post » Thu Jan 10, 2013 7:07 pm

To make the preset you could make a utility capx to fill in values in the array then save it to a file with the download action. Add that file to your project and load it with the AJAX object and the array load action.

There are also a few 3rd party plugins that allow loading other file formats such as csv.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Thu Jan 10, 2013 7:19 pm

That sounds like making the data equivalent of a map editor. I could do that but yeah, it still seems like there should be a more direct way built in to set the starting values in an array.

Loading a CSV would work nicely. I'll look into that plugin you mentioned.
B
3
Posts: 8
Reputation: 618


Return to How do I....?

Who is online

Users browsing this forum: GUN, MrLOL64 and 12 guests