What are those variable names xD
Anyway when reading from a file in a loop you shouldn't use read_file, read more about it
here. ( Not saying that is the issue tho )
Did you see if your values actually get read, so I know what to look for, because i can hardly find my way with your variable names hahaha ?
EDIT: but here is your issue
Code:
if(ent == PurposeLess)
You are checking entity index against some sort of a counter.
__________________