It's been a while since I touched this code but I finally created a system that works well for this and it will be tested in the next game and implemented in this one as soon as I recode it.