#is this array incorrect?

1 messages · Page 1 of 1 (latest)

brittle jolt
#

'==+' includes all mobs not just the specified ones mb forgot to mention that

hexed reef
#

You’re comparing a string (.typeId) to an array turned into a string ('${mobs}') so it will always be false- what you’re wanting to do here is do mobs.includes(hurtEntity.typeId) which will check if the array mobs includes the hurt entity type

brittle jolt
#

oh mb

hexed reef
#

And ==+ returns true because you’re adding the array string to the string (which will always be true)

brittle jolt
#

idk how ive gone this long without having to use a single array

hexed reef
#

They’re very useful

brittle jolt
#

so .includes detects if the typeId includes any of the values in the array?

hexed reef
#

If the array includes the typeId

brittle jolt
#

yea

#

thats what i meant mb😭

hexed reef
#

if (mobs.includes(typeId))
Means “if the array ‘mobs’ includes the typeId, return true”

brittle jolt
#

yea

#

okay

#

thank you

#

im gonna try and learn more about arrays lol😭