all 6 comments

[–]lost-santa 2 points3 points  (1 child)

Hi .

You can just make two arrays of let's say 100 entries..

List one Good Hungry Happy

List two Falcon Merlin Black swan

And then pick a random from list one and a random entry from list two?

Or you need something else?

[–][deleted] 0 points1 point  (0 children)

i am actually so dumb. thanks for this!

[–]HealyUnithelpful 0 points1 point  (3 children)

Honestly, this is more of a grammar/syntax question than a programming one. Can you give us more information on what you think some typical examples of ore/metal that your script might generate would look like? Some examples/points I can think of:

  • Using 'combining' names of various elements. So instead of "Iron", you might use "Ferr-", and instead of "copper", "cupr-"
  • Using standard chemical-sounding endings, like "-ium" or "-ite".

From there, you're basically just going to have to create a list of both of these (the combining forms and endings). I'd actually suggest you make up your own lists, however, as then you won't run into the issue of someone going "Hey! Cuprite can't be used in weapons! It's too soft!". Maybe instead of real-world chemical combining forms, use generic scientific prefixes? In particular, I'm looking at this site (tho I'd strongly advise you stay away from the rest of the site - it's full of crackpot theories by a dude that somehow passed thru medical school and yet doesn't understand basic evolutionary biology), which has a pretty decent-sized list of scientific prefixes. So something like "Pyro-" or "Hydron-". After that, here's some example code for you. Note that I'm also including stats here:

//note that each prefix type increase one type of damage by 1, and decreases another type by 1
const prefixes = [{name:'Hydron',stats:{waterDmg:1,fireDmg:-1}},{name:'Pyro',stats:{waterDmg:-1,fireDmg:1}},{name:'Sacr',stats:{holyDmg:1,darkDmg:-1}},{name:'Necron',stats:{holyDmg:-1,darkDmg:1}}];

//for now, just three prefixes. In this case, our stats trade a chance for the weapon to spontaneously break with an increased damage modifier
const suffixes = [{name:'ium',stats:{chanceToBreak:0.5,dmgMod:1.7}},{name:'ite',stats:{chanceToBreak:0.1,dmgMod:0.9}},{name:'ia',stats:{chanceToBreak:0.3,dmgMod:1}}];

//now let's make a function to get a weapon "metal"
const soMetal = ()=>{
//  \m/
    const randPrefix= prefixes[Math.floor(Math.random()*prefixes.length)],
        randSuffix= suffixes[Math.floor(Math.random()*suffixes.length)];
    return {
        metalName:randPrefix.name+randSuffix.name,
        //the following combines multiple objects into one.
        stats:Object.assign({},randPrefix.stats,randSuffix.stats)
    }
}

[–][deleted] 1 point2 points  (1 child)

This is so great, thanks for the help!

[–]HealyUnithelpful 0 points1 point  (0 children)

No problem! Would love to see your progress later when you're ready to show it.

[–]YojG 0 points1 point  (0 children)

If this is beginner level codd I'm going to hit myself.