Use a creative_prop as the key for a map?

I’m trying to make a map with a creative_prop as key and a custom class as a value, so the map would look something like var CustomCreatures:[creative_prop]custom_creature = map{}, however i get the following error:
'creative_prop' cannot be used as the type of map keys because it is not comparable for equality.

I get why the error occurs, but the custom_creatures class i’m using as the value for the map is already of type <unique>, i.e. custom_creature := class<unique>:, and to call the class in my code i need to store it in a map. Does anyone know a way around this?

You need some kind of comparable as key (for example numbers, but then you could just make an array). Could you send more of your code as context if you need further help?

Thanks for the reply! I’ve actually just solved the problem already, turns out I was being dumb. What worked for me was creating a unique_creature class that is just a replacement for the creature type, since the class converts it to a unique one, when adding the unique effect so

unique_creature := class<unique>:
    Creature:creative_prop

and then instead of passing in the creative_prop in the map, i just passed in the unique_creature like this:

var CustomCreatures:[unique_creature]custom_creature = map{}

I converted the creature to the unique_creature class using

UniqueCreature := unique_creature{Creature:=Creature}

and after I just added it to the CustomCreatures map.

1 Like