How do I store lots of names that i can call a random one later?

0 favourites
  • 8 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • so. i want to store 30 names. then i want to call a random name on a creature spawned

    i could use dictionary and insert a name line by line. then random(1,30) on the x axis.

    but.. is that the most efficient way?

    could i use clipboard, local storage, file system: to achieve this easier?

    none of which i have experience on. so if i get the nod ill work on the favorable method.

    thanks

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure about Dictionary ? maybe ? but I would do what you described in an array yep. You can push 30 names into the array on start of layout or you could use an array file and load it in.

  • ah yeah, i meant array. i used dictionary to store names on picked up objects.

    just seems like an hour of clicking and adding 1 to each event. but, if that is the best way im down to do it,

    ty

  • Didn't quite get the response, as I understood your game the 30 names are already stored in an array and when you click on an enemy it picks a random one from the 30, so array should be good.

  • "i could use dictionary and insert a name line by line. then random(1,30) on the x axis."

    is what i said. but you cant insert name line by line in a dictionary; i used the dictionary to store up to 8 values on picking up creatures to memorise their name and hp. so on dropping them i just spawn a new one with the same stats and name.

    i meant array.

    *i could use *array* and insert a name line by line. then random(1,30) on the x axis.

    * sorry if i confused the matter!

    i havent stored anything yet. wanted to know the best way TO store names.

    using an array, ill have to individually put in the names.. and.. its 30 names for imps.. each creature will have 30 names. so ill have to add hundreds of individual names into an array. possible.. but oof, that will take a day just to do that.

    is there a better method to add 30 names, per creature type? like clipboard, where i can just type out all names, and pick a random line of text.

    not a hard task, just wondering the most efficient way to do it.

    ty as always lionz

    the effect is. each creature will have its own name

  • If it were up to me, I would simply create an Excel sheet with all the data, placing each creature in a separate column and listing the 30 names on the Y-axis. Once completed, I would copy the data into a C3 array, use Ajax to load it into an Array object, and then manipulate it as you need.

    You can even create the names with the help of AI in a table format already.

  • never tried it, love it. perfect thanks so much

  • When I said above, use an array file and load it in, this is what I meant lol, good luck !

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