I have an EnemyList set as a dictionary it looks like this

var Goblins = {
"Goblin Scout": {"EnemyLevel":1, "EnemyHealth":15, "EnemyDMGmin": 3, "EnemyDMGmax":5, "EnemyDEF":1, "XPgain":5}
"Goblin Warrior": {"EnemyLevel":2, "EnemyHealth":24, "EnemyDMGmin": 5, "EnemyDMGmax":8, "EnemyDEF":3, "XPgain":8}
"Goblin Ranger": {"EnemyLevel":2, "EnemyHealth":19, "EnemyDMGmin": 3, "EnemyDMGmax":5, "EnemyDEF":2, "XPgain":8}
"Goblin Mage": {"EnemyLevel":2, "EnemyHealth":17, "EnemyDMGmin": 1, "EnemyDMGmax":4, "EnemyDEF":1, "XPgain":8}
"Goblin Thief": {"EnemyLevel":2, "EnemyHealth":21, "EnemyDMGmin": 4, "EnemyDMGmax":8, "EnemyDEF":2, "XPgain":8}
}

Is it possible for a battle system to randomize and pick three of these enemies (even two of a single type if thats not too complicated) and use them as the enemies for the characters to battle?

It should not be too hard. Something like this should have the effect you are looking for, though I have not tested the code (writing from memory):

func get_random_dictionary_items(dictionary, number_of_items): var return_list = [] var dictionary_keys = dictionary.keys(); for i in range(0, number_of_items): var random_dictionary_index = rand_range(0, dictionary_keys.size()-1); var random_item = dictionary[dictionary_keys[random_dictionary_index]]; return_list.append(random_item); print (number_of_goblins, “ of random items chosen”); print (return_list); return return_list

I have used code similar to this several times for retrieving random items for a dictionary. There are probably better/cleaner ways of doing it, but the above code is generally what I use. Hopefully it will help :smile:

4 years later